Changeset 167525 in webkit


Ignore:
Timestamp:
Apr 18, 2014 6:38:31 PM (10 years ago)
Author:
andersca@apple.com
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):

Location:
trunk/Source/WebKit2
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r167523 r167525  
     12014-04-18  Anders Carlsson  <andersca@apple.com>
     2
     3        Keep the WebPageProxy alive for the lifetime of all PageLoadState::Transaction objects
     4        https://bugs.webkit.org/show_bug.cgi?id=131872
     5        <rdar://problem/15758414>
     6
     7        Reviewed by Dan Bernstein.
     8
     9        * UIProcess/PageLoadState.cpp:
     10        (WebKit::PageLoadState::PageLoadState):
     11        (WebKit::PageLoadState::Transaction::Transaction):
     12        (WebKit::PageLoadState::Transaction::~Transaction):
     13        * UIProcess/PageLoadState.h:
     14        (WebKit::PageLoadState::Transaction::Transaction): Deleted.
     15        (WebKit::PageLoadState::Transaction::~Transaction): Deleted.
     16        * UIProcess/WebPageProxy.cpp:
     17        (WebKit::WebPageProxy::WebPageProxy):
     18
    1192014-04-18  Stephanie Lewis  <slewis@apple.com>
    220
  • trunk/Source/WebKit2/UIProcess/PageLoadState.cpp

    r160718 r167525  
    2727#include "PageLoadState.h"
    2828
     29#include "WebPageProxy.h"
     30
    2931namespace WebKit {
    3032
     
    3234static const double initialProgressValue = 0.1;
    3335
    34 PageLoadState::PageLoadState()
    35     : m_mayHaveUncommittedChanges(false)
     36PageLoadState::PageLoadState(WebPageProxy& webPageProxy)
     37    : m_webPageProxy(webPageProxy)
     38    , m_mayHaveUncommittedChanges(false)
    3639    , m_outstandingTransactionCount(0)
    3740{
     
    4144{
    4245    ASSERT(m_observers.isEmpty());
     46}
     47
     48PageLoadState::Transaction::Transaction(PageLoadState& pageLoadState)
     49    : m_webPageProxy(&pageLoadState.m_webPageProxy)
     50    , m_pageLoadState(&pageLoadState)
     51{
     52    m_pageLoadState->beginTransaction();
     53}
     54
     55PageLoadState::Transaction::Transaction(Transaction&& other)
     56    : m_webPageProxy(std::move(other.m_webPageProxy))
     57    , m_pageLoadState(other.m_pageLoadState)
     58{
     59    other.m_pageLoadState = nullptr;
     60}
     61
     62PageLoadState::Transaction::~Transaction()
     63{
     64    if (m_pageLoadState)
     65        m_pageLoadState->endTransaction();
    4366}
    4467
  • trunk/Source/WebKit2/UIProcess/PageLoadState.h

    r160662 r167525  
    3131namespace WebKit {
    3232
     33class WebPageProxy;
     34
    3335class PageLoadState {
    3436public:
    35     PageLoadState();
     37    explicit PageLoadState(WebPageProxy&);
    3638    ~PageLoadState();
    3739
     
    6567        WTF_MAKE_NONCOPYABLE(Transaction);
    6668    public:
    67         Transaction(Transaction&& other)
    68             : m_pageLoadState(other.m_pageLoadState)
    69         {
    70             other.m_pageLoadState = nullptr;
    71         }
    72 
    73         ~Transaction()
    74         {
    75             if (m_pageLoadState)
    76                 m_pageLoadState->endTransaction();
    77         }
     69        Transaction(Transaction&&);
     70        ~Transaction();
    7871
    7972    private:
    8073        friend class PageLoadState;
    8174
    82         explicit Transaction(PageLoadState& pageLoadState)
    83             : m_pageLoadState(&pageLoadState)
    84         {
    85             m_pageLoadState->beginTransaction();
    86         }
     75        explicit Transaction(PageLoadState&);
    8776
    8877        class Token {
     
    10190        };
    10291
     92        RefPtr<WebPageProxy> m_webPageProxy;
    10393        PageLoadState* m_pageLoadState;
    10494    };
     
    186176    static double estimatedProgress(const Data&);
    187177
     178    WebPageProxy& m_webPageProxy;
     179
    188180    Data m_committedState;
    189181    Data m_uncommittedState;
  • trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp

    r167519 r167525  
    327327    , m_currentDragNumberOfFilesToBeAccepted(0)
    328328#endif
     329    , m_pageLoadState(*this)
    329330    , m_delegatesScrolling(false)
    330331    , m_mainFrameHasHorizontalScrollbar(false)
Note: See TracChangeset for help on using the changeset viewer.