Title: [145644] trunk/Source/WebKit2
Revision
145644
Author
[email protected]
Date
2013-03-12 17:56:32 -0700 (Tue, 12 Mar 2013)

Log Message

Primary plugin hit detection needs to run after plugin creation
https://bugs.webkit.org/show_bug.cgi?id=112206

Reviewed by Tim Horton.

On some pages, the plugins are created after the page has loaded, and
thus our heuristic to determine the primary plugin fails. Run this
heuristic more often: after each PluginView is created. It already exits
early if it has found a primary. But we also need to make sure that it
doesn't run before load.

* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::addPluginView): Run detection when view is added.
(WebKit::WebPage::didFinishLoad): Remember that we have loaded.
(WebKit::WebPage::determinePrimarySnapshottedPlugIn): Look at the PluginViews to see if we have a plugin.
(WebKit::WebPage::resetPrimarySnapshottedPlugIn): Reset both flags.
* WebProcess/WebPage/WebPage.h:
(WebPage): New member variable, m_readyToFindPrimarySnapshottedPlugin.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (145643 => 145644)


--- trunk/Source/WebKit2/ChangeLog	2013-03-13 00:53:53 UTC (rev 145643)
+++ trunk/Source/WebKit2/ChangeLog	2013-03-13 00:56:32 UTC (rev 145644)
@@ -1,3 +1,24 @@
+2013-03-12  Dean Jackson  <[email protected]>
+
+        Primary plugin hit detection needs to run after plugin creation
+        https://bugs.webkit.org/show_bug.cgi?id=112206
+
+        Reviewed by Tim Horton.
+
+        On some pages, the plugins are created after the page has loaded, and
+        thus our heuristic to determine the primary plugin fails. Run this
+        heuristic more often: after each PluginView is created. It already exits
+        early if it has found a primary. But we also need to make sure that it
+        doesn't run before load.
+
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::addPluginView): Run detection when view is added.
+        (WebKit::WebPage::didFinishLoad): Remember that we have loaded.
+        (WebKit::WebPage::determinePrimarySnapshottedPlugIn): Look at the PluginViews to see if we have a plugin.
+        (WebKit::WebPage::resetPrimarySnapshottedPlugIn): Reset both flags.
+        * WebProcess/WebPage/WebPage.h:
+        (WebPage): New member variable, m_readyToFindPrimarySnapshottedPlugin.
+
 2013-03-12  Beth Dakin  <[email protected]>
 
         WKView -printOperationWithPrintInfo:forFrame: doesn’t use the print info that is 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (145643 => 145644)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-13 00:53:53 UTC (rev 145643)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp	2013-03-13 00:56:32 UTC (rev 145644)
@@ -237,6 +237,7 @@
     , m_scrollingPerformanceLoggingEnabled(false)
     , m_mainFrameIsScrollable(true)
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
+    , m_readyToFindPrimarySnapshottedPlugin(false)
     , m_didFindPrimarySnapshottedPlugin(false)
 #endif
 #if PLATFORM(MAC)
@@ -2897,6 +2898,9 @@
     ASSERT(!m_pluginViews.contains(pluginView));
 
     m_pluginViews.add(pluginView);
+#if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
+    determinePrimarySnapshottedPlugIn();
+#endif
 }
 
 void WebPage::removePluginView(PluginView* pluginView)
@@ -3860,6 +3864,7 @@
 void WebPage::didFinishLoad(WebFrame* frame)
 {
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
+    m_readyToFindPrimarySnapshottedPlugin = true;
     determinePrimarySnapshottedPlugIn();
 #endif
 }
@@ -3873,9 +3878,12 @@
 
 void WebPage::determinePrimarySnapshottedPlugIn()
 {
-    if (!corePage()->hasSeenAnyPlugin())
+    if (!m_readyToFindPrimarySnapshottedPlugin)
         return;
 
+    if (m_pluginViews.isEmpty())
+        return;
+
     if (m_didFindPrimarySnapshottedPlugin)
         return;
 
@@ -3943,6 +3951,7 @@
 
 void WebPage::resetPrimarySnapshottedPlugIn()
 {
+    m_readyToFindPrimarySnapshottedPlugin = false;
     m_didFindPrimarySnapshottedPlugin = false;
 }
 #endif // ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (145643 => 145644)


--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-03-13 00:53:53 UTC (rev 145643)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h	2013-03-13 00:56:32 UTC (rev 145644)
@@ -856,6 +856,7 @@
     bool m_mainFrameIsScrollable;
 
 #if ENABLE(PRIMARY_SNAPSHOTTED_PLUGIN_HEURISTIC)
+    bool m_readyToFindPrimarySnapshottedPlugin;
     bool m_didFindPrimarySnapshottedPlugin;
 #endif
 
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to