OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/scoped_open_process.h" | 6 #include "base/scoped_open_process.h" |
7 #include "base/shared_memory.h" | 7 #include "base/shared_memory.h" |
8 #include "chrome/common/gpu_messages.h" | 8 #include "chrome/common/gpu_messages.h" |
9 #include "chrome/common/plugin_messages.h" | 9 #include "chrome/common/plugin_messages.h" |
10 #include "chrome/plugin/command_buffer_stub.h" | 10 #include "chrome/plugin/command_buffer_stub.h" |
11 #include "chrome/plugin/plugin_channel.h" | 11 #include "chrome/plugin/plugin_channel.h" |
12 | 12 |
13 using gpu::Buffer; | 13 using gpu::Buffer; |
14 | 14 |
15 CommandBufferStub::CommandBufferStub(PluginChannel* channel, | 15 CommandBufferStub::CommandBufferStub(PluginChannel* channel, |
16 int plugin_host_route_id, | 16 int plugin_host_route_id, |
17 gfx::PluginWindowHandle window) | 17 gfx::PluginWindowHandle window) |
18 : channel_(channel), | 18 : channel_(channel), |
19 plugin_host_route_id_(plugin_host_route_id), | 19 plugin_host_route_id_(plugin_host_route_id), |
20 window_(window) { | 20 window_(window) { |
21 route_id_ = channel->GenerateRouteID(); | 21 route_id_ = channel->GenerateRouteID(); |
22 channel->AddRoute(route_id_, this, NULL); | 22 channel->AddRoute(route_id_, this, NULL); |
23 } | 23 } |
24 | 24 |
25 CommandBufferStub::~CommandBufferStub() { | 25 CommandBufferStub::~CommandBufferStub() { |
26 Destroy(); | 26 Destroy(); |
27 channel_->RemoveRoute(route_id_); | 27 channel_->RemoveRoute(route_id_); |
28 } | 28 } |
29 | 29 |
30 void CommandBufferStub::OnMessageReceived(const IPC::Message& message) { | 30 bool CommandBufferStub::OnMessageReceived(const IPC::Message& message) { |
| 31 bool handled = true; |
31 IPC_BEGIN_MESSAGE_MAP(CommandBufferStub, message) | 32 IPC_BEGIN_MESSAGE_MAP(CommandBufferStub, message) |
32 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); | 33 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Initialize, OnInitialize); |
33 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); | 34 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetState, OnGetState); |
34 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState); | 35 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncGetState, OnAsyncGetState); |
35 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush); | 36 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_Flush, OnFlush); |
36 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); | 37 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_AsyncFlush, OnAsyncFlush); |
37 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateTransferBuffer, | 38 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_CreateTransferBuffer, |
38 OnCreateTransferBuffer); | 39 OnCreateTransferBuffer); |
39 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, | 40 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_DestroyTransferBuffer, |
40 OnDestroyTransferBuffer); | 41 OnDestroyTransferBuffer); |
41 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetTransferBuffer, | 42 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_GetTransferBuffer, |
42 OnGetTransferBuffer); | 43 OnGetTransferBuffer); |
43 #if defined(OS_MACOSX) | 44 #if defined(OS_MACOSX) |
44 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); | 45 IPC_MESSAGE_HANDLER(GpuCommandBufferMsg_SetWindowSize, OnSetWindowSize); |
45 #endif | 46 #endif |
46 IPC_MESSAGE_UNHANDLED_ERROR() | 47 IPC_MESSAGE_UNHANDLED(handled = false) |
47 IPC_END_MESSAGE_MAP() | 48 IPC_END_MESSAGE_MAP() |
| 49 DCHECK(handled); |
| 50 return handled; |
48 } | 51 } |
49 | 52 |
50 void CommandBufferStub::OnChannelError() { | 53 void CommandBufferStub::OnChannelError() { |
51 NOTREACHED() << "CommandBufferService::OnChannelError called"; | 54 NOTREACHED() << "CommandBufferService::OnChannelError called"; |
52 } | 55 } |
53 | 56 |
54 bool CommandBufferStub::Send(IPC::Message* message) { | 57 bool CommandBufferStub::Send(IPC::Message* message) { |
55 if (!channel_) { | 58 if (!channel_) { |
56 delete message; | 59 delete message; |
57 return false; | 60 return false; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 Send(new PluginHostMsg_AllocTransportDIB(plugin_host_route_id_, | 238 Send(new PluginHostMsg_AllocTransportDIB(plugin_host_route_id_, |
236 size, | 239 size, |
237 dib_handle)); | 240 dib_handle)); |
238 } | 241 } |
239 | 242 |
240 void CommandBufferStub::FreeTransportDIB(TransportDIB::Id dib_id) { | 243 void CommandBufferStub::FreeTransportDIB(TransportDIB::Id dib_id) { |
241 Send(new PluginHostMsg_FreeTransportDIB(plugin_host_route_id_, | 244 Send(new PluginHostMsg_FreeTransportDIB(plugin_host_route_id_, |
242 dib_id)); | 245 dib_id)); |
243 } | 246 } |
244 #endif | 247 #endif |
OLD | NEW |