Index: content/renderer/gpu/command_buffer_proxy.cc |
diff --git a/content/renderer/gpu/command_buffer_proxy.cc b/content/renderer/gpu/command_buffer_proxy.cc |
index 384e6e27356a9261c50b6f7fc66021180339a3e7..82c06761023b6ea13b3415ff41f8f4e968249ec6 100644 |
--- a/content/renderer/gpu/command_buffer_proxy.cc |
+++ b/content/renderer/gpu/command_buffer_proxy.cc |
@@ -101,8 +101,7 @@ void CommandBufferProxy::SetChannelErrorCallback( |
} |
bool CommandBufferProxy::Initialize() { |
- ChildThread* child_thread = ChildThread::current(); |
- if (!child_thread) |
+ if (!channel_->factory()->IsMainThread()) |
return false; |
bool result; |
@@ -179,31 +178,19 @@ int32 CommandBufferProxy::CreateTransferBuffer(size_t size, int32 id_request) { |
if (last_state_.error != gpu::error::kNoError) |
return -1; |
- ChildThread* child_thread = ChildThread::current(); |
- if (!child_thread) |
- return -1; |
- |
- base::SharedMemoryHandle handle; |
- if (!child_thread->Send(new ChildProcessHostMsg_SyncAllocateSharedMemory( |
- size, |
- &handle))) { |
- return -1; |
- } |
- |
- if (!base::SharedMemory::IsHandleValid(handle)) |
+ // Take ownership of shared memory. This will close the handle if Send below |
+ // fails. Otherwise, callee takes ownership before this variable |
+ // goes out of scope by duping the handle. |
+ scoped_ptr<base::SharedMemory> shm( |
+ channel_->factory()->AllocateSharedMemory(size)); |
+ if (!shm.get()) |
return -1; |
- // Handle is closed by the SharedMemory object below. This stops |
- // base::FileDescriptor from closing it as well. |
+ base::SharedMemoryHandle handle = shm->handle(); |
#if defined(OS_POSIX) |
- handle.auto_close = false; |
+ DCHECK(!handle.auto_close); |
#endif |
- // Take ownership of shared memory. This will close the handle if Send below |
- // fails. Otherwise, callee takes ownership before this variable |
- // goes out of scope by duping the handle. |
- base::SharedMemory shared_memory(handle, false); |
- |
int32 id; |
if (!Send(new GpuCommandBufferMsg_RegisterTransferBuffer(route_id_, |
handle, |