diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-04 17:47:17 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-04-04 17:47:17 +0000 |
commit | 55801ac3a9d6ea284fa27350ffa59e39197f3aca (patch) | |
tree | 7c4a8fdc68117f4fe77153846be44f1bc164d84d /webkit/plugins | |
parent | 2f0c9bd240b4ae5b76b60c7b8d5570e8ff4f3044 (diff) | |
download | chromium_src-55801ac3a9d6ea284fa27350ffa59e39197f3aca.zip chromium_src-55801ac3a9d6ea284fa27350ffa59e39197f3aca.tar.gz chromium_src-55801ac3a9d6ea284fa27350ffa59e39197f3aca.tar.bz2 |
Remove assertion when destroying a plugin that doesn't exist. The DidDestroy
function will always be called, so the proxy should always add it regardless
of the initialization status.
I also did some clarification of the Destroy path.
BUG=78112
Review URL: http://codereview.chromium.org/6706025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80336 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/plugins')
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.cc | 24 | ||||
-rw-r--r-- | webkit/plugins/ppapi/ppapi_plugin_instance.h | 9 |
2 files changed, 20 insertions, 13 deletions
diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.cc b/webkit/plugins/ppapi/ppapi_plugin_instance.cc index 8e5f6fc..dda0165 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.cc +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.cc @@ -418,6 +418,18 @@ const PPB_Zoom_Dev* PluginInstance::GetZoomInterface() { // method needs to access a member of the instance after the call has returned, // then it needs to keep its own reference on the stack. +void PluginInstance::Delete() { + // Keep a reference on the stack. See NOTE above. + scoped_refptr<PluginInstance> ref(this); + instance_interface_->DidDestroy(pp_instance()); + + if (fullscreen_container_) { + fullscreen_container_->Destroy(); + fullscreen_container_ = NULL; + } + container_ = NULL; +} + void PluginInstance::Paint(WebCanvas* canvas, const gfx::Rect& plugin_rect, const gfx::Rect& paint_rect) { @@ -672,18 +684,6 @@ void PluginInstance::PostMessage(PP_Var message) { message_channel_->PostMessageToJavaScript(message); } -void PluginInstance::Delete() { - // Keep a reference on the stack. See NOTE above. - scoped_refptr<PluginInstance> ref(this); - instance_interface_->DidDestroy(pp_instance()); - - if (fullscreen_container_) { - fullscreen_container_->Destroy(); - fullscreen_container_ = NULL; - } - container_ = NULL; -} - bool PluginInstance::Initialize(WebPluginContainer* container, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, diff --git a/webkit/plugins/ppapi/ppapi_plugin_instance.h b/webkit/plugins/ppapi/ppapi_plugin_instance.h index bb19d31..837a179 100644 --- a/webkit/plugins/ppapi/ppapi_plugin_instance.h +++ b/webkit/plugins/ppapi/ppapi_plugin_instance.h @@ -77,6 +77,8 @@ class PluginInstance : public base::RefCounted<PluginInstance> { PluginInstance(PluginDelegate* delegate, PluginModule* module, const PPP_Instance* instance_interface); + + // Delete should be called by the WebPlugin before this destructor. ~PluginInstance(); static const PPB_Instance* GetInterface(); @@ -105,6 +107,12 @@ class PluginInstance : public base::RefCounted<PluginInstance> { // nonzero. PP_Instance pp_instance() const { return pp_instance_; } + // Does some pre-destructor cleanup on the instance. This is necessary + // because some cleanup depends on the plugin instance still existing (like + // calling the plugin's DidDestroy function). This function is called from + // the WebPlugin implementation when WebKit is about to remove the plugin. + void Delete(); + // Paints the current backing store to the web page. void Paint(WebKit::WebCanvas* canvas, const gfx::Rect& plugin_rect, @@ -146,7 +154,6 @@ class PluginInstance : public base::RefCounted<PluginInstance> { PP_Var ExecuteScript(PP_Var script, PP_Var* exception); // PPP_Instance pass-through. - void Delete(); bool Initialize(WebKit::WebPluginContainer* container, const std::vector<std::string>& arg_names, const std::vector<std::string>& arg_values, |