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); | |
78 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, | 76 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_SetParent, |
79 OnSetParent); | 77 OnSetParent); |
80 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); | 78 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_GetState, OnGetState); |
81 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Flush, OnFlush); | 79 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_Flush, OnFlush); |
82 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 80 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
83 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); | 81 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Rescheduled, OnRescheduled); |
84 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, | 82 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_CreateTransferBuffer, |
85 OnCreateTransferBuffer); | 83 OnCreateTransferBuffer); |
86 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, | 84 IPC_MESSAGE_HANDLER_DELAY_REPLY(GpuCommandBufferMsg_RegisterTransferBuffer, |
87 OnRegisterTransferBuffer); | 85 OnRegisterTransferBuffer); |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 } else { | 239 } else { |
242 OnInitializeFailed(reply_message); | 240 OnInitializeFailed(reply_message); |
243 return; | 241 return; |
244 } | 242 } |
245 } | 243 } |
246 | 244 |
247 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); | 245 GpuCommandBufferMsg_Initialize::WriteReplyParams(reply_message, true); |
248 Send(reply_message); | 246 Send(reply_message); |
249 } | 247 } |
250 | 248 |
251 void GpuCommandBufferStub::OnMapExternalResource( | |
252 gpu::resource_type::ResourceType resource_type, | |
253 uint32 resource_source_id, | |
254 int32 source_route_id, | |
255 uint32 resource_dest_id) { | |
256 GpuCommandBufferStub* source_stub = | |
257 channel_->LookupCommandBuffer(source_route_id); | |
258 | |
259 scheduler_->MapExternalResource( | |
260 resource_type, | |
261 resource_source_id, | |
262 source_stub ? source_stub->scheduler() : NULL, | |
263 resource_dest_id); | |
264 } | |
265 | |
266 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, | 249 void GpuCommandBufferStub::OnSetParent(int32 parent_route_id, |
267 uint32 parent_texture_id, | 250 uint32 parent_texture_id, |
268 IPC::Message* reply_message) { | 251 IPC::Message* reply_message) { |
269 | 252 |
270 GpuCommandBufferStub* parent_stub = NULL; | 253 GpuCommandBufferStub* parent_stub = NULL; |
271 if (parent_route_id != MSG_ROUTING_NONE) { | 254 if (parent_route_id != MSG_ROUTING_NONE) { |
272 parent_stub = channel_->LookupCommandBuffer(parent_route_id); | 255 parent_stub = channel_->LookupCommandBuffer(parent_route_id); |
273 } | 256 } |
274 | 257 |
275 bool result = true; | 258 bool result = true; |
(...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 new GpuVideoDecodeAccelerator(this, route_id_, this)); | 553 new GpuVideoDecodeAccelerator(this, route_id_, this)); |
571 video_decoder_->Initialize(configs, reply_message); | 554 video_decoder_->Initialize(configs, reply_message); |
572 } | 555 } |
573 | 556 |
574 void GpuCommandBufferStub::OnDestroyVideoDecoder() { | 557 void GpuCommandBufferStub::OnDestroyVideoDecoder() { |
575 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder"; | 558 LOG(ERROR) << "GpuCommandBufferStub::OnDestroyVideoDecoder"; |
576 video_decoder_.reset(); | 559 video_decoder_.reset(); |
577 } | 560 } |
578 | 561 |
579 #endif // defined(ENABLE_GPU) | 562 #endif // defined(ENABLE_GPU) |
OLD | NEW |