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

Side by Side Diff: content/renderer/gpu/command_buffer_proxy.cc

Issue 7860028: Retry 3 to split WebGraphicsContext3DCommandBufferImpl::initialize() into two stages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fold thread fixes into this patch. Created 9 years, 3 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | content/renderer/gpu/gpu_channel_host.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/renderer/gpu/command_buffer_proxy.h" 5 #include "content/renderer/gpu/command_buffer_proxy.h"
6 6
7 #include "base/debug/trace_event.h" 7 #include "base/debug/trace_event.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/process_util.h" 9 #include "base/process_util.h"
10 #include "base/shared_memory.h" 10 #include "base/shared_memory.h"
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 task->Run(); 87 task->Run();
88 } 88 }
89 89
90 void CommandBufferProxy::SetChannelErrorCallback(Callback0::Type* callback) { 90 void CommandBufferProxy::SetChannelErrorCallback(Callback0::Type* callback) {
91 channel_error_callback_.reset(callback); 91 channel_error_callback_.reset(callback);
92 } 92 }
93 93
94 bool CommandBufferProxy::Initialize(int32 size) { 94 bool CommandBufferProxy::Initialize(int32 size) {
95 DCHECK(!ring_buffer_.get()); 95 DCHECK(!ring_buffer_.get());
96 96
97 RenderThread* render_thread = RenderThread::current(); 97 ChildThread* child_thread = ChildThread::current();
98 if (!render_thread) 98 if (!child_thread)
99 return false; 99 return false;
100 100
101 base::SharedMemoryHandle handle; 101 base::SharedMemoryHandle handle;
102 if (!render_thread->Send(new ViewHostMsg_AllocateSharedMemoryBuffer( 102 if (!child_thread->Send(new ViewHostMsg_AllocateSharedMemoryBuffer(
103 size, 103 size,
104 &handle))) { 104 &handle))) {
105 return false; 105 return false;
106 } 106 }
107 107
108 if (!base::SharedMemory::IsHandleValid(handle)) 108 if (!base::SharedMemory::IsHandleValid(handle))
109 return false; 109 return false;
110 110
111 #if defined(OS_POSIX) 111 #if defined(OS_POSIX)
112 handle.auto_close = false; 112 handle.auto_close = false;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 void CommandBufferProxy::SetGetOffset(int32 get_offset) { 210 void CommandBufferProxy::SetGetOffset(int32 get_offset) {
211 // Not implemented in proxy. 211 // Not implemented in proxy.
212 NOTREACHED(); 212 NOTREACHED();
213 } 213 }
214 214
215 int32 CommandBufferProxy::CreateTransferBuffer(size_t size, int32 id_request) { 215 int32 CommandBufferProxy::CreateTransferBuffer(size_t size, int32 id_request) {
216 if (last_state_.error != gpu::error::kNoError) 216 if (last_state_.error != gpu::error::kNoError)
217 return -1; 217 return -1;
218 218
219 RenderThread* render_thread = RenderThread::current(); 219 ChildThread* child_thread = ChildThread::current();
220 if (!render_thread) 220 if (!child_thread)
221 return -1; 221 return -1;
222 222
223 base::SharedMemoryHandle handle; 223 base::SharedMemoryHandle handle;
224 if (!render_thread->Send(new ViewHostMsg_AllocateSharedMemoryBuffer( 224 if (!child_thread->Send(new ViewHostMsg_AllocateSharedMemoryBuffer(
225 size, 225 size,
226 &handle))) { 226 &handle))) {
227 return -1; 227 return -1;
228 } 228 }
229 229
230 if (!base::SharedMemory::IsHandleValid(handle)) 230 if (!base::SharedMemory::IsHandleValid(handle))
231 return -1; 231 return -1;
232 232
233 // Handle is closed by the SharedMemory object below. This stops 233 // Handle is closed by the SharedMemory object below. This stops
234 // base::FileDescriptor from closing it as well. 234 // base::FileDescriptor from closing it as well.
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 delete msg; 442 delete msg;
443 return false; 443 return false;
444 } 444 }
445 445
446 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) { 446 void CommandBufferProxy::OnUpdateState(const gpu::CommandBuffer::State& state) {
447 // Handle wraparound. It works as long as we don't have more than 2B state 447 // Handle wraparound. It works as long as we don't have more than 2B state
448 // updates in flight across which reordering occurs. 448 // updates in flight across which reordering occurs.
449 if (state.generation - last_state_.generation < 0x80000000U) 449 if (state.generation - last_state_.generation < 0x80000000U)
450 last_state_ = state; 450 last_state_ = state;
451 } 451 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | content/renderer/gpu/gpu_channel_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698