Roll out fix for https://bugs.webkit.org/show_bug.cgi?id=131637:
authorap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 May 2014 05:49:09 +0000 (05:49 +0000)
committerap@apple.com <ap@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 1 May 2014 05:49:09 +0000 (05:49 +0000)
Clean up unnecessary methods in the BackForwardClient interface

It broke a regression test and an API test.

Source/WebCore:
* WebCore.exp.in:
* history/BackForwardClient.h:
(WebCore::BackForwardClient::backItem):
(WebCore::BackForwardClient::currentItem):
(WebCore::BackForwardClient::forwardItem):
* history/BackForwardController.cpp:
(WebCore::BackForwardController::BackForwardController):
* history/BackForwardController.h:
(WebCore::BackForwardController::client):
* history/BackForwardList.cpp:
(WebCore::BackForwardList::BackForwardList):
(WebCore::BackForwardList::close):
* history/BackForwardList.h:
(WebCore::BackForwardList::create):
(WebCore::BackForwardList::page):
* page/Page.cpp:
(WebCore::Page::Page):
(WebCore::Page::PageClients::PageClients):
* page/Page.h:

Source/WebKit/efl:
* ewk/ewk_history.cpp:
(ewk_history_clear):
(ewk_history_new):
(ewk_history_free):
* ewk/ewk_view.cpp:
(_ewk_view_priv_new):
(ewk_view_history_enable_get):
(ewk_view_history_enable_set):
(ewk_view_history_get):

Source/WebKit/mac:
* History/WebBackForwardList.mm:
(-[WebBackForwardList initWithBackForwardList:]):
(-[WebBackForwardList init]):
(-[WebBackForwardList dealloc]):
(-[WebBackForwardList finalize]):
(-[WebBackForwardList setPageCacheSize:]):
(-[WebBackForwardList pageCacheSize]):
* History/WebBackForwardListInternal.h:
* WebCoreSupport/WebFrameLoaderClient.mm:
(WebFrameLoaderClient::canCachePage):
* WebView/WebFrameView.mm:
(-[WebFrameView keyDown:keyDown:]):
* WebView/WebView.mm:
(-[WebView _loadBackForwardListFromOtherView:]):
(-[WebView initWithCoder:]):
(-[WebView encodeWithCoder:]):
(-[WebView backForwardList]):
(-[WebView setMaintainsBackForwardList:]):

Source/WebKit/win:
* WebBackForwardList.cpp:
(WebBackForwardList::WebBackForwardList):
(WebBackForwardList::~WebBackForwardList):
(WebBackForwardList::createInstance):
* WebBackForwardList.h:
* WebView.cpp:
(WebView::backForwardList):
(WebView::canGoBack):
(WebView::canGoForward):
(WebView::loadBackForwardListFromOtherView):

Source/WebKit2:
* WebKit2.xcodeproj/project.pbxproj:
* WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
(WebKit::InjectedBundleBackForwardList::clear):
* WebProcess/WebPage/WebBackForwardListProxy.cpp:
(WebKit::WebBackForwardListProxy::WebBackForwardListProxy):
(WebKit::WebBackForwardListProxy::addItem):
(WebKit::WebBackForwardListProxy::goToItem):
(WebKit::WebBackForwardListProxy::itemAtIndex):
(WebKit::WebBackForwardListProxy::backListCount):
(WebKit::WebBackForwardListProxy::forwardListCount):
(WebKit::WebBackForwardListProxy::close):
(WebKit::WebBackForwardListProxy::clear):
* WebProcess/WebPage/WebBackForwardListProxy.h:
(WebKit::WebBackForwardListProxy::create):
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::WebPage):
* WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm: Copied from Source/WebKit2/WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168085 268f45cc-cd09-0410-ab3c-d52691b4dbfc

29 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebCore/history/BackForwardClient.h
Source/WebCore/history/BackForwardController.cpp
Source/WebCore/history/BackForwardController.h
Source/WebCore/history/BackForwardList.cpp
Source/WebCore/history/BackForwardList.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/Page.h
Source/WebKit/efl/ChangeLog
Source/WebKit/efl/ewk/ewk_history.cpp
Source/WebKit/efl/ewk/ewk_view.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/History/WebBackForwardList.mm
Source/WebKit/mac/History/WebBackForwardListInternal.h
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebView/WebFrameView.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit/win/ChangeLog
Source/WebKit/win/WebBackForwardList.cpp
Source/WebKit/win/WebBackForwardList.h
Source/WebKit/win/WebView.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/WebKit2.xcodeproj/project.pbxproj
Source/WebKit2/WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp
Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.cpp
Source/WebKit2/WebProcess/WebPage/WebBackForwardListProxy.h
Source/WebKit2/WebProcess/WebPage/WebPage.cpp
Source/WebKit2/WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm [new file with mode: 0644]

index aaa0482..74cf72d 100644 (file)
@@ -1,3 +1,30 @@
+2014-04-30  Alexey Proskuryakov  <ap@apple.com>
+
+        Roll out fix for https://bugs.webkit.org/show_bug.cgi?id=131637:
+        Clean up unnecessary methods in the BackForwardClient interface
+
+        It broke a regression test and an API test.
+
+        * WebCore.exp.in:
+        * history/BackForwardClient.h:
+        (WebCore::BackForwardClient::backItem):
+        (WebCore::BackForwardClient::currentItem):
+        (WebCore::BackForwardClient::forwardItem):
+        * history/BackForwardController.cpp:
+        (WebCore::BackForwardController::BackForwardController):
+        * history/BackForwardController.h:
+        (WebCore::BackForwardController::client):
+        * history/BackForwardList.cpp:
+        (WebCore::BackForwardList::BackForwardList):
+        (WebCore::BackForwardList::close):
+        * history/BackForwardList.h:
+        (WebCore::BackForwardList::create):
+        (WebCore::BackForwardList::page):
+        * page/Page.cpp:
+        (WebCore::Page::Page):
+        (WebCore::Page::PageClients::PageClients):
+        * page/Page.h:
+
 2014-04-30  Simon Fraser  <simon.fraser@apple.com>
 
         More iOS build fixing. MediaPlayerPrivateIOS is defunct and can be removed.
index 5227c4b..a683a47 100644 (file)
@@ -473,7 +473,7 @@ __ZN7WebCore15BackForwardList7entriesEv
 __ZN7WebCore15BackForwardList8backItemEv
 __ZN7WebCore15BackForwardList8capacityEv
 __ZN7WebCore15BackForwardList9goForwardEv
-__ZN7WebCore15BackForwardListC1Ev
+__ZN7WebCore15BackForwardListC1EPNS_4PageE
 __ZN7WebCore15CertificateInfoC1EPK9__CFArray
 __ZN7WebCore15CertificateInfoC1ERKNS_16ResourceResponseE
 __ZN7WebCore15CertificateInfoC1Ev
@@ -867,7 +867,6 @@ __ZN7WebCore20toUInt32EnforceRangeEPN3JSC9ExecStateENS0_7JSValueE
 __ZN7WebCore21AudioHardwareListener6createERNS0_6ClientE
 __ZN7WebCore21BackForwardController11itemAtIndexEi
 __ZN7WebCore21BackForwardController6goBackEv
-__ZN7WebCore21BackForwardController7addItemEN3WTF10PassRefPtrINS_11HistoryItemEEE
 __ZN7WebCore21BackForwardController9goForwardEv
 __ZN7WebCore21CrossThreadCopierBaseILb0ELb0EN3WTF6StringEE4copyERKS2_
 __ZN7WebCore21CrossThreadCopierBaseILb0ELb0ENS_19IDBDatabaseMetadataEE4copyERKS1_
@@ -2497,9 +2496,6 @@ __ZN7WebCore14ResourceHandle9setClientEPNS_20ResourceHandleClientE
 __ZN7WebCore14ResourceHandleD1Ev
 __ZN7WebCore14areRangesEqualEPKNS_5RangeES2_
 __ZN7WebCore14cookiesEnabledERKNS_21NetworkStorageSessionERKNS_3URLES5_
-__ZN7WebCore15BackForwardList7currentEv
-__ZN7WebCore15BackForwardList10setCurrentEj
-__ZN7WebCore15BackForwardList18clearAllPageCachesEv
 __ZN7WebCore15DatabaseTracker18setDatabasesPausedEb
 __ZN7WebCore15DatabaseTracker25deleteDatabaseFileIfEmptyERKN3WTF6StringE
 __ZN7WebCore15DatabaseTracker28removeDeletedOpenedDatabasesEv
index 5f931d0..4718736 100644 (file)
 #define BackForwardClient_h
 
 #include <wtf/Forward.h>
+#include <wtf/RefCounted.h>
 
 namespace WebCore {
 
 class HistoryItem;
 
-class BackForwardClient {
-public:
+class BackForwardClient : public RefCounted<BackForwardClient> {
+public: 
     virtual ~BackForwardClient()
     {
     }
@@ -43,12 +44,27 @@ public:
     virtual void addItem(PassRefPtr<HistoryItem>) = 0;
 
     virtual void goToItem(HistoryItem*) = 0;
-
+        
     virtual HistoryItem* itemAtIndex(int) = 0;
     virtual int backListCount() = 0;
     virtual int forwardListCount() = 0;
 
     virtual void close() = 0;
+
+#if PLATFORM(IOS)
+    // FIXME: These methods seem to violate the encapsulation of this class.
+    virtual unsigned current() = 0;
+    virtual void setCurrent(unsigned newCurrent) = 0;
+
+    // FIXME: Consider renaming this method once we upstream the iOS changes to WebView.mm.
+    virtual bool clearAllPageCaches() = 0;
+#endif
+
+    // FIXME: Delete these once all callers are using BackForwardController
+    // instead of calling this directly.
+    HistoryItem* backItem() { return itemAtIndex(-1); }
+    HistoryItem* currentItem() { return itemAtIndex(0); }
+    HistoryItem* forwardItem() { return itemAtIndex(1); }
 };
 
 } // namespace WebCore
index 2a3f73b..2d1d020 100644 (file)
 
 namespace WebCore {
 
-BackForwardController::BackForwardController(Page& page, std::unique_ptr<BackForwardClient> client)
+BackForwardController::BackForwardController(Page& page, PassRefPtr<BackForwardClient> client)
     : m_page(page)
-    , m_client(std::move(client))
+    , m_client(client)
 {
     if (!m_client)
-        m_client = std::make_unique<BackForwardList>();
+        m_client = BackForwardList::create(&page);
 }
 
 BackForwardController::~BackForwardController()
index aaa00d4..6387746 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <wtf/Noncopyable.h>
 #include <wtf/Forward.h>
+#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
@@ -38,11 +39,10 @@ class Page;
 class BackForwardController {
     WTF_MAKE_NONCOPYABLE(BackForwardController); WTF_MAKE_FAST_ALLOCATED;
 public:
-    BackForwardController(Page&, std::unique_ptr<BackForwardClient>);
+    BackForwardController(Page&, PassRefPtr<BackForwardClient>);
     ~BackForwardController();
 
-    // FIXME: Remove uses of this getter. <https://webkit.org/b/132027>
-    BackForwardClient& client() const { return *m_client; }
+    BackForwardClient* client() const { return m_client.get(); }
 
     bool canGoBackOrForward(int distance) const;
     void goBackOrForward(int distance);
@@ -52,7 +52,7 @@ public:
 
     void addItem(PassRefPtr<HistoryItem>);
     void setCurrentItem(HistoryItem*);
-
+        
     int count() const;
     int backCount() const;
     int forwardCount() const;
@@ -67,7 +67,7 @@ public:
 
 private:
     Page& m_page;
-    std::unique_ptr<BackForwardClient> m_client;
+    RefPtr<BackForwardClient> m_client;
 };
 
 } // namespace WebCore
index 4cdb283..1e5e774 100644 (file)
@@ -32,6 +32,7 @@
 #include "FrameLoaderClient.h"
 #include "HistoryItem.h"
 #include "Logging.h"
+#include "Page.h"
 #include "PageCache.h"
 #include "SerializedScriptValue.h"
 
@@ -40,8 +41,9 @@ namespace WebCore {
 static const unsigned DefaultCapacity = 100;
 static const unsigned NoCurrentItemIndex = UINT_MAX;
 
-BackForwardList::BackForwardList()
-    : m_current(NoCurrentItemIndex)
+BackForwardList::BackForwardList(Page* page)
+    : m_page(page)
+    , m_current(NoCurrentItemIndex)
     , m_capacity(DefaultCapacity)
     , m_closed(true)
     , m_enabled(true)
@@ -259,6 +261,7 @@ void BackForwardList::close()
         pageCache()->remove(m_entries[i].get());
     m_entries.clear();
     m_entryHash.clear();
+    m_page = 0;
     m_closed = true;
 }
 
index f9c3e14..3b05be9 100644 (file)
 
 namespace WebCore {
 
+class Page;
+
 typedef Vector<RefPtr<HistoryItem>> HistoryItemVector;
 typedef HashSet<RefPtr<HistoryItem>> HistoryItemHashSet;
 
 class BackForwardList : public BackForwardClient {
-public:
-    BackForwardList();
+public: 
+    static PassRefPtr<BackForwardList> create(Page* page) { return adoptRef(new BackForwardList(page)); }
     virtual ~BackForwardList();
 
+    Page* page() { return m_page; }
+
     virtual void addItem(PassRefPtr<HistoryItem>) override;
     void goBack();
     void goForward();
     virtual void goToItem(HistoryItem*) override;
-
+        
     HistoryItem* backItem();
     HistoryItem* currentItem();
     HistoryItem* forwardItem();
@@ -70,13 +74,16 @@ public:
     HistoryItemVector& entries();
 
 #if PLATFORM(IOS)
-    unsigned current();
-    void setCurrent(unsigned newCurrent);
+    virtual unsigned current() override;
+    virtual void setCurrent(unsigned newCurrent) override;
 
-    bool clearAllPageCaches();
+    virtual bool clearAllPageCaches() override;
 #endif
 
 private:
+    explicit BackForwardList(Page*);
+
+    Page* m_page;
     HistoryItemVector m_entries;
     HistoryItemHashSet m_entryHash;
     unsigned m_current;
index 2674412..5adfc14 100644 (file)
@@ -144,7 +144,7 @@ Page::Page(PageClients& pageClients)
 #endif
     , m_settings(Settings::create(this))
     , m_progress(std::make_unique<ProgressTracker>(*pageClients.progressTrackerClient))
-    , m_backForwardController(std::make_unique<BackForwardController>(*this, std::move(pageClients.backForwardClient)))
+    , m_backForwardController(std::make_unique<BackForwardController>(*this, pageClients.backForwardClient))
     , m_mainFrame(MainFrame::create(*this, *pageClients.loaderClientForMainFrame))
     , m_theme(RenderTheme::themeForPage(this))
     , m_editorClient(pageClients.editorClient)
@@ -1605,7 +1605,6 @@ Page::PageClients::PageClients()
     , inspectorClient(nullptr)
     , plugInClient(nullptr)
     , progressTrackerClient(nullptr)
-    , backForwardClient(nullptr)
     , validationMessageClient(nullptr)
     , loaderClientForMainFrame(nullptr)
 {
index 38e4256..59f8ae6 100644 (file)
@@ -134,7 +134,7 @@ public:
         InspectorClient* inspectorClient;
         PlugInClient* plugInClient;
         ProgressTrackerClient* progressTrackerClient;
-        std::unique_ptr<BackForwardClient> backForwardClient;
+        RefPtr<BackForwardClient> backForwardClient;
         ValidationMessageClient* validationMessageClient;
         FrameLoaderClient* loaderClientForMainFrame;
 
index f855cbd..69782f9 100644 (file)
@@ -1,3 +1,20 @@
+2014-04-30  Alexey Proskuryakov  <ap@apple.com>
+
+        Roll out fix for https://bugs.webkit.org/show_bug.cgi?id=131637:
+        Clean up unnecessary methods in the BackForwardClient interface
+
+        It broke a regression test and an API test.
+
+        * ewk/ewk_history.cpp:
+        (ewk_history_clear):
+        (ewk_history_new):
+        (ewk_history_free):
+        * ewk/ewk_view.cpp:
+        (_ewk_view_priv_new):
+        (ewk_view_history_enable_get):
+        (ewk_view_history_enable_set):
+        (ewk_view_history_get):
+
 2014-04-30  Brian J. Burg  <burg@cs.washington.edu>
 
         Clean up unnecessary methods in the BackForwardClient interface
index d7de9c7..77f0a6d 100644 (file)
@@ -92,7 +92,11 @@ static inline Eina_List* _ewk_history_item_list_get(const WebCore::HistoryItemVe
 
 Eina_Bool ewk_history_clear(Ewk_History* history)
 {
-    WebCore::PageGroup::removeAllVisitedLinks();
+    EWK_HISTORY_CORE_GET_OR_RETURN(history, core, false);
+
+    WebCore::Page* page = core->page();
+    if (page && page->groupPtr())
+        page->groupPtr()->removeVisitedLinks();
 
     const int limit = ewk_history_limit_get(history);
     ewk_history_limit_set(history, 0);
@@ -368,6 +372,7 @@ Ewk_History* ewk_history_new(WebCore::BackForwardList* core)
 
     history = new Ewk_History;
     history->core = core;
+    core->ref();
 
     return history;
 }
@@ -383,6 +388,7 @@ Ewk_History* ewk_history_new(WebCore::BackForwardList* core)
 void ewk_history_free(Ewk_History* history)
 {
     DBG("history=%p", history);
+    history->core->deref();
     delete history;
 }
 
index dd2e32f..2be759e 100644 (file)
@@ -752,7 +752,7 @@ static Ewk_View_Private_Data* _ewk_view_priv_new(Ewk_View_Smart_Data* smartData)
     priv->settings.allowUniversalAccessFromFileURLs = pageSettings.allowUniversalAccessFromFileURLs();
     priv->settings.allowFileAccessFromFileURLs = pageSettings.allowFileAccessFromFileURLs();
 
-    priv->history = ewk_history_new(static_cast<WebCore::BackForwardList*>(&priv->page->backForward().client()));
+    priv->history = ewk_history_new(static_cast<WebCore::BackForwardList*>(priv->page->backForward().client()));
 
 #ifdef HAVE_ECORE_X
     priv->isUsingEcoreX = WebCore::isUsingEcoreX(smartData->base.evas);
@@ -1653,14 +1653,14 @@ Eina_Bool ewk_view_history_enable_get(const Evas_Object* ewkView)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-    return static_cast<WebCore::BackForwardList&>(priv->page->backForward().client()).enabled();
+    return static_cast<WebCore::BackForwardList*>(priv->page->backForward().client())->enabled();
 }
 
 Eina_Bool ewk_view_history_enable_set(Evas_Object* ewkView, Eina_Bool enable)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, false);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, false);
-    static_cast<WebCore::BackForwardList&>(priv->page->backForward().client()).setEnabled(enable);
+    static_cast<WebCore::BackForwardList*>(priv->page->backForward().client())->setEnabled(enable);
     return true;
 }
 
@@ -1668,7 +1668,7 @@ Ewk_History* ewk_view_history_get(const Evas_Object* ewkView)
 {
     EWK_VIEW_SD_GET_OR_RETURN(ewkView, smartData, 0);
     EWK_VIEW_PRIV_GET_OR_RETURN(smartData, priv, 0);
-    if (!static_cast<WebCore::BackForwardList&>(priv->page->backForward().client()).enabled()) {
+    if (!static_cast<WebCore::BackForwardList*>(priv->page->backForward().client())->enabled()) {
         ERR("asked history, but it's disabled! Returning 0!");
         return 0;
     }
index a481ddc..11bc321 100644 (file)
@@ -1,3 +1,29 @@
+2014-04-30  Alexey Proskuryakov  <ap@apple.com>
+
+        Roll out fix for https://bugs.webkit.org/show_bug.cgi?id=131637:
+        Clean up unnecessary methods in the BackForwardClient interface
+
+        It broke a regression test and an API test.
+
+        * History/WebBackForwardList.mm:
+        (-[WebBackForwardList initWithBackForwardList:]):
+        (-[WebBackForwardList init]):
+        (-[WebBackForwardList dealloc]):
+        (-[WebBackForwardList finalize]):
+        (-[WebBackForwardList setPageCacheSize:]):
+        (-[WebBackForwardList pageCacheSize]):
+        * History/WebBackForwardListInternal.h:
+        * WebCoreSupport/WebFrameLoaderClient.mm:
+        (WebFrameLoaderClient::canCachePage):
+        * WebView/WebFrameView.mm:
+        (-[WebFrameView keyDown:keyDown:]):
+        * WebView/WebView.mm:
+        (-[WebView _loadBackForwardListFromOtherView:]):
+        (-[WebView initWithCoder:]):
+        (-[WebView encodeWithCoder:]):
+        (-[WebView backForwardList]):
+        (-[WebView setMaintainsBackForwardList:]):
+
 2014-04-30  Simon Fraser  <simon.fraser@apple.com>
 
         Remove ENABLE_PLUGIN_PROXY_FOR_VIDEO
index 4b983d3..077c903 100644 (file)
@@ -85,14 +85,14 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
     return [[[WebBackForwardList alloc] initWithBackForwardList:backForwardList] autorelease];
 }
 
-- (id)initWithBackForwardList:(BackForwardList*)backForwardList
+- (id)initWithBackForwardList:(PassRefPtr<BackForwardList>)backForwardList
 {   
     WebCoreThreadViolationCheckRoundOne();
     self = [super init];
     if (!self)
         return nil;
 
-    _private = reinterpret_cast<WebBackForwardListPrivate*>(backForwardList);
+    _private = reinterpret_cast<WebBackForwardListPrivate*>(backForwardList.leakRef());
     backForwardLists().set(core(self), self);
     return self;
 }
@@ -113,7 +113,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
 
 - (id)init
 {
-    return [self initWithBackForwardList:new BackForwardList];
+    return [self initWithBackForwardList:BackForwardList::create(0)];
 }
 
 - (void)dealloc
@@ -126,7 +126,7 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
     if (backForwardList) {
         ASSERT(backForwardList->closed());
         backForwardLists().remove(backForwardList);
-        delete backForwardList;
+        backForwardList->deref();
     }
 
     [super dealloc];
@@ -140,9 +140,9 @@ WebBackForwardList *kit(BackForwardList* backForwardList)
     if (backForwardList) {
         ASSERT(backForwardList->closed());
         backForwardLists().remove(backForwardList);
-        delete backForwardList;
+        backForwardList->deref();
     }
-
+        
     [super finalize];
 }
 
@@ -348,6 +348,16 @@ static bool bumperCarBackForwardHackNeeded()
     return result;
 }
 
+- (void)setPageCacheSize:(NSUInteger)size
+{
+    [kit(core(self)->page()) setUsesPageCache:size != 0];
+}
+
+- (NSUInteger)pageCacheSize
+{
+    return [kit(core(self)->page()) usesPageCache] ? pageCache()->capacity() : 0;
+}
+
 - (int)backListCount
 {
     return core(self)->backListCount();
index e7332ff..2d2a220 100644 (file)
@@ -27,6 +27,7 @@
  */
 
 #import <WebKitLegacy/WebBackForwardList.h>
+#import <wtf/PassRefPtr.h>
 
 namespace WebCore {
 class BackForwardList;
@@ -36,5 +37,5 @@ WebCore::BackForwardList* core(WebBackForwardList *);
 WebBackForwardList *kit(WebCore::BackForwardList*);
 
 @interface WebBackForwardList (WebBackForwardListInternal)
-- (id)initWithBackForwardList:(WebCore::BackForwardList*)backForwardList;
+- (id)initWithBackForwardList:(PassRefPtr<WebCore::BackForwardList>)backForwardList;
 @end
index 265162e..f1f305b 100644 (file)
@@ -1563,11 +1563,11 @@ bool WebFrameLoaderClient::canCachePage() const
     if (!page)
         return false;
     
-    BackForwardList& backForwardList = static_cast<BackForwardList&>(page->backForward().client());
-    if (!backForwardList.enabled())
+    BackForwardList *backForwardList = static_cast<BackForwardList*>(page->backForward().client());
+    if (!backForwardList->enabled())
         return false;
     
-    if (!backForwardList.capacity())
+    if (!backForwardList->capacity())
         return false;
     
     return true;
index f80cb18..df799ba 100644 (file)
@@ -927,7 +927,7 @@ static inline void addTypesFromClass(NSMutableDictionary *allTypes, Class objCCl
     int index, count;
     BOOL callSuper = YES;
     Frame* coreFrame = [self _web_frame];
-    BOOL maintainsBackForwardList = coreFrame && static_cast<BackForwardList&>(coreFrame->page()->backForward().client()).enabled() ? YES : NO;
+    BOOL maintainsBackForwardList = coreFrame && static_cast<BackForwardList*>(coreFrame->page()->backForward().client())->enabled() ? YES : NO;
     
     count = [characters length];
     for (index = 0; index < count; ++index) {
index f1ae8d6..2921ac0 100644 (file)
@@ -2001,31 +2001,32 @@ static bool fastDocumentTeardownEnabled()
         return;
     
     // It turns out the right combination of behavior is done with the back/forward load
-    // type. (See behavior matrix at the top of WebFramePrivate.)  So we copy all the items
+    // type.  (See behavior matrix at the top of WebFramePrivate.)  So we copy all the items
     // in the back forward list, and go to the current one.
-    BackForwardController& backForward = _private->page->backForward();
-    ASSERT(!backForward.currentItem()); // destination list should be empty
 
-    BackForwardController& otherBackForward = otherView->_private->page->backForward();
-    if (!otherBackForward.currentItem())
-        return; // empty back forward list, bail
+    BackForwardClient* backForwardClient = _private->page->backForward().client();
+    ASSERT(!backForwardClient->currentItem()); // destination list should be empty
 
+    BackForwardClient* otherBackForwardClient = otherView->_private->page->backForward().client();
+    if (!otherBackForwardClient->currentItem())
+        return; // empty back forward list, bail
+    
     HistoryItem* newItemToGoTo = 0;
 
-    int lastItemIndex = otherBackForward.forwardCount();
-    for (int i = -otherBackForward.backCount(); i <= lastItemIndex; ++i) {
+    int lastItemIndex = otherBackForwardClient->forwardListCount();
+    for (int i = -otherBackForwardClient->backListCount(); i <= lastItemIndex; ++i) {
         if (i == 0) {
-            // If this item is showing, save away its current scroll and form state,
+            // If this item is showing , save away its current scroll and form state,
             // since that might have changed since loading and it is normally not saved
             // until we leave that page.
             otherView->_private->page->mainFrame().loader().history().saveDocumentAndScrollState();
         }
-        RefPtr<HistoryItem> newItem = otherBackForward.itemAtIndex(i)->copy();
-        if (i == 0)
+        RefPtr<HistoryItem> newItem = otherBackForwardClient->itemAtIndex(i)->copy();
+        if (i == 0) 
             newItemToGoTo = newItem.get();
-        backForward.addItem(newItem.release());
+        backForwardClient->addItem(newItem.release());
     }
-
+    
     ASSERT(newItemToGoTo);
     _private->page->goToItem(newItemToGoTo, FrameLoadTypeIndexedBackForward);
 }
@@ -5095,7 +5096,7 @@ static bool needsWebViewInitThreadWorkaround()
 
         LOG(Encoding, "FrameName = %@, GroupName = %@, useBackForwardList = %d\n", frameName, groupName, (int)useBackForwardList);
         [result _commonInitializationWithFrameName:frameName groupName:groupName];
-        static_cast<BackForwardList&>([result page]->backForward().client()).setEnabled(useBackForwardList);
+        static_cast<BackForwardList*>([result page]->backForward().client())->setEnabled(useBackForwardList);
         result->_private->allowsUndo = allowsUndo;
         if (preferences)
             [result setPreferences:preferences];
@@ -5119,7 +5120,7 @@ static bool needsWebViewInitThreadWorkaround()
     // Restore the subviews we set aside.
     _subviews = originalSubviews;
 
-    BOOL useBackForwardList = _private->page && static_cast<BackForwardList&>(_private->page->backForward().client()).enabled();
+    BOOL useBackForwardList = _private->page && static_cast<BackForwardList*>(_private->page->backForward().client())->enabled();
     if ([encoder allowsKeyedCoding]) {
         [encoder encodeObject:[[self mainFrame] name] forKey:@"FrameName"];
         [encoder encodeObject:[self groupName] forKey:@"GroupName"];
@@ -5589,17 +5590,17 @@ static NSString * const backingPropertyOldScaleFactorKey = @"NSBackingPropertyOl
 {
     if (!_private->page)
         return nil;
-    BackForwardList& list = static_cast<BackForwardList&>(_private->page->backForward().client());
-    if (!list.enabled())
+    BackForwardList* list = static_cast<BackForwardList*>(_private->page->backForward().client());
+    if (!list->enabled())
         return nil;
-    return kit(&list);
+    return kit(list);
 }
 
 - (void)setMaintainsBackForwardList:(BOOL)flag
 {
     if (!_private->page)
         return;
-    static_cast<BackForwardList&>(_private->page->backForward().client()).setEnabled(flag);
+    static_cast<BackForwardList*>(_private->page->backForward().client())->setEnabled(flag);
 }
 
 - (BOOL)goBack
index 73c493f..5ad8267 100644 (file)
@@ -1,3 +1,21 @@
+2014-04-30  Alexey Proskuryakov  <ap@apple.com>
+
+        Roll out fix for https://bugs.webkit.org/show_bug.cgi?id=131637:
+        Clean up unnecessary methods in the BackForwardClient interface
+
+        It broke a regression test and an API test.
+
+        * WebBackForwardList.cpp:
+        (WebBackForwardList::WebBackForwardList):
+        (WebBackForwardList::~WebBackForwardList):
+        (WebBackForwardList::createInstance):
+        * WebBackForwardList.h:
+        * WebView.cpp:
+        (WebView::backForwardList):
+        (WebView::canGoBack):
+        (WebView::canGoForward):
+        (WebView::loadBackForwardListFromOtherView):
+
 2014-04-30  Brian J. Burg  <burg@cs.washington.edu>
 
         Clean up unnecessary methods in the BackForwardClient interface
index 6161f3e..7acaea2 100644 (file)
@@ -48,12 +48,12 @@ static HashMap<BackForwardList*, WebBackForwardList*>& backForwardListWrappers()
     return staticBackForwardListWrappers;
 }
 
-WebBackForwardList::WebBackForwardList(BackForwardList* backForwardList)
+WebBackForwardList::WebBackForwardList(PassRefPtr<BackForwardList> backForwardList)
     : m_refCount(0)
     , m_backForwardList(backForwardList)
 {
-    ASSERT(!backForwardListWrappers().contains(m_backForwardList));
-    backForwardListWrappers().set(m_backForwardList, this);
+    ASSERT(!backForwardListWrappers().contains(m_backForwardList.get()));
+    backForwardListWrappers().set(m_backForwardList.get(), this);
 
     gClassCount++;
     gClassNameCount.add("WebBackForwardList");
@@ -63,18 +63,18 @@ WebBackForwardList::~WebBackForwardList()
 {
     ASSERT(m_backForwardList->closed());
 
-    ASSERT(backForwardListWrappers().contains(m_backForwardList));
-    backForwardListWrappers().remove(m_backForwardList);
+    ASSERT(backForwardListWrappers().contains(m_backForwardList.get()));
+    backForwardListWrappers().remove(m_backForwardList.get());
 
     gClassCount--;
     gClassNameCount.remove("WebBackForwardList");
 }
 
-WebBackForwardList* WebBackForwardList::createInstance(BackForwardList* backForwardList)
+WebBackForwardList* WebBackForwardList::createInstance(PassRefPtr<BackForwardList> backForwardList)
 {
     WebBackForwardList* instance;
 
-    instance = backForwardListWrappers().get(backForwardList);
+    instance = backForwardListWrappers().get(backForwardList.get());
 
     if (!instance)
         instance = new WebBackForwardList(backForwardList);
index 7103548..c317941 100644 (file)
@@ -40,9 +40,9 @@ namespace WebCore {
 class WebBackForwardList : public IWebBackForwardList, IWebBackForwardListPrivate
 {
 public:
-    static WebBackForwardList* createInstance(WebCore::BackForwardList*);
+    static WebBackForwardList* createInstance(PassRefPtr<WebCore::BackForwardList>);
 protected:
-    WebBackForwardList(WebCore::BackForwardList*);
+    WebBackForwardList(PassRefPtr<WebCore::BackForwardList>);
     ~WebBackForwardList();
 
 public:
@@ -109,7 +109,7 @@ public:
 
 protected:
     ULONG m_refCount;
-    WebCore::BackForwardList* m_backForwardList;
+    RefPtr<WebCore::BackForwardList> m_backForwardList;
 };
 
 #endif
index 634f63c..7657a6c 100644 (file)
@@ -3071,7 +3071,7 @@ HRESULT STDMETHODCALLTYPE WebView::backForwardList(
     if (!m_useBackForwardList)
         return E_FAIL;
  
-    *list = WebBackForwardList::createInstance(static_cast<WebCore::BackForwardList*>(&m_page->backForward().client()));
+    *list = WebBackForwardList::createInstance(static_cast<WebCore::BackForwardList*>(m_page->backForward().client()));
 
     return S_OK;
 }
@@ -3904,7 +3904,7 @@ HRESULT STDMETHODCALLTYPE WebView::canGoBack(
         /* [in] */ IUnknown* /*sender*/,
         /* [retval][out] */ BOOL* result)
 {
-    *result = !!(m_page->backForward().backItem() && !m_page->defersLoading());
+    *result = !!(m_page->backForward().client()->backItem() && !m_page->defersLoading());
     return S_OK;
 }
     
@@ -3919,7 +3919,7 @@ HRESULT STDMETHODCALLTYPE WebView::canGoForward(
         /* [in] */ IUnknown* /*sender*/,
         /* [retval][out] */ BOOL* result)
 {
-    *result = !!(m_page->backForward().forwardItem() && !m_page->defersLoading());
+    *result = !!(m_page->backForward().client()->forwardItem() && !m_page->defersLoading());
     return S_OK;
 }
     
@@ -5391,41 +5391,41 @@ HRESULT STDMETHODCALLTYPE WebView::addAdditionalPluginDirectory(
     return S_OK;
 }
 
-HRESULT STDMETHODCALLTYPE WebView::loadBackForwardListFromOtherView(
+HRESULT STDMETHODCALLTYPE WebView::loadBackForwardListFromOtherView( 
     /* [in] */ IWebView* otherView)
 {
     if (!m_page)
         return E_FAIL;
-
+    
     // It turns out the right combination of behavior is done with the back/forward load
-    // type. (See behavior matrix at the top of WebFramePrivate.) So we copy all the items
+    // type.  (See behavior matrix at the top of WebFramePrivate.)  So we copy all the items
     // in the back forward list, and go to the current one.
-    BackForwardController& backForward = m_page->backForward();
-    ASSERT(!backForward.currentItem()); // Destination list should be empty.
+    BackForwardClient* backForwardClient = m_page->backForward().client();
+    ASSERT(!backForwardClient->currentItem()); // destination list should be empty
 
     COMPtr<WebView> otherWebView;
     if (FAILED(otherView->QueryInterface(&otherWebView)))
         return E_FAIL;
-    BackForwardController& otherBackForward = otherWebView->m_page->backForward();
-    if (!otherBackForward.currentItem())
-        return S_OK; // If the back forward list is empty, bail.
-
+    BackForwardClient* otherBackForwardClient = otherWebView->m_page->backForward().client();
+    if (!otherBackForwardClient->currentItem())
+        return S_OK; // empty back forward list, bail
+    
     HistoryItem* newItemToGoTo = 0;
 
-    int lastItemIndex = otherBackForward.forwardCount();
-    for (int i = -otherBackForward.backCount(); i <= lastItemIndex; ++i) {
+    int lastItemIndex = otherBackForwardClient->forwardListCount();
+    for (int i = -otherBackForwardClient->backListCount(); i <= lastItemIndex; ++i) {
         if (!i) {
-            // If this item is showing, save away its current scroll and form state,
+            // If this item is showing , save away its current scroll and form state,
             // since that might have changed since loading and it is normally not saved
             // until we leave that page.
             otherWebView->m_page->mainFrame().loader().history().saveDocumentAndScrollState();
         }
-        RefPtr<HistoryItem> newItem = otherBackForward.itemAtIndex(i)->copy();
-        if (!i)
+        RefPtr<HistoryItem> newItem = otherBackForwardClient->itemAtIndex(i)->copy();
+        if (!i) 
             newItemToGoTo = newItem.get();
-        backForward.addItem(newItem.release());
+        backForwardClient->addItem(newItem.release());
     }
-
+    
     ASSERT(newItemToGoTo);
     m_page->goToItem(newItemToGoTo, FrameLoadTypeIndexedBackForward);
     return S_OK;
index 35f42be..d2cc7ea 100644 (file)
@@ -1,3 +1,28 @@
+2014-04-30  Alexey Proskuryakov  <ap@apple.com>
+
+        Roll out fix for https://bugs.webkit.org/show_bug.cgi?id=131637:
+        Clean up unnecessary methods in the BackForwardClient interface
+
+        It broke a regression test and an API test.
+
+        * WebKit2.xcodeproj/project.pbxproj:
+        * WebProcess/InjectedBundle/InjectedBundleBackForwardList.cpp:
+        (WebKit::InjectedBundleBackForwardList::clear):
+        * WebProcess/WebPage/WebBackForwardListProxy.cpp:
+        (WebKit::WebBackForwardListProxy::WebBackForwardListProxy):
+        (WebKit::WebBackForwardListProxy::addItem):
+        (WebKit::WebBackForwardListProxy::goToItem):
+        (WebKit::WebBackForwardListProxy::itemAtIndex):
+        (WebKit::WebBackForwardListProxy::backListCount):
+        (WebKit::WebBackForwardListProxy::forwardListCount):
+        (WebKit::WebBackForwardListProxy::close):
+        (WebKit::WebBackForwardListProxy::clear):
+        * WebProcess/WebPage/WebBackForwardListProxy.h:
+        (WebKit::WebBackForwardListProxy::create):
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::WebPage):
+        * WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm: Copied from Source/WebKit2/WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm.
+
 2014-04-30  Brady Eidson  <beidson@apple.com>
 
         Only reveal selection service UI after a short delay.
index e17a378..c2dd9cb 100644 (file)
                2DA944AE1884E9BA00ED86DB /* WebInspectorProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */; };
                2DA944AF1884E9BA00ED86DB /* WebPageProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */; };
                2DA944B01884E9BA00ED86DB /* WebProcessProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */; };
+               2DA944B91884EA3900ED86DB /* WebBackForwardListProxyIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */; };
                2DA944BA1884EA3C00ED86DB /* WebPageIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944B61884EA3500ED86DB /* WebPageIOS.mm */; };
                2DA944BD188511E700ED86DB /* NetworkProcessIOS.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */; };
                2DACE64E18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */; };
                2DA944AA1884E9BA00ED86DB /* WebInspectorProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebInspectorProxyIOS.mm; path = ios/WebInspectorProxyIOS.mm; sourceTree = "<group>"; };
                2DA944AB1884E9BA00ED86DB /* WebPageProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageProxyIOS.mm; path = ios/WebPageProxyIOS.mm; sourceTree = "<group>"; };
                2DA944AC1884E9BA00ED86DB /* WebProcessProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebProcessProxyIOS.mm; path = ios/WebProcessProxyIOS.mm; sourceTree = "<group>"; };
+               2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebBackForwardListProxyIOS.mm; path = ios/WebBackForwardListProxyIOS.mm; sourceTree = "<group>"; };
                2DA944B61884EA3500ED86DB /* WebPageIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WebPageIOS.mm; path = ios/WebPageIOS.mm; sourceTree = "<group>"; };
                2DA944BC188511E700ED86DB /* NetworkProcessIOS.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = NetworkProcessIOS.mm; path = NetworkProcess/ios/NetworkProcessIOS.mm; sourceTree = "<group>"; };
                2DACE64D18ADBFF000E4CA76 /* _WKThumbnailViewInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _WKThumbnailViewInternal.h; sourceTree = "<group>"; };
                2DA944B41884EA2A00ED86DB /* ios */ = {
                        isa = PBXGroup;
                        children = (
+                               2DA944B51884EA3500ED86DB /* WebBackForwardListProxyIOS.mm */,
                                2DA944B61884EA3500ED86DB /* WebPageIOS.mm */,
                                29232DF518B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.h */,
                                29232DF618B29DCE00D0596F /* WKAccessibilityWebPageObjectIOS.mm */,
                                2DA944A31884E4F000ED86DB /* WebTouchEventIOS.cpp in Sources */,
                                1A30EAC6115D7DA30053E937 /* ConnectionMac.cpp in Sources */,
                                5136183D163126DA00A99DDE /* ConnectionStack.cpp in Sources */,
+                               2DA944B91884EA3900ED86DB /* WebBackForwardListProxyIOS.mm in Sources */,
                                515E773318402D510007203F /* UniqueIDBDatabaseIdentifier.cpp in Sources */,
                                2DA049B7180CCD0A00AAFA9E /* GraphicsLayerCARemote.cpp in Sources */,
                                378E1A4D18208D700031007A /* WKNSURL.mm in Sources */,
index 717e986..e87905b 100644 (file)
@@ -73,7 +73,7 @@ void InjectedBundleBackForwardList::clear()
     Page* page = m_page->corePage();
     if (!page)
         return;
-    static_cast<WebBackForwardListProxy&>(page->backForward().client()).clear();
+    static_cast<WebBackForwardListProxy*>(page->backForward().client())->clear();
 }
 
 } // namespace WebKit
index 96806ef..11bb1a1 100644 (file)
@@ -132,7 +132,7 @@ void WebBackForwardListProxy::removeItem(uint64_t itemID)
     historyItemToIDMap().remove(item);
 }
 
-WebBackForwardListProxy::WebBackForwardListProxy(WebPage& page)
+WebBackForwardListProxy::WebBackForwardListProxy(WebPage* page)
     : m_page(page)
 {
     WebCore::notifyHistoryItemChanged = WK2NotifyHistoryItemChanged;
@@ -144,6 +144,9 @@ void WebBackForwardListProxy::addItem(PassRefPtr<HistoryItem> prpItem)
 
     ASSERT(!historyItemToIDMap().contains(item));
 
+    if (!m_page)
+        return;
+
     uint64_t itemID = generateHistoryItemID();
 
     ASSERT(!idToHistoryItemMap().contains(itemID));
@@ -154,32 +157,41 @@ void WebBackForwardListProxy::addItem(PassRefPtr<HistoryItem> prpItem)
     idToHistoryItemMap().set(itemID, item);
 
     updateBackForwardItem(itemID, item.get());
-    m_page.send(Messages::WebPageProxy::BackForwardAddItem(itemID));
+    m_page->send(Messages::WebPageProxy::BackForwardAddItem(itemID));
 }
 
 void WebBackForwardListProxy::goToItem(HistoryItem* item)
 {
+    if (!m_page)
+        return;
+
     SandboxExtension::Handle sandboxExtensionHandle;
-    m_page.sendSync(Messages::WebPageProxy::BackForwardGoToItem(historyItemToIDMap().get(item)), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));
-    m_page.sandboxExtensionTracker().beginLoad(m_page.mainWebFrame(), sandboxExtensionHandle);
+    m_page->sendSync(Messages::WebPageProxy::BackForwardGoToItem(historyItemToIDMap().get(item)), Messages::WebPageProxy::BackForwardGoToItem::Reply(sandboxExtensionHandle));
+    m_page->sandboxExtensionTracker().beginLoad(m_page->mainWebFrame(), sandboxExtensionHandle);
 }
 
 HistoryItem* WebBackForwardListProxy::itemAtIndex(int itemIndex)
 {
+    if (!m_page)
+        return 0;
+
     uint64_t itemID = 0;
-    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardItemAtIndex(itemIndex), Messages::WebPageProxy::BackForwardItemAtIndex::Reply(itemID), m_page.pageID()))
-        return nullptr;
+    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardItemAtIndex(itemIndex), Messages::WebPageProxy::BackForwardItemAtIndex::Reply(itemID), m_page->pageID()))
+        return 0;
 
     if (!itemID)
-        return nullptr;
+        return 0;
 
     return idToHistoryItemMap().get(itemID);
 }
 
 int WebBackForwardListProxy::backListCount()
 {
+    if (!m_page)
+        return 0;
+
     int backListCount = 0;
-    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardBackListCount(), Messages::WebPageProxy::BackForwardBackListCount::Reply(backListCount), m_page.pageID()))
+    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardBackListCount(), Messages::WebPageProxy::BackForwardBackListCount::Reply(backListCount), m_page->pageID()))
         return 0;
 
     return backListCount;
@@ -187,8 +199,11 @@ int WebBackForwardListProxy::backListCount()
 
 int WebBackForwardListProxy::forwardListCount()
 {
+    if (!m_page)
+        return 0;
+
     int forwardListCount = 0;
-    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardForwardListCount(), Messages::WebPageProxy::BackForwardForwardListCount::Reply(forwardListCount), m_page.pageID()))
+    if (!WebProcess::shared().parentProcessConnection()->sendSync(Messages::WebPageProxy::BackForwardForwardListCount(), Messages::WebPageProxy::BackForwardForwardListCount::Reply(forwardListCount), m_page->pageID()))
         return 0;
 
     return forwardListCount;
@@ -201,6 +216,8 @@ void WebBackForwardListProxy::close()
         WebCore::pageCache()->remove(itemForID(*i));
 
     m_associatedItemIDs.clear();
+
+    m_page = 0;
 }
 
 bool WebBackForwardListProxy::isActive()
@@ -211,7 +228,7 @@ bool WebBackForwardListProxy::isActive()
 
 void WebBackForwardListProxy::clear()
 {
-    m_page.send(Messages::WebPageProxy::BackForwardClear());
+    m_page->send(Messages::WebPageProxy::BackForwardClear());
 }
 
 } // namespace WebKit
index a484e58..e47eed7 100644 (file)
@@ -35,8 +35,8 @@ namespace WebKit {
 class WebPage;
 
 class WebBackForwardListProxy : public WebCore::BackForwardClient {
-public:
-    explicit WebBackForwardListProxy(WebPage&);
+public: 
+    static PassRefPtr<WebBackForwardListProxy> create(WebPage* page) { return adoptRef(new WebBackForwardListProxy(page)); }
 
     static WebCore::HistoryItem* itemForID(uint64_t);
     static uint64_t idForItem(WebCore::HistoryItem*);
@@ -44,15 +44,16 @@ public:
 
     static void addItemFromUIProcess(uint64_t itemID, PassRefPtr<WebCore::HistoryItem>);
     static void setHighestItemIDFromUIProcess(uint64_t itemID);
-
+    
     void clear();
 
 private:
+    WebBackForwardListProxy(WebPage*);
 
     virtual void addItem(PassRefPtr<WebCore::HistoryItem>);
 
     virtual void goToItem(WebCore::HistoryItem*);
-
+        
     virtual WebCore::HistoryItem* itemAtIndex(int);
     virtual int backListCount();
     virtual int forwardListCount();
@@ -61,7 +62,13 @@ private:
 
     virtual void close();
 
-    WebPage& m_page;
+#if PLATFORM(IOS)
+    virtual unsigned current() override;
+    virtual void setCurrent(unsigned newCurrent) override;
+    virtual bool clearAllPageCaches() override;
+#endif
+
+    WebPage* m_page;
     HashSet<uint64_t> m_associatedItemIDs;
 };
 
index 107dc52..d5d71b9 100644 (file)
@@ -328,7 +328,7 @@ WebPage::WebPage(uint64_t pageID, const WebPageCreationParameters& parameters)
 #if ENABLE(DRAG_SUPPORT)
     pageClients.dragClient = new WebDragClient(this);
 #endif
-    pageClients.backForwardClient = std::make_unique<WebBackForwardListProxy>(*this);
+    pageClients.backForwardClient = WebBackForwardListProxy::create(this);
 #if ENABLE(INSPECTOR)
     m_inspectorClient = new WebInspectorClient(this);
     pageClients.inspectorClient = m_inspectorClient;
diff --git a/Source/WebKit2/WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm b/Source/WebKit2/WebProcess/WebPage/ios/WebBackForwardListProxyIOS.mm
new file mode 100644 (file)
index 0000000..5da7c9a
--- /dev/null
@@ -0,0 +1,54 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "config.h"
+#import "WebBackForwardListProxy.h"
+
+#if PLATFORM(IOS)
+
+#import <WebCore/NotImplemented.h>
+
+namespace WebKit {
+
+unsigned WebBackForwardListProxy::current()
+{
+    notImplemented();
+    return 0;
+}
+
+void WebBackForwardListProxy::setCurrent(unsigned)
+{
+    notImplemented();
+}
+
+bool WebBackForwardListProxy::clearAllPageCaches()
+{
+    notImplemented();
+    return false;
+}
+
+} // namespace WebKit
+
+#endif // PLATFORM(IOS)