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

Side by Side Diff: content/common/gpu/gpu_command_buffer_stub.cc

Issue 8827005: Revert 113250 - Add CommandBuffer::SetGetBuffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years 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 | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('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 #if defined(ENABLE_GPU) 5 #if defined(ENABLE_GPU)
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 return false; 80 return false;
81 } 81 }
82 } 82 }
83 83
84 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers 84 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers
85 // here. This is so the reply can be delayed if the scheduler is unscheduled. 85 // here. This is so the reply can be delayed if the scheduler is unscheduled.
86 bool handled = true; 86 bool handled = true;
87 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) 87 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message)
88 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, 88 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize,
89 OnInitialize); 89 OnInitialize);
90 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetGetBuffer,
91 OnSetGetBuffer);
92 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, 90 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent,
93 OnSetParent); 91 OnSetParent);
94 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); 92 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState);
95 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast, 93 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetStateFast,
96 OnGetStateFast); 94 OnGetStateFast);
97 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); 95 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush);
98 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); 96 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled);
99 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, 97 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer,
100 OnCreateTransferBuffer); 98 OnCreateTransferBuffer);
101 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, 99 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 surface_ = NULL; 152 surface_ = NULL;
155 } 153 }
156 154
157 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) { 155 void GpuCommandBufferStub::OnInitializeFailed(IPC::Message* reply_message) {
158 Destroy(); 156 Destroy();
159 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, false); 157 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, false);
160 Send(reply_message); 158 Send(reply_message);
161 } 159 }
162 160
163 void GpuCommandBufferStub::OnInitialize( 161 void GpuCommandBufferStub::OnInitialize(
162 base::SharedMemoryHandle ring_buffer,
163 int32 size,
164 IPC::Message* reply_message) { 164 IPC::Message* reply_message) {
165 DCHECK(!command_buffer_.get()); 165 DCHECK(!command_buffer_.get());
166 166
167 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "TryCreateGLContext"); 167 UNSHIPPED_TRACE_EVENT_INSTANT0("test_gpu", "TryCreateGLContext");
168 168
169 command_buffer_.reset(new gpu::CommandBufferService); 169 command_buffer_.reset(new gpu::CommandBufferService);
170 170
171 if (!command_buffer_->Initialize()) { 171 #if defined(OS_WIN)
172 // Windows dups the shared memory handle it receives into the current process
173 // and closes it when this variable goes out of scope.
174 base::SharedMemory shared_memory(ring_buffer,
175 false,
176 channel_->renderer_process());
177 #else
178 // POSIX receives a dup of the shared memory handle and closes the dup when
179 // this variable goes out of scope.
180 base::SharedMemory shared_memory(ring_buffer, false);
181 #endif
182
183 if (!command_buffer_->Initialize(&shared_memory, size)) {
172 DLOG(ERROR) << "CommandBufferService failed to initialize.\n"; 184 DLOG(ERROR) << "CommandBufferService failed to initialize.\n";
173 OnInitializeFailed(reply_message); 185 OnInitializeFailed(reply_message);
174 return; 186 return;
175 } 187 }
176 188
177 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get())); 189 decoder_.reset(::gpu::gles2::GLES2Decoder::Create(context_group_.get()));
178 190
179 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(), 191 scheduler_.reset(new gpu::GpuScheduler(command_buffer_.get(),
180 decoder_.get(), 192 decoder_.get(),
181 NULL)); 193 NULL));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
268 parent_texture_for_initialization_ = 0; 280 parent_texture_for_initialization_ = 0;
269 } 281 }
270 282
271 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); 283 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true);
272 Send(reply_message); 284 Send(reply_message);
273 285
274 UNSHIPPED_TRACE_EVENT_INSTANT1("test_gpu", "CreateGLContextSuccess", 286 UNSHIPPED_TRACE_EVENT_INSTANT1("test_gpu", "CreateGLContextSuccess",
275 "offscreen", surface_->IsOffscreen()); 287 "offscreen", surface_->IsOffscreen());
276 } 288 }
277 289
278 void GpuCommandBufferStub::OnSetGetBuffer(
279 int32 shm_id, IPC::Message* reply_message) {
280 scheduler_->SetGetBuffer(shm_id);
281 Send(reply_message);
282 }
283
284 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, 290 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id,
285 uint32 parent_texture_id, 291 uint32 parent_texture_id,
286 IPC::Message* reply_message) { 292 IPC::Message* reply_message) {
287 293
288 GpuCommandBufferStub* parent_stub = NULL; 294 GpuCommandBufferStub* parent_stub = NULL;
289 if (parent_route_id != MSG_ROUTING_NONE) { 295 if (parent_route_id != MSG_ROUTING_NONE) {
290 parent_stub = channel_->LookupCommandBuffer(parent_route_id); 296 parent_stub = channel_->LookupCommandBuffer(parent_route_id);
291 } 297 }
292 298
293 bool result = true; 299 bool result = true;
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
459 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) { 465 void GpuCommandBufferStub::OnDestroyVideoDecoder(int decoder_route_id) {
460 channel_->RemoveRoute(decoder_route_id); 466 channel_->RemoveRoute(decoder_route_id);
461 video_decoders_.Remove(decoder_route_id); 467 video_decoders_.Remove(decoder_route_id);
462 } 468 }
463 469
464 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) { 470 void GpuCommandBufferStub::OnSetSurfaceVisible(bool visible) {
465 surface_->SetVisible(visible); 471 surface_->SetVisible(visible);
466 } 472 }
467 473
468 #endif // defined(ENABLE_GPU) 474 #endif // defined(ENABLE_GPU)
OLDNEW
« no previous file with comments | « content/common/gpu/gpu_command_buffer_stub.h ('k') | content/common/gpu/gpu_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698