OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/pepper/pepper_graphics_2d_host.h" | 5 #include "content/renderer/pepper/pepper_graphics_2d_host.h" |
6 | 6 |
7 #include "content/public/renderer/renderer_ppapi_host.h" | 7 #include "content/public/renderer/renderer_ppapi_host.h" |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/host/dispatch_host_message.h" | 9 #include "ppapi/host/dispatch_host_message.h" |
10 #include "ppapi/host/host_message_context.h" | 10 #include "ppapi/host/host_message_context.h" |
(...skipping 24 matching lines...) Expand all Loading... | |
35 | 35 |
36 PepperGraphics2DHost::PepperGraphics2DHost(RendererPpapiHost* host, | 36 PepperGraphics2DHost::PepperGraphics2DHost(RendererPpapiHost* host, |
37 PP_Instance instance, | 37 PP_Instance instance, |
38 PP_Resource resource) | 38 PP_Resource resource) |
39 : ResourceHost(host->GetPpapiHost(), instance, resource), | 39 : ResourceHost(host->GetPpapiHost(), instance, resource), |
40 graphics_2d_(new webkit::ppapi::PPB_Graphics2D_Impl(instance)), | 40 graphics_2d_(new webkit::ppapi::PPB_Graphics2D_Impl(instance)), |
41 is_running_in_process_(host->IsRunningInProcess()) { | 41 is_running_in_process_(host->IsRunningInProcess()) { |
42 } | 42 } |
43 | 43 |
44 PepperGraphics2DHost::~PepperGraphics2DHost() { | 44 PepperGraphics2DHost::~PepperGraphics2DHost() { |
45 // Unbind from the instance when destoryed. | 45 // Unbind from the instance when destoryed if we're still bound. |
bbudge
2012/12/14 00:24:26
sp destroyed
| |
46 PP_Instance instance = graphics_2d_->pp_instance(); | 46 webkit::ppapi::PluginInstance* bound_instance = |
47 ppapi::thunk::EnterInstanceNoLock enter(instance); | 47 graphics_2d_->bound_instance(); |
48 if (enter.succeeded()) | 48 if (bound_instance) |
49 enter.functions()->BindGraphics(instance, 0); | 49 bound_instance->BindGraphics(bound_instance->pp_instance(), 0); |
50 } | 50 } |
51 | 51 |
52 int32_t PepperGraphics2DHost::OnResourceMessageReceived( | 52 int32_t PepperGraphics2DHost::OnResourceMessageReceived( |
53 const IPC::Message& msg, | 53 const IPC::Message& msg, |
54 ppapi::host::HostMessageContext* context) { | 54 ppapi::host::HostMessageContext* context) { |
55 IPC_BEGIN_MESSAGE_MAP(PepperGraphics2DHost, msg) | 55 IPC_BEGIN_MESSAGE_MAP(PepperGraphics2DHost, msg) |
56 #if !defined(OS_NACL) | 56 #if !defined(OS_NACL) |
57 PPAPI_DISPATCH_HOST_RESOURCE_CALL( | 57 PPAPI_DISPATCH_HOST_RESOURCE_CALL( |
58 PpapiHostMsg_Graphics2D_PaintImageData, | 58 PpapiHostMsg_Graphics2D_PaintImageData, |
59 OnHostMsgPaintImageData) | 59 OnHostMsgPaintImageData) |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
204 int32_t pp_error) { | 204 int32_t pp_error) { |
205 if (!data || pp_error != PP_OK) | 205 if (!data || pp_error != PP_OK) |
206 return; | 206 return; |
207 PepperGraphics2DHost* self = (PepperGraphics2DHost*) data; | 207 PepperGraphics2DHost* self = (PepperGraphics2DHost*) data; |
208 self->host()->SendReply(self->flush_reply_context_, | 208 self->host()->SendReply(self->flush_reply_context_, |
209 PpapiPluginMsg_Graphics2D_FlushAck()); | 209 PpapiPluginMsg_Graphics2D_FlushAck()); |
210 } | 210 } |
211 #endif // !defined(OS_NACL) | 211 #endif // !defined(OS_NACL) |
212 | 212 |
213 } // namespace content | 213 } // namespace content |
OLD | NEW |