Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/debug/trace_event.h" | 8 #include "base/debug/trace_event.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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 66 handle_, renderer_id_, render_view_id_)); | 66 handle_, renderer_id_, render_view_id_)); |
| 67 } | 67 } |
| 68 | 68 |
| 69 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { | 69 bool GpuCommandBufferStub::OnMessageReceived(const IPC::Message& message) { |
| 70 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers | 70 // Always use IPC_MESSAGE_HANDLER_DELAY_REPLY for synchronous message handlers |
| 71 // here. This is so the reply can be delayed if the scheduler is unscheduled. | 71 // here. This is so the reply can be delayed if the scheduler is unscheduled. |
| 72 bool handled = true; | 72 bool handled = true; |
| 73 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) | 73 IPC_BEGIN_MESSAGE_MAP(GpuCommandBufferStub, message) |
| 74 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, | 74 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Initialize, |
| 75 OnInitialize); | 75 OnInitialize); |
| 76 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_MapExternalResource, | |
| 77 OnMapExternalResource); | |
| 76 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, | 78 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, |
| 77 OnSetParent); | 79 OnSetParent); |
| 78 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); | 80 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); |
| 79 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Flush, OnFlush); | 81 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Flush, OnFlush); |
| 80 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 82 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
| 81 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); | 83 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); |
| 82 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, | 84 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, |
| 83 OnCreateTransferBuffer); | 85 OnCreateTransferBuffer); |
| 84 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, | 86 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, |
| 85 OnRegisterTransferBuffer); | 87 OnRegisterTransferBuffer); |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 239 } else { | 241 } else { |
| 240 OnInitializeFailed(reply_message); | 242 OnInitializeFailed(reply_message); |
| 241 return; | 243 return; |
| 242 } | 244 } |
| 243 } | 245 } |
| 244 | 246 |
| 245 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); | 247 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); |
| 246 Send(reply_message); | 248 Send(reply_message); |
| 247 } | 249 } |
| 248 | 250 |
| 251 | |
|
jamesr
2011/07/29 19:55:08
nit: extra newline
| |
| 252 void GpuCommandBufferStub::OnMapExternalResource( | |
| 253 gpu::resource_type::ResourceType resource_type, | |
| 254 uint32 resource_source_id, | |
| 255 int32 source_route_id, | |
| 256 uint32 resource_dest_id) { | |
| 257 GpuCommandBufferStub* source_stub = | |
| 258 channel_->LookupCommandBuffer(source_route_id); | |
| 259 | |
| 260 scheduler_->MapExternalResource( | |
| 261 resource_type, | |
| 262 resource_source_id, | |
| 263 source_stub ? source_stub->scheduler() : NULL, | |
| 264 resource_dest_id); | |
| 265 } | |
| 266 | |
| 249 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, | 267 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, |
| 250 uint32 parent_texture_id, | 268 uint32 parent_texture_id, |
| 251 IPC::Message* reply_message) { | 269 IPC::Message* reply_message) { |
| 252 | 270 |
| 253 GpuCommandBufferStub* parent_stub = NULL; | 271 GpuCommandBufferStub* parent_stub = NULL; |
| 254 if (parent_route_id != MSG_ROUTING_NONE) { | 272 if (parent_route_id != MSG_ROUTING_NONE) { |
| 255 parent_stub = channel_->LookupCommandBuffer(parent_route_id); | 273 parent_stub = channel_->LookupCommandBuffer(parent_route_id); |
| 256 } | 274 } |
| 257 | 275 |
| 258 bool result = true; | 276 bool result = true; |
| (...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 552 new GpuVideoDecodeAccelerator(this, route_id_, this)); | 570 new GpuVideoDecodeAccelerator(this, route_id_, this)); |
| 553 video_decoder_->Initialize(configs); | 571 video_decoder_->Initialize(configs); |
| 554 } | 572 } |
| 555 | 573 |
| 556 void GpuCommandBufferStub::OnDestroyVideoDecoder() { | 574 void GpuCommandBufferStub::OnDestroyVideoDecoder() { |
| 557 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder"; | 575 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder"; |
| 558 video_decoder_.reset(); | 576 video_decoder_.reset(); |
| 559 } | 577 } |
| 560 | 578 |
| 561 #endif // defined(ENABLE_GPU) | 579 #endif // defined(ENABLE_GPU) |
| OLD | NEW |