Title: [167525] trunk/Source/WebKit2
Revision
167525
Author
[email protected]
Date
2014-04-18 18:38:31 -0700 (Fri, 18 Apr 2014)

Log Message

Keep the WebPageProxy alive for the lifetime of all PageLoadState::Transaction objects
https://bugs.webkit.org/show_bug.cgi?id=131872
<rdar://problem/15758414>

Reviewed by Dan Bernstein.

* UIProcess/PageLoadState.cpp:
(WebKit::PageLoadState::PageLoadState):
(WebKit::PageLoadState::Transaction::Transaction):
(WebKit::PageLoadState::Transaction::~Transaction):
* UIProcess/PageLoadState.h:
(WebKit::PageLoadState::Transaction::Transaction): Deleted.
(WebKit::PageLoadState::Transaction::~Transaction): Deleted.
* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::WebPageProxy):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (167524 => 167525)


--- trunk/Source/WebKit2/ChangeLog	2014-04-19 00:49:07 UTC (rev 167524)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-19 01:38:31 UTC (rev 167525)
@@ -1,3 +1,21 @@
+2014-04-18  Anders Carlsson  <[email protected]>
+
+        Keep the WebPageProxy alive for the lifetime of all PageLoadState::Transaction objects
+        https://bugs.webkit.org/show_bug.cgi?id=131872
+        <rdar://problem/15758414>
+
+        Reviewed by Dan Bernstein.
+
+        * UIProcess/PageLoadState.cpp:
+        (WebKit::PageLoadState::PageLoadState):
+        (WebKit::PageLoadState::Transaction::Transaction):
+        (WebKit::PageLoadState::Transaction::~Transaction):
+        * UIProcess/PageLoadState.h:
+        (WebKit::PageLoadState::Transaction::Transaction): Deleted.
+        (WebKit::PageLoadState::Transaction::~Transaction): Deleted.
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::WebPageProxy):
+
 2014-04-18  Stephanie Lewis  <[email protected]>
 
         We shouldn’t create page throttlers for other pages than WebKit2 pages.

Modified: trunk/Source/WebKit2/UIProcess/PageLoadState.cpp (167524 => 167525)


--- trunk/Source/WebKit2/UIProcess/PageLoadState.cpp	2014-04-19 00:49:07 UTC (rev 167524)
+++ trunk/Source/WebKit2/UIProcess/PageLoadState.cpp	2014-04-19 01:38:31 UTC (rev 167525)
@@ -26,13 +26,16 @@
 #include "config.h"
 #include "PageLoadState.h"
 
+#include "WebPageProxy.h"
+
 namespace WebKit {
 
 // Progress always starts at this value. This helps provide feedback as soon as a load starts.
 static const double initialProgressValue = 0.1;
 
-PageLoadState::PageLoadState()
-    : m_mayHaveUncommittedChanges(false)
+PageLoadState::PageLoadState(WebPageProxy& webPageProxy)
+    : m_webPageProxy(webPageProxy)
+    , m_mayHaveUncommittedChanges(false)
     , m_outstandingTransactionCount(0)
 {
 }
@@ -42,6 +45,26 @@
     ASSERT(m_observers.isEmpty());
 }
 
+PageLoadState::Transaction::Transaction(PageLoadState& pageLoadState)
+    : m_webPageProxy(&pageLoadState.m_webPageProxy)
+    , m_pageLoadState(&pageLoadState)
+{
+    m_pageLoadState->beginTransaction();
+}
+
+PageLoadState::Transaction::Transaction(Transaction&& other)
+    : m_webPageProxy(std::move(other.m_webPageProxy))
+    , m_pageLoadState(other.m_pageLoadState)
+{
+    other.m_pageLoadState = nullptr;
+}
+
+PageLoadState::Transaction::~Transaction()
+{
+    if (m_pageLoadState)
+        m_pageLoadState->endTransaction();
+}
+
 void PageLoadState::addObserver(Observer& observer)
 {
     ASSERT(!m_observers.contains(&observer));

Modified: trunk/Source/WebKit2/UIProcess/PageLoadState.h (167524 => 167525)


--- trunk/Source/WebKit2/UIProcess/PageLoadState.h	2014-04-19 00:49:07 UTC (rev 167524)
+++ trunk/Source/WebKit2/UIProcess/PageLoadState.h	2014-04-19 01:38:31 UTC (rev 167525)
@@ -30,9 +30,11 @@
 
 namespace WebKit {
 
+class WebPageProxy;
+
 class PageLoadState {
 public:
-    PageLoadState();
+    explicit PageLoadState(WebPageProxy&);
     ~PageLoadState();
 
     enum class State {
@@ -64,26 +66,13 @@
     class Transaction {
         WTF_MAKE_NONCOPYABLE(Transaction);
     public:
-        Transaction(Transaction&& other)
-            : m_pageLoadState(other.m_pageLoadState)
-        {
-            other.m_pageLoadState = nullptr;
-        }
+        Transaction(Transaction&&);
+        ~Transaction();
 
-        ~Transaction()
-        {
-            if (m_pageLoadState)
-                m_pageLoadState->endTransaction();
-        }
-
     private:
         friend class PageLoadState;
 
-        explicit Transaction(PageLoadState& pageLoadState)
-            : m_pageLoadState(&pageLoadState)
-        {
-            m_pageLoadState->beginTransaction();
-        }
+        explicit Transaction(PageLoadState&);
 
         class Token {
         public:
@@ -100,6 +89,7 @@
 #endif
         };
 
+        RefPtr<WebPageProxy> m_webPageProxy;
         PageLoadState* m_pageLoadState;
     };
 
@@ -185,6 +175,8 @@
     static bool hasOnlySecureContent(const Data&);
     static double estimatedProgress(const Data&);
 
+    WebPageProxy& m_webPageProxy;
+
     Data m_committedState;
     Data m_uncommittedState;
 

Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (167524 => 167525)


--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-04-19 00:49:07 UTC (rev 167524)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp	2014-04-19 01:38:31 UTC (rev 167525)
@@ -326,6 +326,7 @@
     , m_currentDragIsOverFileInput(false)
     , m_currentDragNumberOfFilesToBeAccepted(0)
 #endif
+    , m_pageLoadState(*this)
     , m_delegatesScrolling(false)
     , m_mainFrameHasHorizontalScrollbar(false)
     , m_mainFrameHasVerticalScrollbar(false)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to