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 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" | 5 #include "ppapi/proxy/ppb_graphics_2d_proxy.h" |
6 | 6 |
7 #include <string.h> // For memset. | 7 #include <string.h> // For memset. |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 175 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
176 if (!dispatcher) | 176 if (!dispatcher) |
177 return 0; | 177 return 0; |
178 | 178 |
179 HostResource result; | 179 HostResource result; |
180 dispatcher->Send(new PpapiHostMsg_ResourceCreation_Graphics2D( | 180 dispatcher->Send(new PpapiHostMsg_ResourceCreation_Graphics2D( |
181 INTERFACE_ID_RESOURCE_CREATION, instance, size, is_always_opaque, | 181 INTERFACE_ID_RESOURCE_CREATION, instance, size, is_always_opaque, |
182 &result)); | 182 &result)); |
183 if (result.is_null()) | 183 if (result.is_null()) |
184 return 0; | 184 return 0; |
185 linked_ptr<Graphics2D> graphics_2d(new Graphics2D(result, size, | 185 return PluginResourceTracker::GetInstance()->AddResource( |
186 is_always_opaque)); | 186 new Graphics2D(result, size, is_always_opaque)); |
187 return PluginResourceTracker::GetInstance()->AddResource(graphics_2d); | |
188 } | 187 } |
189 | 188 |
190 bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { | 189 bool PPB_Graphics2D_Proxy::OnMessageReceived(const IPC::Message& msg) { |
191 bool handled = true; | 190 bool handled = true; |
192 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg) | 191 IPC_BEGIN_MESSAGE_MAP(PPB_Graphics2D_Proxy, msg) |
193 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_PaintImageData, | 192 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_PaintImageData, |
194 OnMsgPaintImageData) | 193 OnMsgPaintImageData) |
195 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Scroll, | 194 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_Scroll, |
196 OnMsgScroll) | 195 OnMsgScroll) |
197 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_ReplaceContents, | 196 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBGraphics2D_ReplaceContents, |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 | 256 |
258 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( | 257 void PPB_Graphics2D_Proxy::SendFlushACKToPlugin( |
259 int32_t result, | 258 int32_t result, |
260 const HostResource& graphics_2d) { | 259 const HostResource& graphics_2d) { |
261 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( | 260 dispatcher()->Send(new PpapiMsg_PPBGraphics2D_FlushACK( |
262 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); | 261 INTERFACE_ID_PPB_GRAPHICS_2D, graphics_2d, result)); |
263 } | 262 } |
264 | 263 |
265 } // namespace proxy | 264 } // namespace proxy |
266 } // namespace pp | 265 } // namespace pp |
OLD | NEW |