summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-10 04:43:26 +0000
committerananta@chromium.org <ananta@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-06-10 04:43:26 +0000
commitea478a8069dec20dcbc3a8ae814386a0b444c1cb (patch)
tree9a482191c76c78be1bb888b52f985241dbf57459
parent86cc946579368078a3882ec3a73c5b0ab27091b4 (diff)
downloadchromium_src-ea478a8069dec20dcbc3a8ae814386a0b444c1cb.zip
chromium_src-ea478a8069dec20dcbc3a8ae814386a0b444c1cb.tar.gz
chromium_src-ea478a8069dec20dcbc3a8ae814386a0b444c1cb.tar.bz2
For lack of a better approach we now initiate the plugin src url download in a delayed task as the Flash plugin hangs if it starts receiving data before receiving valid plugin geometry.
This fixes bug http://code.google.com/p/chromium/issues/detail?id=12993 Bug=12993 TEST=Navigate to google.com/finance and open the tickers in background tabs. They should not cause the browser to hang. Review URL: http://codereview.chromium.org/118452 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18033 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--webkit/glue/webplugin_impl.cc21
-rw-r--r--webkit/glue/webplugin_impl.h5
2 files changed, 22 insertions, 4 deletions
diff --git a/webkit/glue/webplugin_impl.cc b/webkit/glue/webplugin_impl.cc
index 0134c9a..9a8a09a 100644
--- a/webkit/glue/webplugin_impl.cc
+++ b/webkit/glue/webplugin_impl.cc
@@ -378,7 +378,8 @@ WebPluginImpl::WebPluginImpl(WebCore::HTMLPlugInElement* element,
plugin_url_(plugin_url),
load_manually_(load_manually),
first_geometry_update_(true),
- mime_type_(mime_type) {
+ mime_type_(mime_type),
+ ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)) {
ArrayToVector(arg_count, arg_names, &arg_names_);
ArrayToVector(arg_count, arg_values, &arg_values_);
@@ -733,13 +734,25 @@ void WebPluginImpl::setFrameRect(const WebCore::IntRect& rect) {
first_geometry_update_ = false;
// An empty url corresponds to an EMBED tag with no src attribute.
if (!load_manually_ && plugin_url_.is_valid()) {
- HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false,
- plugin_url_.spec().c_str(), NULL, false,
- false);
+ // The Flash plugin hangs for a while if it receives data before
+ // receiving valid plugin geometry. By valid geometry we mean the
+ // geometry received by a call to setFrameRect in the Webkit
+ // layout code path. To workaround this issue we download the
+ // plugin source url on a timer.
+ MessageLoop::current()->PostDelayedTask(FROM_HERE,
+ method_factory_.NewRunnableMethod(
+ &WebPluginImpl::OnDownloadPluginSrcUrl),
+ 0);
}
}
}
+void WebPluginImpl::OnDownloadPluginSrcUrl() {
+ HandleURLRequestInternal("GET", false, NULL, 0, NULL, false, false,
+ plugin_url_.spec().c_str(), NULL, false,
+ false);
+}
+
void WebPluginImpl::paint(WebCore::GraphicsContext* gc,
const WebCore::IntRect& damage_rect) {
if (gc->paintingDisabled())
diff --git a/webkit/glue/webplugin_impl.h b/webkit/glue/webplugin_impl.h
index 1127a73..ab7ea8f 100644
--- a/webkit/glue/webplugin_impl.h
+++ b/webkit/glue/webplugin_impl.h
@@ -320,6 +320,9 @@ class WebPluginImpl : public WebPlugin,
static void ArrayToVector(int total_values, char** values,
std::vector<std::string>* value_vector);
+ // Delayed task for downloading the plugin source URL.
+ void OnDownloadPluginSrcUrl();
+
struct ClientInfo {
int id;
WebPluginResourceClient* client;
@@ -363,6 +366,8 @@ class WebPluginImpl : public WebPlugin,
// Holds the list of argument values passed to the plugin.
std::vector<std::string> arg_values_;
+ ScopedRunnableMethodFactory<WebPluginImpl> method_factory_;
+
DISALLOW_COPY_AND_ASSIGN(WebPluginImpl);
};