Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(263)

Side by Side Diff: content/renderer/pepper/pepper_graphics_2d_host.cc

Issue 11571016: Only unbind a Graphics2D on destruction when we're actually bound. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/plugins/ppapi/ppb_graphics_2d_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 destroyed if we're still bound.
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
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
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/ppapi/ppb_graphics_2d_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698