Title: [195909] trunk/Source/WebCore
Revision
195909
Author
[email protected]
Date
2016-01-30 13:39:00 -0800 (Sat, 30 Jan 2016)

Log Message

Unreviewed, rolling out r195871.

Caused several layout tests to time out

Reverted changeset:

"Tab suspension code shouldn't use page cache cacheability
logic"
https://bugs.webkit.org/show_bug.cgi?id=153680
http://trac.webkit.org/changeset/195871

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (195908 => 195909)


--- trunk/Source/WebCore/ChangeLog	2016-01-30 21:34:43 UTC (rev 195908)
+++ trunk/Source/WebCore/ChangeLog	2016-01-30 21:39:00 UTC (rev 195909)
@@ -1,5 +1,18 @@
 2016-01-30  Chris Dumez  <[email protected]>
 
+        Unreviewed, rolling out r195871.
+
+        Caused several layout tests to time out
+
+        Reverted changeset:
+
+        "Tab suspension code shouldn't use page cache cacheability
+        logic"
+        https://bugs.webkit.org/show_bug.cgi?id=153680
+        http://trac.webkit.org/changeset/195871
+
+2016-01-30  Chris Dumez  <[email protected]>
+
         Unreviewed, rebaseline bindings tests after r195904.
 
         * bindings/scripts/test/JS/JSTestCustomNamedGetter.cpp:

Modified: trunk/Source/WebCore/page/Page.cpp (195908 => 195909)


--- trunk/Source/WebCore/page/Page.cpp	2016-01-30 21:34:43 UTC (rev 195908)
+++ trunk/Source/WebCore/page/Page.cpp	2016-01-30 21:39:00 UTC (rev 195909)
@@ -1305,7 +1305,10 @@
 {
     chrome().client().setPageActivityState(activityState);
     
-    updateTabSuspensionState();
+    if (activityState == PageActivityState::NoFlags && !isVisible())
+        scheduleTabSuspension(true);
+    else
+        scheduleTabSuspension(false);
 }
 
 void Page::setIsVisible(bool isVisible)
@@ -1358,7 +1361,7 @@
             view->hide();
     }
 
-    updateTabSuspensionState();
+    scheduleTabSuspension(!isVisible);
 }
 
 void Page::setIsPrerender()
@@ -1864,29 +1867,17 @@
         return false;
     if (m_isPrerender)
         return false;
-    if (isVisible())
-        return false;
     if (m_pageThrottler.activityState() != PageActivityState::NoFlags)
         return false;
+    // FIXME: PageCache::canCache does a bunch of checks that are not needed for the tab suspension case. There should be a specific check.
+    if (!PageCache::singleton().canCache(*this))
+        return false;
 
-    for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
-        if (frame->loader().state() == FrameStateProvisional)
-            return false;
-        if (frame->loader().isLoading())
-            return false;
-        if (!frame->document() || !frame->document()->canSuspendActiveDOMObjectsForDocumentSuspension(nullptr))
-            return false;
-    }
-
     return true;
 }
 
 void Page::setIsTabSuspended(bool shouldSuspend)
 {
-    if (m_isTabSuspended == shouldSuspend)
-        return;
-    m_isTabSuspended = shouldSuspend;
-
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
         if (auto* document = frame->document()) {
             if (shouldSuspend)
@@ -1902,19 +1893,26 @@
     s_tabSuspensionIsEnabled = enable;
 }
 
-void Page::updateTabSuspensionState()
+void Page::scheduleTabSuspension(bool shouldSuspend)
 {
-    if (canTabSuspend()) {
-        m_tabSuspensionTimer.startOneShot(0);
+    if (m_shouldTabSuspend == shouldSuspend)
         return;
+    
+    if (shouldSuspend && canTabSuspend()) {
+        m_shouldTabSuspend = shouldSuspend;
+        m_tabSuspensionTimer.startOneShot(0);
+    } else {
+        m_tabSuspensionTimer.stop();
+        if (!shouldSuspend) {
+            m_shouldTabSuspend = shouldSuspend;
+            setIsTabSuspended(false);
+        }
     }
-    m_tabSuspensionTimer.stop();
-    setIsTabSuspended(false);
 }
 
 void Page::tabSuspensionTimerFired()
 {
-    setIsTabSuspended(canTabSuspend());
+    setIsTabSuspended(true);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/page/Page.h (195908 => 195909)


--- trunk/Source/WebCore/page/Page.h	2016-01-30 21:34:43 UTC (rev 195908)
+++ trunk/Source/WebCore/page/Page.h	2016-01-30 21:39:00 UTC (rev 195909)
@@ -521,7 +521,7 @@
     void hiddenPageDOMTimerThrottlingStateChanged();
     void setTimerThrottlingEnabled(bool);
     bool canTabSuspend();
-    void updateTabSuspensionState();
+    void scheduleTabSuspension(bool);
     void tabSuspensionTimerFired();
 
     const std::unique_ptr<Chrome> m_chrome;
@@ -663,7 +663,7 @@
     SessionID m_sessionID;
 
     bool m_isClosing;
-    bool m_isTabSuspended { false };
+    bool m_shouldTabSuspend { false };
     Timer m_tabSuspensionTimer;
 
     MediaProducer::MediaStateFlags m_mediaState { MediaProducer::IsNotPlaying };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to