Chromium Code Reviews| Index: content/common/child_thread.cc |
| =================================================================== |
| --- content/common/child_thread.cc (revision 171309) |
| +++ content/common/child_thread.cc (working copy) |
| @@ -192,6 +192,13 @@ |
| return resource_dispatcher()->CreateBridge(request_info); |
| } |
| +static bool SendFromAnyThread(ChildThread* child_thread, IPC::Message* msg) { |
| + if (child_thread->message_loop() == MessageLoop::current()) |
| + child_thread->Send(msg); |
| + else |
| + child_thread->sync_message_filter()->Send(msg); |
| +} |
|
kinuko
2013/01/07 08:52:01
This change can probably be landed independently?
|
| + |
| base::SharedMemory* ChildThread::AllocateSharedMemory( |
| size_t buf_size) { |
| scoped_ptr<base::SharedMemory> shared_buf; |
| @@ -205,7 +212,7 @@ |
| // On POSIX, we need to ask the browser to create the shared memory for us, |
| // since this is blocked by the sandbox. |
| base::SharedMemoryHandle shared_mem_handle; |
| - if (Send(new ChildProcessHostMsg_SyncAllocateSharedMemory( |
| + if (SendFromAnyThread(new ChildProcessHostMsg_SyncAllocateSharedMemory( |
| buf_size, &shared_mem_handle))) { |
| if (base::SharedMemory::IsHandleValid(shared_mem_handle)) { |
| shared_buf.reset(new base::SharedMemory(shared_mem_handle, false)); |