diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-10 23:32:47 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-10 23:32:47 +0000 |
commit | 66c7dc77fc7d5ea4075bfaaaa2b7805f323829e9 (patch) | |
tree | d856977d7debd354c493a8a42d24525016e8cc62 /webkit | |
parent | 423df4c237150165c9f0c61136c119f35a0c434f (diff) | |
download | chromium_src-66c7dc77fc7d5ea4075bfaaaa2b7805f323829e9.zip chromium_src-66c7dc77fc7d5ea4075bfaaaa2b7805f323829e9.tar.gz chromium_src-66c7dc77fc7d5ea4075bfaaaa2b7805f323829e9.tar.bz2 |
1) Roll WebKit DEPS to 45685
This roll picks up changes to WebCore::Widget which make that a RefCounted class.
2) Mods to plugin handling in our "glue" needed to recover from the above
Review URL: http://codereview.chromium.org/149443
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.cc | 17 | ||||
-rw-r--r-- | webkit/glue/webframeloaderclient_impl.h | 8 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.cc | 6 | ||||
-rw-r--r-- | webkit/glue/webplugin_impl.h | 5 |
4 files changed, 20 insertions, 16 deletions
diff --git a/webkit/glue/webframeloaderclient_impl.cc b/webkit/glue/webframeloaderclient_impl.cc index fcdb6a0..b173fbe 100644 --- a/webkit/glue/webframeloaderclient_impl.cc +++ b/webkit/glue/webframeloaderclient_impl.cc @@ -94,7 +94,6 @@ WebFrameLoaderClient::WebFrameLoaderClient(WebFrameImpl* frame) : webframe_(frame), postpone_loading_data_(false), has_representation_(false), - plugin_widget_(NULL), sent_initial_response_to_plugin_(false), next_window_open_disposition_(IGNORE_ACTION) { } @@ -991,7 +990,7 @@ void WebFrameLoaderClient::revertToProvisionalState(DocumentLoader*) { void WebFrameLoaderClient::setMainDocumentError(DocumentLoader*, const ResourceError& error) { - if (plugin_widget_) { + if (plugin_widget_.get()) { if (sent_initial_response_to_plugin_) { plugin_widget_->didFail(error); sent_initial_response_to_plugin_ = false; @@ -1057,7 +1056,7 @@ void WebFrameLoaderClient::didChangeTitle(DocumentLoader*) { // Called whenever data is received. void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* data, int length) { - if (!plugin_widget_) { + if (!plugin_widget_.get()) { if (postpone_loading_data_) { postponed_data_.append(data, length); if (postponed_data_.length() >= 512) { @@ -1072,7 +1071,7 @@ void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat // The plugin widget could have been created in the webframe_->DidReceiveData // function. - if (plugin_widget_) { + if (plugin_widget_.get()) { if (!sent_initial_response_to_plugin_) { sent_initial_response_to_plugin_ = true; plugin_widget_->didReceiveResponse( @@ -1083,7 +1082,7 @@ void WebFrameLoaderClient::committedLoad(DocumentLoader* loader, const char* dat } void WebFrameLoaderClient::finishedLoading(DocumentLoader* dl) { - if (plugin_widget_) { + if (plugin_widget_.get()) { plugin_widget_->didFinishLoading(); plugin_widget_ = NULL; sent_initial_response_to_plugin_ = false; @@ -1324,7 +1323,7 @@ static void DeleteToArray(char** arr) { delete [] arr; } -Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay): how do we use this? +PassRefPtr<Widget> WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay): how do we use this? HTMLPlugInElement* element, const KURL&url, const Vector<String>& param_names, @@ -1401,7 +1400,7 @@ Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay) char **argn = ToArray(param_names); char **argv = ToArray(param_values); int argc = static_cast<int>(param_names.size()); - Widget* result = WebPluginImpl::Create(gurl, argn, argv, argc, element, + RefPtr<Widget> result = WebPluginImpl::Create(gurl, argn, argv, argc, element, webframe_, plugin_delegate, load_manually, my_mime_type); @@ -1415,10 +1414,10 @@ Widget* WebFrameLoaderClient::createPlugin(const IntSize& size, // TODO(erikkay) // (e.g., acrobat reader). void WebFrameLoaderClient::redirectDataToPlugin(Widget* pluginWidget) { plugin_widget_ = static_cast<WebPluginContainer*>(pluginWidget); - DCHECK(plugin_widget_ != NULL); + DCHECK(plugin_widget_.get()); } -Widget* WebFrameLoaderClient::createJavaAppletWidget( +PassRefPtr<Widget> WebFrameLoaderClient::createJavaAppletWidget( const IntSize& size, HTMLAppletElement* element, const KURL& /* base_url */, diff --git a/webkit/glue/webframeloaderclient_impl.h b/webkit/glue/webframeloaderclient_impl.h index 01b6db4..98118dd 100644 --- a/webkit/glue/webframeloaderclient_impl.h +++ b/webkit/glue/webframeloaderclient_impl.h @@ -9,6 +9,7 @@ MSVC_PUSH_WARNING_LEVEL(0); #include "FrameLoaderClient.h" +#include <wtf/RefPtr.h> MSVC_POP_WARNING(); #include "build/build_config.h" @@ -177,7 +178,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { const WebCore::String& referrer, bool allowsScrolling, int marginWidth, int marginHeight); - virtual WebCore::Widget* createPlugin(const WebCore::IntSize&, + virtual PassRefPtr<WebCore::Widget> createPlugin(const WebCore::IntSize&, WebCore::HTMLPlugInElement*, const WebCore::KURL&, const WTF::Vector<WebCore::String>&, @@ -186,7 +187,7 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { bool loadManually); virtual void redirectDataToPlugin(WebCore::Widget* pluginWidget); - virtual WebCore::Widget* createJavaAppletWidget( + virtual PassRefPtr<WebCore::Widget> createJavaAppletWidget( const WebCore::IntSize&, WebCore::HTMLAppletElement*, const WebCore::KURL& /* base_url */, @@ -251,7 +252,8 @@ class WebFrameLoaderClient : public WebCore::FrameLoaderClient { GURL expected_client_redirect_dest_; // Contains a pointer to the plugin widget. - WebPluginContainer* plugin_widget_; + WTF::RefPtr<WebPluginContainer> plugin_widget_; + // Indicates if we need to send over the initial notification to the plugin // which specifies that the plugin should be ready to accept data. bool sent_initial_response_to_plugin_; diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc index 157ecf3..83ee2bc 100644 --- a/webkit/glue/webplugin_impl.cc +++ b/webkit/glue/webplugin_impl.cc @@ -335,7 +335,7 @@ void WebPluginContainer::ReadHttpResponseInfo( } } -WebCore::Widget* WebPluginImpl::Create(const GURL& url, +PassRefPtr<WebCore::Widget> WebPluginImpl::Create(const GURL& url, char** argn, char** argv, int argc, @@ -357,7 +357,7 @@ WebCore::Widget* WebPluginImpl::Create(const GURL& url, WebPluginContainer* container = new WebPluginContainer(webplugin); webplugin->SetContainer(container); - return container; + return adoptRef(container); } WebPluginImpl::WebPluginImpl(WebCore::HTMLPlugInElement* element, @@ -1380,7 +1380,7 @@ void WebPluginImpl::TearDownPluginInstance( // plugin. Tell the frame we're gone so that it can invalidate all // of those sub JSObjects. if (frame()) { - ASSERT(widget_ != NULL); + ASSERT(widget_); frame()->script()->cleanupScriptObjectsForPlugin(widget_); } diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h index b81e8a9..eb8ada0 100644 --- a/webkit/glue/webplugin_impl.h +++ b/webkit/glue/webplugin_impl.h @@ -121,7 +121,7 @@ class WebPluginImpl : public WebPlugin, // Creates a WebPlugin instance, as long as the delegate's initialization // succeeds. If it fails, the delegate is deleted and NULL is returned. // Note that argn and argv are UTF8. - static WebCore::Widget* Create(const GURL& url, + static PassRefPtr<WebCore::Widget> Create(const GURL& url, char** argn, char** argv, int argc, @@ -342,6 +342,9 @@ class WebPluginImpl : public WebPlugin, WebPluginDelegate* delegate_; + // Don't use RefPtr here since doing so extends the lifetime of a plugin + // beyond the frame which causes crashes and videos playing after navigating + // away etc. WebPluginContainer* widget_; typedef std::map<WebPluginResourceClient*, |