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

Side by Side Diff: webkit/plugins/ppapi/ppapi_webplugin_impl.cc

Issue 6731051: Fix up some reference counting when WebPluginImpl::scriptableObject is called. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months 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 | « webkit/plugins/ppapi/plugin_object.cc ('k') | no next file » | 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) 2010 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 "webkit/plugins/ppapi/ppapi_webplugin_impl.h" 5 #include "webkit/plugins/ppapi/ppapi_webplugin_impl.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "ppapi/c/pp_var.h" 10 #include "ppapi/c/pp_var.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebBindings.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPluginParams.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPoint.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
15 #include "webkit/plugins/ppapi/message_channel.h" 16 #include "webkit/plugins/ppapi/message_channel.h"
16 #include "webkit/plugins/ppapi/plugin_module.h" 17 #include "webkit/plugins/ppapi/plugin_module.h"
17 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" 18 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
18 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h" 19 #include "webkit/plugins/ppapi/ppb_url_loader_impl.h"
19 #include "webkit/plugins/ppapi/var.h" 20 #include "webkit/plugins/ppapi/var.h"
20 21
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 88
88 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 89 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
89 } 90 }
90 91
91 NPObject* WebPluginImpl::scriptableObject() { 92 NPObject* WebPluginImpl::scriptableObject() {
92 scoped_refptr<ObjectVar> object( 93 scoped_refptr<ObjectVar> object(
93 ObjectVar::FromPPVar(instance_->GetInstanceObject())); 94 ObjectVar::FromPPVar(instance_->GetInstanceObject()));
94 // If there's an InstanceObject, tell the Instance's MessageChannel to pass 95 // If there's an InstanceObject, tell the Instance's MessageChannel to pass
95 // any non-postMessage calls to it. 96 // any non-postMessage calls to it.
96 if (object) { 97 if (object) {
97 instance_->message_channel().set_passthrough_object( 98 instance_->message_channel().SetPassthroughObject(object->np_object());
98 object->np_object());
99 } 99 }
100 // And return the instance's MessageChannel. 100 NPObject* message_channel_np_object(instance_->message_channel().np_object());
101 return instance_->message_channel().np_object(); 101 // The object is expected to be retained before it is returned.
102 WebKit::WebBindings::retainObject(message_channel_np_object);
103 return message_channel_np_object;
102 } 104 }
103 105
104 void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) { 106 void WebPluginImpl::paint(WebCanvas* canvas, const WebRect& rect) {
105 if (!instance_->IsFullscreenOrPending()) 107 if (!instance_->IsFullscreenOrPending())
106 instance_->Paint(canvas, plugin_rect_, rect); 108 instance_->Paint(canvas, plugin_rect_, rect);
107 } 109 }
108 110
109 void WebPluginImpl::updateGeometry( 111 void WebPluginImpl::updateGeometry(
110 const WebRect& window_rect, 112 const WebRect& window_rect,
111 const WebRect& clip_rect, 113 const WebRect& clip_rect,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 return instance_->PrintPage(page_number, canvas); 224 return instance_->PrintPage(page_number, canvas);
223 } 225 }
224 226
225 void WebPluginImpl::printEnd() { 227 void WebPluginImpl::printEnd() {
226 return instance_->PrintEnd(); 228 return instance_->PrintEnd();
227 } 229 }
228 230
229 } // namespace ppapi 231 } // namespace ppapi
230 } // namespace webkit 232 } // namespace webkit
231 233
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/plugin_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698