Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7441)

Unified Diff: content/renderer/gpu/command_buffer_proxy.cc

Issue 9270025: Remove renderer dependencies from the GPU client classes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add overrides Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/renderer/gpu/gpu_channel_host.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « no previous file | content/renderer/gpu/gpu_channel_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698