Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / renderer / pepper / pepper_shared_memory_message_filter.cc
index c1af72d..e270548 100644 (file)
 
 PepperSharedMemoryMessageFilter::PepperSharedMemoryMessageFilter(
     content::RendererPpapiHost* host)
-    : InstanceMessageFilter(host->GetPpapiHost()),
-      host_(host) {
-}
+    : InstanceMessageFilter(host->GetPpapiHost()), host_(host) {}
 
-PepperSharedMemoryMessageFilter::~PepperSharedMemoryMessageFilter() {
-}
+PepperSharedMemoryMessageFilter::~PepperSharedMemoryMessageFilter() {}
 
 bool PepperSharedMemoryMessageFilter::OnInstanceMessageReceived(
     const IPC::Message& msg) {
   bool handled = true;
   IPC_BEGIN_MESSAGE_MAP(PepperSharedMemoryMessageFilter, msg)
-    IPC_MESSAGE_HANDLER(PpapiHostMsg_SharedMemory_CreateSharedMemory,
-                        OnHostMsgCreateSharedMemory)
-    IPC_MESSAGE_UNHANDLED(handled = false)
+  IPC_MESSAGE_HANDLER(PpapiHostMsg_SharedMemory_CreateSharedMemory,
+                      OnHostMsgCreateSharedMemory)
+  IPC_MESSAGE_UNHANDLED(handled = false)
   IPC_END_MESSAGE_MAP()
   return handled;
 }
@@ -46,15 +43,18 @@ void PepperSharedMemoryMessageFilter::OnHostMsgCreateSharedMemory(
     ppapi::proxy::SerializedHandle* plugin_handle) {
   plugin_handle->set_null_shmem();
   *host_handle_id = -1;
-  scoped_ptr<base::SharedMemory> shm(content::RenderThread::Get()->
-      HostAllocateSharedMemoryBuffer(size).Pass());
+  scoped_ptr<base::SharedMemory> shm(content::RenderThread::Get()
+                                         ->HostAllocateSharedMemoryBuffer(size)
+                                         .Pass());
   if (!shm.get())
     return;
 
   base::SharedMemoryHandle host_shm_handle;
   shm->ShareToProcess(base::GetCurrentProcessHandle(), &host_shm_handle);
-  *host_handle_id = content::PepperPluginInstance::Get(instance)->
-      GetVarTracker()->TrackSharedMemoryHandle(instance, host_shm_handle, size);
+  *host_handle_id =
+      content::PepperPluginInstance::Get(instance)
+          ->GetVarTracker()
+          ->TrackSharedMemoryHandle(instance, host_shm_handle, size);
 
   base::PlatformFile host_handle =
 #if defined(OS_WIN)
@@ -62,11 +62,11 @@ void PepperSharedMemoryMessageFilter::OnHostMsgCreateSharedMemory(
 #elif defined(OS_POSIX)
       host_shm_handle.fd;
 #else
-  #error Not implemented.
+#error Not implemented.
 #endif
   // We set auto_close to false since we need our file descriptor to
   // actually be duplicated on linux. The shared memory destructor will
   // close the original handle for us.
-  plugin_handle->set_shmem(
-      host_->ShareHandleWithRemote(host_handle, false), size);
+  plugin_handle->set_shmem(host_->ShareHandleWithRemote(host_handle, false),
+                           size);
 }