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

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

Issue 9403039: PPAPI: Really force-free NPObjects on Instance destruction. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 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/npobject_var.h ('k') | webkit/plugins/ppapi/ppapi_webplugin_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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 346
347 // NOTE: Any of these methods that calls into the plugin needs to take into 347 // NOTE: Any of these methods that calls into the plugin needs to take into
348 // account that the plugin may use Var to remove the <embed> from the DOM, which 348 // account that the plugin may use Var to remove the <embed> from the DOM, which
349 // will make the WebPluginImpl drop its reference, usually the last one. If a 349 // will make the WebPluginImpl drop its reference, usually the last one. If a
350 // method needs to access a member of the instance after the call has returned, 350 // method needs to access a member of the instance after the call has returned,
351 // then it needs to keep its own reference on the stack. 351 // then it needs to keep its own reference on the stack.
352 352
353 void PluginInstance::Delete() { 353 void PluginInstance::Delete() {
354 // Keep a reference on the stack. See NOTE above. 354 // Keep a reference on the stack. See NOTE above.
355 scoped_refptr<PluginInstance> ref(this); 355 scoped_refptr<PluginInstance> ref(this);
356 // Force the MessageChannel to release its "passthrough object" which should
357 // release our last reference to the "InstanceObject" and will probably
358 // destroy it. We want to do this prior to calling DidDestroy in case the
359 // destructor of the instance object tries to use the instance.
360 message_channel_->SetPassthroughObject(NULL);
356 instance_interface_->DidDestroy(pp_instance()); 361 instance_interface_->DidDestroy(pp_instance());
357 362
358 if (fullscreen_container_) { 363 if (fullscreen_container_) {
359 fullscreen_container_->Destroy(); 364 fullscreen_container_->Destroy();
360 fullscreen_container_ = NULL; 365 fullscreen_container_ = NULL;
361 } 366 }
362 container_ = NULL; 367 container_ = NULL;
363 } 368 }
364 369
365 void PluginInstance::Paint(WebCanvas* canvas, 370 void PluginInstance::Paint(WebCanvas* canvas,
(...skipping 1753 matching lines...) Expand 10 before | Expand all | Expand 10 after
2119 screen_size_for_fullscreen_ = gfx::Size(); 2124 screen_size_for_fullscreen_ = gfx::Size();
2120 WebElement element = container_->element(); 2125 WebElement element = container_->element();
2121 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2126 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2122 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2127 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2123 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2128 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2124 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2129 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2125 } 2130 }
2126 2131
2127 } // namespace ppapi 2132 } // namespace ppapi
2128 } // namespace webkit 2133 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/npobject_var.h ('k') | webkit/plugins/ppapi/ppapi_webplugin_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698