Changeset 20837 in webkit


Ignore:
Timestamp:
Apr 10, 2007 4:55:56 PM (17 years ago)
Author:
beidson
Message:

WebCore:

Reviewed by Darin

<rdar://problem/4887095> - PageCache and PageState should be combined

These two objects are a relic of when the PageCache was split between WebCore and WebKit
It just makes good sense to combine them now, and the new object is more appropriately
called "CachedPage"

This patch is vast in scope, but simple in depth - anywhere a PageCache or PageState object
was used has been adjusted to use a CachedPage object instead. The most notable change is
that HistoryItem - which always used to have a PageCache object which may or may not have
had a PageState - now may or may not have a CachedPage. This actually simplifies the
HistoryItem code a bit while making the role of CachedPage much more clear.

  • WebCore.exp:
  • WebCore.xcodeproj/project.pbxproj:
  • history/BackForwardList.cpp: (WebCore::BackForwardList::addItem): (WebCore::BackForwardList::setCapacity): (WebCore::BackForwardList::setPageCacheSize): (WebCore::BackForwardList::clearPageCache): (WebCore::BackForwardList::close):
  • history/PageCache.cpp: Removed.
  • history/PageCache.h: Removed.
  • page/PageState.cpp: Removed.
  • page/PageState.h: Removed.
  • history/CachedPage.cpp: Added. (WebCore::CachedPage::create): (WebCore::CachedPage::CachedPage): (WebCore::CachedPage::~CachedPage): (WebCore::CachedPage::restore): (WebCore::CachedPage::clear): (WebCore::CachedPage::setDocumentLoader): (WebCore::CachedPage::documentLoader): (WebCore::CachedPage::setTimeStamp): (WebCore::CachedPage::setTimeStampToNow): (WebCore::CachedPage::timeStamp):
  • history/CachedPage.h: Added. (WebCore::CachedPage::document): (WebCore::CachedPage::mousePressNode): (WebCore::CachedPage::URL):
  • history/HistoryItem.cpp: (WebCore::HistoryItem::HistoryItem): (WebCore::HistoryItem::setCachedPage): (WebCore::HistoryItem::setURL): (WebCore::HistoryItem::alwaysAttemptToUseCachedPage): (WebCore::HistoryItem::setAlwaysAttemptToUseCachedPage): (WebCore::HistoryItem::cachedPage): (WebCore::cachedPagesPendingRelease): (WebCore::HistoryItem::releaseCachedPagesOrReschedule): (WebCore::HistoryItem::releaseAllPendingCachedPages): (WebCore::HistoryItem::scheduleCachedPageForRelease):
  • history/HistoryItem.h:
  • history/mac/HistoryItemMac.mm:
  • history/HistoryItemTimer.cpp: (WebCore::HistoryItemTimer::HistoryItemTimer): (WebCore::HistoryItemTimer::callReleaseCachedPagesOrReschedule):
  • history/HistoryItemTimer.h:
  • history/mac/PageCacheMac.mm: Removed.
  • history/mac/CachedPageMac.mm: Added. (WebCore::CachedPage::close): (WebCore::CachedPage::setDocumentView): (WebCore::CachedPage::documentView):
  • loader/DocumentLoader.cpp: (WebCore::DocumentLoader::DocumentLoader): (WebCore::DocumentLoader::loadFromCachedPage): (WebCore::DocumentLoader::setLoadingFromCachedPage): (WebCore::DocumentLoader::isLoadingFromCachedPage):
  • loader/DocumentLoader.h:
  • loader/FrameLoader.cpp: (WebCore::FrameLoader::provisionalLoadStarted): (WebCore::FrameLoader::commitProvisionalLoad): (WebCore::FrameLoader::transitionToCommitted): (WebCore::FrameLoader::open): (WebCore::FrameLoader::startLoading): (WebCore::FrameLoader::receivedMainResourceError): (WebCore::FrameLoader::opened): (WebCore::FrameLoader::continueLoadAfterNavigationPolicy): (WebCore::FrameLoader::loadProvisionalItemFromCachedPage): (WebCore::FrameLoader::cachePageToHistoryItem): (WebCore::FrameLoader::createHistoryItem): (WebCore::FrameLoader::purgePageCache): (WebCore::FrameLoader::invalidateCurrentItemCachedPage): (WebCore::FrameLoader::loadItem): (WebCore::FrameLoader::updateHistoryForStandardLoad): (WebCore::FrameLoader::updateHistoryForClientRedirect): (WebCore::FrameLoader::updateHistoryForBackForwardNavigation): (WebCore::FrameLoader::updateHistoryForReload): (WebCore::FrameLoader::updateHistoryForInternalLoad): (WebCore::FrameLoader::updateHistoryForCommit):
  • loader/FrameLoader.h:
  • loader/FrameLoaderClient.h:
  • page/mac/WebCoreFrameBridge.h: Got rid of unused WebCorePageCacheStateKey
  • page/mac/WebCoreFrameBridge.mm: Ditto
  • platform/graphics/svg/SVGImage.cpp:
  • platform/graphics/svg/SVGImageEmptyClients.h: Update to reflect the new names (WebCore::SVGEmptyFrameLoaderClient::loadProvisionalItemFromCachedPage): (WebCore::SVGEmptyFrameLoaderClient::invalidateCurrentItemCachedPage): (WebCore::SVGEmptyFrameLoaderClient::loadedFromCachedPage): (WebCore::SVGEmptyFrameLoaderClient::clearLoadingFromCachedPage): (WebCore::SVGEmptyFrameLoaderClient::isLoadingFromCachedPage): (WebCore::SVGEmptyFrameLoaderClient::setDocumentViewFromCachedPage): (WebCore::SVGEmptyFrameLoaderClient::saveDocumentViewToCachedPage):

WebKit:

Reviewed by Darin

<rdar://problem/4887095> - PageCache and PageState should be combined

WebKit side of the change to reflect the new object name of CachedPage and new Client method names

  • History/WebHistoryItem.mm: (-[WebHistoryItem setAlwaysAttemptToUsePageCache:]): (+[WebHistoryItem _releaseAllPendingPageCaches]): (-[WebWindowWatcher windowWillClose:]):
  • WebCoreSupport/WebFrameLoaderClient.h:
  • WebCoreSupport/WebFrameLoaderClient.mm: (WebFrameLoaderClient::setDocumentViewFromCachedPage): (WebFrameLoaderClient::loadedFromCachedPage): (WebFrameLoaderClient::saveDocumentViewToCachedPage):
Location:
trunk
Files:
2 deleted
22 edited
3 moved

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r20834 r20837  
     12007-04-10  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Darin
     4
     5        <rdar://problem/4887095> - PageCache and PageState should be combined
     6
     7        These two objects are a relic of when the PageCache was split between WebCore and WebKit
     8        It just makes good sense to combine them now, and the new object is more appropriately
     9        called "CachedPage"
     10
     11        This patch is vast in scope, but simple in depth - anywhere a PageCache or PageState object
     12        was used has been adjusted to use a CachedPage object instead.  The most notable change is
     13        that HistoryItem - which always used to have a PageCache object which may or may not have
     14        had a PageState - now may or may not have a CachedPage.  This actually simplifies the
     15        HistoryItem code a bit while making the role of CachedPage much more clear.
     16
     17        * WebCore.exp:
     18        * WebCore.xcodeproj/project.pbxproj:
     19
     20        * history/BackForwardList.cpp:
     21        (WebCore::BackForwardList::addItem):
     22        (WebCore::BackForwardList::setCapacity):
     23        (WebCore::BackForwardList::setPageCacheSize):
     24        (WebCore::BackForwardList::clearPageCache):
     25        (WebCore::BackForwardList::close):
     26
     27        * history/PageCache.cpp: Removed.
     28        * history/PageCache.h: Removed.
     29        * page/PageState.cpp: Removed.
     30        * page/PageState.h: Removed.
     31        * history/CachedPage.cpp: Added.
     32        (WebCore::CachedPage::create):
     33        (WebCore::CachedPage::CachedPage):
     34        (WebCore::CachedPage::~CachedPage):
     35        (WebCore::CachedPage::restore):
     36        (WebCore::CachedPage::clear):
     37        (WebCore::CachedPage::setDocumentLoader):
     38        (WebCore::CachedPage::documentLoader):
     39        (WebCore::CachedPage::setTimeStamp):
     40        (WebCore::CachedPage::setTimeStampToNow):
     41        (WebCore::CachedPage::timeStamp):
     42        * history/CachedPage.h: Added.
     43        (WebCore::CachedPage::document):
     44        (WebCore::CachedPage::mousePressNode):
     45        (WebCore::CachedPage::URL):
     46
     47        * history/HistoryItem.cpp:
     48        (WebCore::HistoryItem::HistoryItem):
     49        (WebCore::HistoryItem::setCachedPage):
     50        (WebCore::HistoryItem::setURL):
     51        (WebCore::HistoryItem::alwaysAttemptToUseCachedPage):
     52        (WebCore::HistoryItem::setAlwaysAttemptToUseCachedPage):
     53        (WebCore::HistoryItem::cachedPage):
     54        (WebCore::cachedPagesPendingRelease):
     55        (WebCore::HistoryItem::releaseCachedPagesOrReschedule):
     56        (WebCore::HistoryItem::releaseAllPendingCachedPages):
     57        (WebCore::HistoryItem::scheduleCachedPageForRelease):
     58        * history/HistoryItem.h:
     59        * history/mac/HistoryItemMac.mm:
     60
     61        * history/HistoryItemTimer.cpp:
     62        (WebCore::HistoryItemTimer::HistoryItemTimer):
     63        (WebCore::HistoryItemTimer::callReleaseCachedPagesOrReschedule):
     64        * history/HistoryItemTimer.h:
     65
     66        * history/mac/PageCacheMac.mm: Removed.
     67        * history/mac/CachedPageMac.mm: Added.
     68        (WebCore::CachedPage::close):
     69        (WebCore::CachedPage::setDocumentView):
     70        (WebCore::CachedPage::documentView):
     71
     72        * loader/DocumentLoader.cpp:
     73        (WebCore::DocumentLoader::DocumentLoader):
     74        (WebCore::DocumentLoader::loadFromCachedPage):
     75        (WebCore::DocumentLoader::setLoadingFromCachedPage):
     76        (WebCore::DocumentLoader::isLoadingFromCachedPage):
     77        * loader/DocumentLoader.h:
     78
     79        * loader/FrameLoader.cpp:
     80        (WebCore::FrameLoader::provisionalLoadStarted):
     81        (WebCore::FrameLoader::commitProvisionalLoad):
     82        (WebCore::FrameLoader::transitionToCommitted):
     83        (WebCore::FrameLoader::open):
     84        (WebCore::FrameLoader::startLoading):
     85        (WebCore::FrameLoader::receivedMainResourceError):
     86        (WebCore::FrameLoader::opened):
     87        (WebCore::FrameLoader::continueLoadAfterNavigationPolicy):
     88        (WebCore::FrameLoader::loadProvisionalItemFromCachedPage):
     89        (WebCore::FrameLoader::cachePageToHistoryItem):
     90        (WebCore::FrameLoader::createHistoryItem):
     91        (WebCore::FrameLoader::purgePageCache):
     92        (WebCore::FrameLoader::invalidateCurrentItemCachedPage):
     93        (WebCore::FrameLoader::loadItem):
     94        (WebCore::FrameLoader::updateHistoryForStandardLoad):
     95        (WebCore::FrameLoader::updateHistoryForClientRedirect):
     96        (WebCore::FrameLoader::updateHistoryForBackForwardNavigation):
     97        (WebCore::FrameLoader::updateHistoryForReload):
     98        (WebCore::FrameLoader::updateHistoryForInternalLoad):
     99        (WebCore::FrameLoader::updateHistoryForCommit):
     100        * loader/FrameLoader.h:
     101        * loader/FrameLoaderClient.h:
     102
     103        * page/mac/WebCoreFrameBridge.h: Got rid of unused WebCorePageCacheStateKey
     104        * page/mac/WebCoreFrameBridge.mm: Ditto
     105
     106        * platform/graphics/svg/SVGImage.cpp:
     107        * platform/graphics/svg/SVGImageEmptyClients.h: Update to reflect the new names
     108        (WebCore::SVGEmptyFrameLoaderClient::loadProvisionalItemFromCachedPage):
     109        (WebCore::SVGEmptyFrameLoaderClient::invalidateCurrentItemCachedPage):
     110        (WebCore::SVGEmptyFrameLoaderClient::loadedFromCachedPage):
     111        (WebCore::SVGEmptyFrameLoaderClient::clearLoadingFromCachedPage):
     112        (WebCore::SVGEmptyFrameLoaderClient::isLoadingFromCachedPage):
     113        (WebCore::SVGEmptyFrameLoaderClient::setDocumentViewFromCachedPage):
     114        (WebCore::SVGEmptyFrameLoaderClient::saveDocumentViewToCachedPage):
     115
    11162007-04-10  Antti Koivisto  <antti@apple.com>
    2117
  • trunk/WebCore/WebCore.exp

    r20820 r20837  
    122122_WebCoreFindFont
    123123_WebCoreObjCFinalizeOnMainThread
    124 _WebCorePageCacheStateKey
    125124_WebCoreSetAlwaysUseATSU
    126125_WebCoreSetShouldUseFontSmoothing
     
    128127_WebCoreTextFloatWidth
    129128__Z26ReportBlockedObjCExceptionP11NSException
     129__ZN7WebCore10CachedPage12documentViewEv
     130__ZN7WebCore10CachedPage14documentLoaderEv
     131__ZN7WebCore10CachedPage15setDocumentViewEP11objc_object
     132__ZN7WebCore10CachedPageD1Ev
    130133__ZN7WebCore10EventNames10clickEventE
    131134__ZN7WebCore10EventNames12keydownEventE
     
    170173__ZN7WebCore11HistoryItem12setURLStringERKNS_6StringE
    171174__ZN7WebCore11HistoryItem12setViewStateEP11objc_object
     175__ZN7WebCore11HistoryItem13setCachedPageEN3WTF10PassRefPtrINS_10CachedPageEEE
    172176__ZN7WebCore11HistoryItem13setVisitCountEi
    173177__ZN7WebCore11HistoryItem14setScrollPointERKNS_8IntPointE
    174 __ZN7WebCore11HistoryItem15setHasPageCacheEb
    175178__ZN7WebCore11HistoryItem15setIsTargetItemEb
    176179__ZN7WebCore11HistoryItem17setAlternateTitleERKNS_6StringE
     
    181184__ZN7WebCore11HistoryItem22mergeAutoCompleteHintsEPS0_
    182185__ZN7WebCore11HistoryItem23recurseToFindTargetItemEv
    183 __ZN7WebCore11HistoryItem27releaseAllPendingPageCachesEv
    184 __ZN7WebCore11HistoryItem30setAlwaysAttemptToUsePageCacheEb
     186__ZN7WebCore11HistoryItem31setAlwaysAttemptToUseCachedPageEb
     187__ZN7WebCore11HistoryItem34performPendingReleaseOfCachedPagesEv
    185188__ZN7WebCore11HistoryItem6setURLERKNS_4KURLE
    186189__ZN7WebCore11HistoryItem8formDataEv
    187190__ZN7WebCore11HistoryItem8setTitleERKNS_6StringE
    188 __ZN7WebCore11HistoryItem9pageCacheEv
    189191__ZN7WebCore11HistoryItem9setParentERKNS_6StringE
    190192__ZN7WebCore11HistoryItem9setTargetERKNS_6StringE
     
    466468__ZN7WebCore9HTMLNames7srcAttrE
    467469__ZN7WebCore9HTMLNames8hrefAttrE
    468 __ZN7WebCore9PageCache12documentViewEv
    469 __ZN7WebCore9PageCache12setPageStateEN3WTF10PassRefPtrINS_9PageStateEEE
    470 __ZN7WebCore9PageCache14documentLoaderEv
    471 __ZN7WebCore9PageCache15setDocumentViewEP11objc_object
    472 __ZN7WebCore9PageCache17setDocumentLoaderEN3WTF10PassRefPtrINS_14DocumentLoaderEEE
    473 __ZN7WebCore9PageCache17setTimeStampToNowEv
    474 __ZN7WebCore9PageCache9pageStateEv
    475 __ZN7WebCore9PageCacheD1Ev
    476 __ZN7WebCore9PageState5clearEv
    477 __ZN7WebCore9PageState6createEPNS_4PageE
    478 __ZN7WebCore9PageStateD1Ev
    479470__ZN7WebCore9Selection22expandUsingGranularityENS_15TextGranularityE
    480471__ZN7WebCore9TimerBase4stopEv
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r20794 r20837  
    304304                4E19592D0A39DACC00220FE5 /* MediaQueryExp.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */; };
    305305                4E19592E0A39DACC00220FE5 /* MediaQueryExp.h in Headers */ = {isa = PBXBuildFile; fileRef = 4E1959280A39DACC00220FE5 /* MediaQueryExp.h */; };
    306                 510184690B08602A004A825F /* PageCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* PageCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
    307                 5101846A0B08602A004A825F /* PageCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* PageCache.cpp */; };
     306                510184690B08602A004A825F /* CachedPage.h in Headers */ = {isa = PBXBuildFile; fileRef = 510184670B08602A004A825F /* CachedPage.h */; settings = {ATTRIBUTES = (Private, ); }; };
     307                5101846A0B08602A004A825F /* CachedPage.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510184680B08602A004A825F /* CachedPage.cpp */; };
    308308                510F735F0B56C08800A3002A /* AuthenticationChallenge.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */; };
    309309                510F73600B56C08800A3002A /* AuthenticationChallenge.h in Headers */ = {isa = PBXBuildFile; fileRef = 510F735A0B56C08800A3002A /* AuthenticationChallenge.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    321321                5160F1FE0B0A7EF400C1D2AF /* HistoryItemTimer.h in Headers */ = {isa = PBXBuildFile; fileRef = 5160F1FC0B0A7EF400C1D2AF /* HistoryItemTimer.h */; };
    322322                5160F1FF0B0A7EF400C1D2AF /* HistoryItemTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 5160F1FD0B0A7EF400C1D2AF /* HistoryItemTimer.cpp */; };
    323                 5160F3BC0B0A99C900C1D2AF /* PageCacheMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160F3BB0B0A99C900C1D2AF /* PageCacheMac.mm */; };
     323                5160F3BC0B0A99C900C1D2AF /* CachedPageMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160F3BB0B0A99C900C1D2AF /* CachedPageMac.mm */; };
    324324                5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */; };
    325325                51741D0F0B07259A00ED442C /* BackForwardList.h in Headers */ = {isa = PBXBuildFile; fileRef = 51741D0B0B07259A00ED442C /* BackForwardList.h */; settings = {ATTRIBUTES = (Private, ); }; };
     
    15571557                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */; };
    15581558                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */; };
    1559                 93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E22A6E0AF5E94100D48324 /* PageState.cpp */; };
    1560                 93E22A730AF5E94C00D48324 /* PageState.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E22A720AF5E94C00D48324 /* PageState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15611559                93E241FF0B2B4E4000C732A1 /* HTMLFrameOwnerElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 93E241FE0B2B4E4000C732A1 /* HTMLFrameOwnerElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
    15621560                93E2425F0B2B509500C732A1 /* HTMLFrameOwnerElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93E2425E0B2B509500C732A1 /* HTMLFrameOwnerElement.cpp */; };
     
    34163414                4E1959270A39DACC00220FE5 /* MediaQueryExp.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = MediaQueryExp.cpp; sourceTree = "<group>"; };
    34173415                4E1959280A39DACC00220FE5 /* MediaQueryExp.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = MediaQueryExp.h; sourceTree = "<group>"; };
    3418                 510184670B08602A004A825F /* PageCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageCache.h; sourceTree = "<group>"; };
    3419                 510184680B08602A004A825F /* PageCache.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageCache.cpp; sourceTree = "<group>"; };
     3416                510184670B08602A004A825F /* CachedPage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CachedPage.h; sourceTree = "<group>"; };
     3417                510184680B08602A004A825F /* CachedPage.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CachedPage.cpp; sourceTree = "<group>"; };
    34203418                510F73590B56C08800A3002A /* AuthenticationChallenge.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = AuthenticationChallenge.cpp; sourceTree = "<group>"; };
    34213419                510F735A0B56C08800A3002A /* AuthenticationChallenge.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = AuthenticationChallenge.h; sourceTree = "<group>"; };
     
    34353433                5160F1FC0B0A7EF400C1D2AF /* HistoryItemTimer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HistoryItemTimer.h; sourceTree = "<group>"; };
    34363434                5160F1FD0B0A7EF400C1D2AF /* HistoryItemTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HistoryItemTimer.cpp; sourceTree = "<group>"; };
    3437                 5160F3BB0B0A99C900C1D2AF /* PageCacheMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PageCacheMac.mm; path = mac/PageCacheMac.mm; sourceTree = "<group>"; };
     3435                5160F3BB0B0A99C900C1D2AF /* CachedPageMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = CachedPageMac.mm; path = mac/CachedPageMac.mm; sourceTree = "<group>"; };
    34383436                5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = HistoryItemMac.mm; path = mac/HistoryItemMac.mm; sourceTree = "<group>"; };
    34393437                51741D0B0B07259A00ED442C /* BackForwardList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BackForwardList.h; sourceTree = "<group>"; };
     
    46564654                93E227DE0AF589AD00D48324 /* ResourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResourceLoader.cpp; sourceTree = "<group>"; };
    46574655                93E227DF0AF589AD00D48324 /* SubresourceLoader.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SubresourceLoader.cpp; sourceTree = "<group>"; };
    4658                 93E22A6E0AF5E94100D48324 /* PageState.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageState.cpp; sourceTree = "<group>"; };
    4659                 93E22A720AF5E94C00D48324 /* PageState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PageState.h; sourceTree = "<group>"; };
    46604656                93E241FE0B2B4E4000C732A1 /* HTMLFrameOwnerElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLFrameOwnerElement.h; sourceTree = "<group>"; };
    46614657                93E2425E0B2B509500C732A1 /* HTMLFrameOwnerElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLFrameOwnerElement.cpp; sourceTree = "<group>"; };
     
    67616757                        isa = PBXGroup;
    67626758                        children = (
    6763                                 5160F3BB0B0A99C900C1D2AF /* PageCacheMac.mm */,
     6759                                5160F3BB0B0A99C900C1D2AF /* CachedPageMac.mm */,
    67646760                                5160F4970B0AA75F00C1D2AF /* HistoryItemMac.mm */,
    67656761                        );
     
    67736769                                51741D0B0B07259A00ED442C /* BackForwardList.h */,
    67746770                                51741D0C0B07259A00ED442C /* BackForwardList.cpp */,
     6771                                510184670B08602A004A825F /* CachedPage.h */,
     6772                                510184680B08602A004A825F /* CachedPage.cpp */,
    67756773                                51741D0D0B07259A00ED442C /* HistoryItem.h */,
    67766774                                51741D0E0B07259A00ED442C /* HistoryItem.cpp */,
    67776775                                5160F1FC0B0A7EF400C1D2AF /* HistoryItemTimer.h */,
    67786776                                5160F1FD0B0A7EF400C1D2AF /* HistoryItemTimer.cpp */,
    6779                                 510184670B08602A004A825F /* PageCache.h */,
    6780                                 510184680B08602A004A825F /* PageCache.cpp */,
    67816777                        );
    67826778                        path = history;
     
    69876983                                65FEA86809833ADE00BED4AB /* Page.cpp */,
    69886984                                65A21467097A329100B9050A /* Page.h */,
    6989                                 93E22A6E0AF5E94100D48324 /* PageState.cpp */,
    6990                                 93E22A720AF5E94C00D48324 /* PageState.h */,
    69916985                                65D1C1C909932B22000CB324 /* Plugin.h */,
    69926986                                F587863A02DE3A1401EA4122 /* Settings.h */,
     
    1108611080                                148AFDA50AF58360008CC700 /* ExceptionHandlers.h in Headers */,
    1108711081                                148A00110AF59F3F008CC700 /* FontPlatformData.h in Headers */,
    11088                                 93E22A730AF5E94C00D48324 /* PageState.h in Headers */,
    1108911082                                658821660AF4CDF700F01D1F /* ResourceResponse.h in Headers */,
    1109011083                                93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */,
     
    1112211115                                51741D0F0B07259A00ED442C /* BackForwardList.h in Headers */,
    1112311116                                51741D110B07259A00ED442C /* HistoryItem.h in Headers */,
    11124                                 510184690B08602A004A825F /* PageCache.h in Headers */,
     11117                                510184690B08602A004A825F /* CachedPage.h in Headers */,
    1112511118                                5160F1FE0B0A7EF400C1D2AF /* HistoryItemTimer.h in Headers */,
    1112611119                                93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */,
     
    1241312406                                93E227E30AF589AD00D48324 /* ResourceLoader.cpp in Sources */,
    1241412407                                93E227E40AF589AD00D48324 /* SubresourceLoader.cpp in Sources */,
    12415                                 93E22A6F0AF5E94100D48324 /* PageState.cpp in Sources */,
    1241612408                                4B2709830AF2E5E00065127F /* PasteboardMac.mm in Sources */,
    1241712409                                650E3F6A0AF6C168001FA3AD /* ResourceRequestMac.mm in Sources */,
     
    1246712459                                51741D100B07259A00ED442C /* BackForwardList.cpp in Sources */,
    1246812460                                51741D120B07259A00ED442C /* HistoryItem.cpp in Sources */,
    12469                                 5101846A0B08602A004A825F /* PageCache.cpp in Sources */,
     12461                                5101846A0B08602A004A825F /* CachedPage.cpp in Sources */,
    1247012462                                5160F1FF0B0A7EF400C1D2AF /* HistoryItemTimer.cpp in Sources */,
    12471                                 5160F3BC0B0A99C900C1D2AF /* PageCacheMac.mm in Sources */,
     12463                                5160F3BC0B0A99C900C1D2AF /* CachedPageMac.mm in Sources */,
    1247212464                                5160F4980B0AA75F00C1D2AF /* HistoryItemMac.mm in Sources */,
    1247312465                                93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */,
  • trunk/WebCore/history/BackForwardList.cpp

    r19889 r20837  
    2727#include "BackForwardList.h"
    2828
     29#include "CachedPage.h"
    2930#include "HistoryItem.h"
    3031#include "Logging.h"
     
    6465            m_entries.removeLast();
    6566            m_entryHash.remove(item);
    66             item->setHasPageCache(false);
     67            item->setCachedPage(0);
    6768        }
    6869    }
     
    7475        m_entries.remove(0);
    7576        m_entryHash.remove(item);
    76         item->setHasPageCache(false);
     77        item->setCachedPage(0);
    7778        m_current--;
    7879    }
     
    168169        m_entries.removeLast();
    169170        m_entryHash.remove(item);
    170         item->setHasPageCache(false);
     171        item->setCachedPage(0);
    171172    }
    172173
     
    183184    else if (size < m_pageCacheSize) {
    184185        for (signed i = m_current - size - 1; i > -1; --i)
    185             m_entries[i]->setHasPageCache(false);
    186         HistoryItem::releaseAllPendingPageCaches();
     186            m_entries[i]->setCachedPage(0);
     187        HistoryItem::performPendingReleaseOfCachedPages();
    187188    }
    188189   
     
    200201        // Don't clear the current item.  Objects are still in use.
    201202        if (i != m_current)
    202             m_entries[i]->setHasPageCache(false);
    203     }
    204    
    205     HistoryItem::releaseAllPendingPageCaches();
     203            m_entries[i]->setCachedPage(0);
     204    }
     205   
     206    HistoryItem::performPendingReleaseOfCachedPages();
    206207}
    207208
     
    242243    int size = m_entries.size();
    243244    for (int i = 0; i < size; ++i)
    244         m_entries[i]->setHasPageCache(false);
     245        m_entries[i]->setCachedPage(0);
    245246    m_entries.clear();
    246247    m_entryHash.clear();
  • trunk/WebCore/history/CachedPage.cpp

    r20836 r20837  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2525
    2626#include "config.h"
    27 #include "PageCache.h"
     27#include "CachedPage.h"
    2828
    29 #include "PageState.h"
     29#include "Document.h"
     30#include "Element.h"
     31#include "EventHandler.h"
     32#include "FocusController.h"
     33#include "Frame.h"
     34#include "FrameLoader.h"
     35#include "FrameView.h"
     36#include "Page.h"
    3037#include "SystemTime.h"
     38#if ENABLE(SVG)
     39#include "SVGDocumentExtensions.h"
     40#endif
     41
     42#include "kjs_proxy.h"
     43#include "kjs_window.h"
     44#include "kjs_window.h"
     45#include <kjs/JSLock.h>
     46#include <kjs/SavedBuiltins.h>
     47#include <kjs/property_map.h>
     48
     49using namespace KJS;
    3150
    3251namespace WebCore {
    3352
    34 PageCache::PageCache()
    35     : m_timeStamp(0)
     53PassRefPtr<CachedPage> CachedPage::create(Page* page)
    3654{
     55    return new CachedPage(page);
    3756}
    3857
    39 void PageCache::setPageState(PassRefPtr<PageState> pageState)
     58CachedPage::CachedPage(Page* page)
     59    : m_timeStamp(0)
     60    , m_document(page->mainFrame()->document())
     61    , m_view(page->mainFrame()->view())
     62    , m_mousePressNode(page->mainFrame()->eventHandler()->mousePressNode())
     63    , m_URL(page->mainFrame()->loader()->url())
     64    , m_windowProperties(new SavedProperties)
     65    , m_locationProperties(new SavedProperties)
     66    , m_interpreterBuiltins(new SavedBuiltins)
    4067{
    41     m_pageState = pageState;
     68    Frame* mainFrame = page->mainFrame();
     69    KJSProxy* proxy = mainFrame->scriptProxy();
     70    Window* window = Window::retrieveWindow(mainFrame);
     71
     72    mainFrame->clearTimers();
     73
     74    JSLock lock;
     75
     76    if (proxy && window) {
     77        proxy->interpreter()->saveBuiltins(*m_interpreterBuiltins.get());
     78        window->saveProperties(*m_windowProperties.get());
     79        window->location()->saveProperties(*m_locationProperties.get());
     80        m_pausedTimeouts.set(window->pauseTimeouts());
     81    }
     82
     83    m_document->setInPageCache(true);
     84
     85#if ENABLE(SVG)
     86    if (m_document && m_document->svgExtensions())
     87        m_document->accessSVGExtensions()->pauseAnimations();
     88#endif
    4289}
    4390
    44 PageCache::~PageCache()
     91CachedPage::~CachedPage()
    4592{
    4693    close();
    4794}
    4895
    49 PageState* PageCache::pageState()
     96void CachedPage::restore(Page* page)
    5097{
    51     return m_pageState.get();
     98    Frame* mainFrame = page->mainFrame();
     99    KJSProxy* proxy = mainFrame->scriptProxy();
     100    Window* window = Window::retrieveWindow(mainFrame);
     101
     102    JSLock lock;
     103
     104    if (proxy && window) {
     105        proxy->interpreter()->restoreBuiltins(*m_interpreterBuiltins.get());
     106        window->restoreProperties(*m_windowProperties.get());
     107        window->location()->restoreProperties(*m_locationProperties.get());
     108        window->resumeTimeouts(m_pausedTimeouts.get());
     109    }
     110
     111#if ENABLE(SVG)
     112    if (m_document && m_document->svgExtensions())
     113        m_document->accessSVGExtensions()->unpauseAnimations();
     114#endif
     115
     116    mainFrame->eventHandler()->setMousePressNode(mousePressNode());
     117       
     118    // Restore the focus appearance for the focused element.
     119    // FIXME: Right now we don't support pages w/ frames in the b/f cache.  This may need to be tweaked when we add support for that.
     120    Document* focusedDocument = page->focusController()->focusedOrMainFrame()->document();
     121    if (Node* node = focusedDocument->focusedNode()) {
     122        if (node->isElementNode())
     123            static_cast<Element*>(node)->updateFocusAppearance(true);
     124    }
    52125}
    53126
    54 void PageCache::setDocumentLoader(PassRefPtr<DocumentLoader> loader)
     127void CachedPage::clear()
     128{
     129    if (!m_document)
     130        return;
     131
     132    ASSERT(m_view);
     133    ASSERT(m_document->view() == m_view);
     134
     135    if (m_document->inPageCache()) {
     136        Frame::clearTimers(m_view.get());
     137
     138        bool detached = !m_document->renderer();
     139        m_document->setInPageCache(false);
     140        if (detached) {
     141            m_document->detach();
     142            m_document->removeAllEventListenersFromAllNodes();
     143        }
     144
     145        m_view->clearPart();
     146    }
     147
     148    ASSERT(!m_document->inPageCache());
     149
     150    m_document = 0;
     151    m_view = 0;
     152    m_mousePressNode = 0;
     153    m_URL = KURL();
     154
     155    JSLock lock;
     156
     157    m_windowProperties.clear();
     158    m_locationProperties.clear();
     159    m_interpreterBuiltins.clear();
     160    m_pausedTimeouts.clear();
     161
     162    Collector::collect();
     163}
     164
     165void CachedPage::setDocumentLoader(PassRefPtr<DocumentLoader> loader)
    55166{
    56167    m_documentLoader = loader;
    57168}
    58169
    59 DocumentLoader* PageCache::documentLoader()
     170DocumentLoader* CachedPage::documentLoader()
    60171{
    61172    return m_documentLoader.get();
    62173}
    63174
    64 void PageCache::setTimeStamp(double timeStamp)
     175void CachedPage::setTimeStamp(double timeStamp)
    65176{
    66177    m_timeStamp = timeStamp;
    67178}
    68179
    69 void PageCache::setTimeStampToNow()
     180void CachedPage::setTimeStampToNow()
    70181{
    71182    m_timeStamp = currentTime();
    72183}
    73184
    74 double PageCache::timeStamp() const
     185double CachedPage::timeStamp() const
    75186{
    76187    return m_timeStamp;
  • trunk/WebCore/history/CachedPage.h

    r20836 r20837  
    11/*
    2  * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
     2 * Copyright (C) 2006, 2007 Apple Inc.  All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #ifndef PageCache_h
    27 #define PageCache_h
     26#ifndef CachedPage_h
     27#define CachedPage_h
    2828
    2929#include "DocumentLoader.h"
    30 #include "PageState.h"
    3130#include "Shared.h"
    3231#include <wtf/Forward.h>
    3332#include <wtf/RefPtr.h>
     33#include <wtf/OwnPtr.h>
    3434
    3535#if PLATFORM(MAC)
     
    3838#endif
    3939
     40namespace KJS {
     41   
     42    class PausedTimeouts;
     43    class SavedBuiltins;
     44    class SavedProperties;
     45}
     46
    4047namespace WebCore {
    4148
    42 class PageCache : public Shared<PageCache> {
     49    class Document;
     50    class FrameView;
     51    class Node;
     52    class Page;
     53
     54class CachedPage : public Shared<CachedPage> {
    4355public:
    44     PageCache();
    45     ~PageCache();
     56    static PassRefPtr<CachedPage> create(Page*);
     57    ~CachedPage();
     58   
     59    void clear();
     60    Document* document() const { return m_document.get(); }
     61    Node* mousePressNode() const { return m_mousePressNode.get(); }
     62    const KURL& URL() const { return m_URL; }
     63    void restore(Page*);
    4664   
    4765    void close();
    4866   
    49     void setPageState(PassRefPtr<PageState>);
    50     PageState* pageState();
    5167    void setTimeStamp(double);
    5268    void setTimeStampToNow();
     
    6076
    6177private:
    62     // FIXME: <rdar://problem/4887095>
    63     // PageCache should consume PageState and take its role, as well.  The reasons for the division are obsolete
    64     // now that everything is in WebCore instead of split with WebKit
    65     RefPtr<PageState> m_pageState;
     78    CachedPage(Page*);
    6679    RefPtr<DocumentLoader> m_documentLoader;
    6780    double m_timeStamp;
    6881
     82    RefPtr<Document> m_document;
     83    RefPtr<FrameView> m_view;
     84    RefPtr<Node> m_mousePressNode;
     85    KURL m_URL;
     86    OwnPtr<KJS::SavedProperties> m_windowProperties;
     87    OwnPtr<KJS::SavedProperties> m_locationProperties;
     88    OwnPtr<KJS::SavedBuiltins> m_interpreterBuiltins;
     89    OwnPtr<KJS::PausedTimeouts> m_pausedTimeouts;
     90       
    6991#if PLATFORM(MAC)
    7092    RetainPtr<id> m_documentView;
    7193#endif
    72 }; // class PageCache
     94}; // class CachedPage
    7395
    7496} // namespace WebCore
    7597
    76 #endif // PageCache_h
     98#endif // CachedPage_h
    7799
  • trunk/WebCore/history/HistoryItem.cpp

    r19927 r20837  
    2727#include "HistoryItem.h"
    2828
     29#include "CachedPage.h"
    2930#include "FrameLoader.h"
    3031#include "HistoryItemTimer.h"
     
    3334#include "KURL.h"
    3435#include "Logging.h"
    35 #include "PageCache.h"
    3636#include "ResourceRequest.h"
    3737#include "SystemTime.h"
     
    4242void (*notifyHistoryItemChanged)() = defaultNotifyHistoryItemChanged;
    4343
     44static HashSet<RefPtr<CachedPage> >& cachedPagesPendingRelease()
     45{
     46    // We keep this on the heap because otherwise, at app shutdown, we run into the "static destruction order fiasco"
     47    // where the vector is torn down, the CachedPages destroyed, and all havok may break loose.  Instead, we just leak at shutdown
     48    // since nothing here persists
     49    static HashSet<RefPtr<CachedPage> >* cachedPagesPendingRelease = new HashSet<RefPtr<CachedPage> >;
     50    return *cachedPagesPendingRelease;
     51}
     52
    4453HistoryItem::HistoryItem()
    4554    : m_lastVisitedTime(0)
    46     , m_pageCacheIsPendingRelease(false)
    4755    , m_isTargetItem(false)
    48     , m_alwaysAttemptToUsePageCache(false)
     56    , m_alwaysAttemptToUseCachedPage(false)
    4957    , m_visitCount(0)
    5058{
     
    5664    , m_title(title)
    5765    , m_lastVisitedTime(time)
    58     , m_pageCacheIsPendingRelease(false)
    5966    , m_isTargetItem(false)
    60     , m_alwaysAttemptToUsePageCache(false)
     67    , m_alwaysAttemptToUseCachedPage(false)
    6168    , m_visitCount(0)
    6269{   
     
    6976    , m_title(title)
    7077    , m_lastVisitedTime(0)
    71     , m_pageCacheIsPendingRelease(false)
    7278    , m_isTargetItem(false)
    73     , m_alwaysAttemptToUsePageCache(false)
     79    , m_alwaysAttemptToUseCachedPage(false)
    7480    , m_visitCount(0)
    7581{   
     
    8490    , m_title(title)
    8591    , m_lastVisitedTime(0)
    86     , m_pageCacheIsPendingRelease(false)
    8792    , m_isTargetItem(false)
    88     , m_alwaysAttemptToUsePageCache(false)
     93    , m_alwaysAttemptToUseCachedPage(false)
    8994    , m_visitCount(0)
    9095{   
     
    107112    , m_lastVisitedTime(item.m_lastVisitedTime)
    108113    , m_scrollPoint(item.m_scrollPoint)
    109     , m_pageCacheIsPendingRelease(false)
    110114    , m_isTargetItem(item.m_isTargetItem)
    111     , m_alwaysAttemptToUsePageCache(item.m_alwaysAttemptToUsePageCache)
     115    , m_alwaysAttemptToUseCachedPage(item.m_alwaysAttemptToUseCachedPage)
    112116    , m_visitCount(item.m_visitCount)
    113117    , m_formContentType(item.m_formContentType)
     
    129133}
    130134
    131 void HistoryItem::setHasPageCache(bool hasCache)
    132 {
    133     LOG(PageCache, "WebCorePageCache - HistoryItem %p setting has page cache to %s", this, hasCache ? "TRUE" : "FALSE" );
    134        
    135     if (hasCache) {
    136         if (!m_pageCache)
    137             m_pageCache = new PageCache;
    138         else if (m_pageCacheIsPendingRelease)
    139             cancelRelease();
    140     } else if (m_pageCache)
    141         scheduleRelease();
     135void HistoryItem::setCachedPage(PassRefPtr<CachedPage> cachedPage)
     136{
     137    CachedPage* rawCachedPage = cachedPage.releaseRef();
     138   
     139    // The new cached page should always be distinct from the current cached page and should also
     140    // not be in the set of cached pages pending release
     141    ASSERT(!rawCachedPage || rawCachedPage != m_cachedPage.get());
     142    ASSERT(!cachedPagesPendingRelease().contains(rawCachedPage));
     143   
     144    scheduleCachedPageForRelease();
     145    m_cachedPage = adoptRef(rawCachedPage);
     146   
     147    LOG(PageCache, "WebCorePageCache: HistoryItem %p (%s) set cached page to %p", this, m_urlString.ascii().data(), m_cachedPage.get());
    142148}
    143149
     
    225231{
    226232    setURLString(url.url());
    227     setHasPageCache(false);
     233    setCachedPage(0);
    228234}
    229235
     
    310316}
    311317
    312 bool HistoryItem::alwaysAttemptToUsePageCache() const
    313 {
    314     return m_alwaysAttemptToUsePageCache;
    315 }
    316 
    317 void HistoryItem::setAlwaysAttemptToUsePageCache(bool flag)
    318 {
    319     m_alwaysAttemptToUsePageCache = flag;
     318bool HistoryItem::alwaysAttemptToUseCachedPage() const
     319{
     320    return m_alwaysAttemptToUseCachedPage;
     321}
     322
     323void HistoryItem::setAlwaysAttemptToUseCachedPage(bool flag)
     324{
     325    m_alwaysAttemptToUseCachedPage = flag;
    320326}
    321327
     
    360366}
    361367
    362 PageCache* HistoryItem::pageCache()
    363 {
    364     if (m_pageCacheIsPendingRelease)
    365         return 0;
    366     return m_pageCache.get();
    367 }
    368 
    369 bool HistoryItem::hasPageCache() const
    370 {
    371     if (m_pageCacheIsPendingRelease)
    372         return false;
    373     return m_pageCache;
     368CachedPage* HistoryItem::cachedPage()
     369{
     370    return m_cachedPage.get();
    374371}
    375372
     
    439436}
    440437
    441 static HashSet<RefPtr<HistoryItem> >& itemsWithPendingPageCacheToRelease()
    442 {
    443     // We keep this on the heap because otherwise, at app shutdown, we run into the "static destruction order fiasco"
    444     // where the vector is torn down, the PageCaches destroyed, and all havok may break loose.  Instead, we just leak at shutdown
    445     // since nothing here persists
    446     static HashSet<RefPtr<HistoryItem> >* itemsWithPendingPageCacheToRelease = new HashSet<RefPtr<HistoryItem> >;
    447     return *itemsWithPendingPageCacheToRelease;
    448 }
    449 
    450 void HistoryItem::releasePageCachesOrReschedule()
     438void HistoryItem::releaseCachedPagesOrReschedule()
    451439{
    452440    double loadDelta = currentTime() - FrameLoader::timeOfLastCompletedLoad();
     
    455443    // FIXME: This size of 42 pending caches to release seems awfully arbitrary
    456444    // Wonder if anyone knows the rationalization
    457     if ((userDelta < 0.5 || loadDelta < 1.25) && itemsWithPendingPageCacheToRelease().size() < 42) {
    458         LOG(PageCache, "WebCorePageCache: Postponing releasePageCachesOrReschedule() - %f since last load, %f since last input, %i objects pending release", loadDelta, userDelta, itemsWithPendingPageCacheToRelease().size());
     445    if ((userDelta < 0.5 || loadDelta < 1.25) && cachedPagesPendingRelease().size() < 42) {
     446        LOG(PageCache, "WebCorePageCache: Postponing releaseCachedPagesOrReschedule() - %f since last load, %f since last input, %i objects pending release", loadDelta, userDelta, cachedPagesPendingRelease().size());
    459447        timer().schedule();
    460448        return;
    461449    }
    462450
    463     LOG(PageCache, "WebCorePageCache: Releasing page caches - %f seconds since last load, %f since last input, %i objects pending release", loadDelta, userDelta, itemsWithPendingPageCacheToRelease().size());
    464     releaseAllPendingPageCaches();
    465 }
    466 
    467 void HistoryItem::releasePageCache()
    468 {
    469     m_pageCache->close();
    470     m_pageCache = 0;
    471     m_pageCacheIsPendingRelease = false;
    472 }
    473 
    474 void HistoryItem::releaseAllPendingPageCaches()
     451    LOG(PageCache, "WebCorePageCache: Releasing page caches - %f seconds since last load, %f since last input, %i objects pending release", loadDelta, userDelta, cachedPagesPendingRelease().size());
     452    performPendingReleaseOfCachedPages();
     453}
     454
     455void HistoryItem::performPendingReleaseOfCachedPages()
    475456{
    476457    timer().invalidate();
    477458
    478     HashSet<RefPtr<HistoryItem> >::iterator i = itemsWithPendingPageCacheToRelease().begin();
    479     HashSet<RefPtr<HistoryItem> >::iterator end = itemsWithPendingPageCacheToRelease().end();
     459    Vector<CachedPage*> cachedPages;
     460    cachedPages.reserveCapacity(cachedPagesPendingRelease().size());
     461   
     462    HashSet<RefPtr<CachedPage> >::iterator i = cachedPagesPendingRelease().begin();
     463    HashSet<RefPtr<CachedPage> >::iterator end = cachedPagesPendingRelease().end();
    480464    for (; i != end; ++i)
    481         (*i)->releasePageCache();
    482 
    483     itemsWithPendingPageCacheToRelease().clear();
    484 }
    485 
    486 void HistoryItem::scheduleRelease()
    487 {
    488     LOG (PageCache, "WebCorePageCache: Scheduling release of %s", m_urlString.ascii().data());
     465        cachedPages.append((*i).get());
     466       
     467    for (unsigned j = 0; j < cachedPages.size(); ++j)
     468        cachedPages[j]->close();
     469
     470    cachedPagesPendingRelease().clear();
     471}
     472
     473void HistoryItem::scheduleCachedPageForRelease()
     474{
     475    if (!m_cachedPage)
     476        return;
     477       
     478    LOG (PageCache, "WebCorePageCache: HistoryItem %p (%s) scheduling release of cached page %p", this, m_urlString.ascii().data(), m_cachedPage.get());
     479
     480    cachedPagesPendingRelease().add(m_cachedPage);
     481    m_cachedPage = 0;
     482
    489483    // Don't reschedule the timer if its already running
    490484    if (!timer().isActive())
    491485        timer().schedule();
    492 
    493     if (m_pageCache && !m_pageCacheIsPendingRelease) {
    494         m_pageCacheIsPendingRelease = true;
    495         itemsWithPendingPageCacheToRelease().add(this);
    496     }
    497 }
    498 
    499 void HistoryItem::cancelRelease()
    500 {
    501     itemsWithPendingPageCacheToRelease().remove(this);
    502     m_pageCacheIsPendingRelease = false;
    503 }
     486}
     487
    504488#ifndef NDEBUG
    505489int HistoryItem::showTree() const
  • trunk/WebCore/history/HistoryItem.h

    r20475 r20837  
    4545namespace WebCore {
    4646
     47class CachedPage;
    4748class Image;
    4849class KURL;
    49 class PageCache;
    5050class ResourceRequest;
    5151
     
    7979   
    8080    void retainIconInDatabase(bool retain);
    81     static void releaseAllPendingPageCaches();
    82     bool hasPageCache() const;
    83     void setHasPageCache(bool);
    84     PageCache* pageCache();
     81    static void performPendingReleaseOfCachedPages();
     82    void setCachedPage(PassRefPtr<CachedPage>);
     83    CachedPage* cachedPage();
    8584
    8685    const String& parent() const;
     
    126125    bool hasChildren() const;
    127126
    128     void setAlwaysAttemptToUsePageCache(bool);
    129     bool alwaysAttemptToUsePageCache() const;
     127    void setAlwaysAttemptToUseCachedPage(bool);
     128    bool alwaysAttemptToUseCachedPage() const;
    130129
    131130    // This should not be called directly for HistoryItems that are already included
     
    143142#endif
    144143
    145     void scheduleRelease();
    146     void cancelRelease();
    147     void releasePageCache(); 
     144    void scheduleCachedPageForRelease();
    148145   
    149146#ifndef NDEBUG
     
    154151private:
    155152    HistoryItem(const HistoryItem&);
    156     static void releasePageCachesOrReschedule();
     153    static void releaseCachedPagesOrReschedule();
    157154   
    158155    String m_urlString;
     
    169166   
    170167    HistoryItemVector m_subItems;
    171     bool m_pageCacheIsPendingRelease;
    172     RefPtr<PageCache> m_pageCache;
     168   
     169    RefPtr<CachedPage> m_cachedPage;
    173170   
    174171    bool m_isTargetItem;
    175     bool m_alwaysAttemptToUsePageCache;
     172    bool m_alwaysAttemptToUseCachedPage;
    176173    int m_visitCount;
    177174   
  • trunk/WebCore/history/HistoryItemTimer.cpp

    r18588 r20837  
    3434
    3535HistoryItemTimer::HistoryItemTimer()
    36     : m_timer(this, &HistoryItemTimer::callReleasePageCachesOrReschedule)
     36    : m_timer(this, &HistoryItemTimer::callReleaseCachedPagesOrReschedule)
    3737{
    3838}
     
    5353}
    5454
    55 void HistoryItemTimer::callReleasePageCachesOrReschedule(Timer<HistoryItemTimer>*)
     55void HistoryItemTimer::callReleaseCachedPagesOrReschedule(Timer<HistoryItemTimer>*)
    5656{
    57     HistoryItem::releasePageCachesOrReschedule();
     57    HistoryItem::releaseCachedPagesOrReschedule();
    5858}
    5959
  • trunk/WebCore/history/HistoryItemTimer.h

    r18874 r20837  
    4242
    4343private:
    44     void callReleasePageCachesOrReschedule(Timer<HistoryItemTimer>*);
     44    void callReleaseCachedPagesOrReschedule(Timer<HistoryItemTimer>*);
    4545    Timer<HistoryItemTimer> m_timer;
    4646};
  • trunk/WebCore/history/mac/CachedPageMac.mm

    r20836 r20837  
    2525
    2626#include "config.h"
    27 #include "PageCache.h"
     27#include "CachedPage.h"
    2828
    2929#import <objc/objc-runtime.h>
     
    3131namespace WebCore {
    3232
    33 void PageCache::close()
     33void CachedPage::close()
    3434{
    35     if (!m_pageState)
     35    if (!m_document)
    3636        return;
    37    
     37       
    3838    // FIXME: <rdar://problem/4886844>
    3939    // The current method of tracking the "document view" is messy and quite platform specific
     
    4242        objc_msgSend(m_documentView.get(), @selector(closeIfNotCurrentView));
    4343
    44     m_pageState->clear();
    45    
    46     // Setting these to null is how the PageCache object knows it's been closed
    47     m_pageState = 0;
    48     m_documentLoader = 0;
     44    clear();
    4945}
    5046
    51 void PageCache::setDocumentView(id documentView)
     47void CachedPage::setDocumentView(id documentView)
    5248{
    5349    m_documentView = documentView;
    5450}
    5551
    56 id PageCache::documentView()
     52id CachedPage::documentView()
    5753{
    5854    return m_documentView.get();
  • trunk/WebCore/history/mac/HistoryItemMac.mm

    r18541 r20837  
    2626#include "config.h"
    2727#include "HistoryItem.h"
    28 
    29 #include "PageCache.h"
    3028
    3129namespace WebCore {
  • trunk/WebCore/loader/DocumentLoader.cpp

    r20135 r20837  
    3030#include "DocumentLoader.h"
    3131
     32#include "CachedPage.h"
    3233#include "Document.h"
    3334#include "Event.h"
     
    3536#include "FrameLoader.h"
    3637#include "HistoryItem.h"
     38#include "Logging.h"
    3739#include "MainResourceLoader.h"
    38 #include "PageCache.h"
    3940#include "PlatformString.h"
    4041#include "SharedBuffer.h"
     
    132133    , m_primaryLoadComplete(false)
    133134    , m_isClientRedirect(false)
    134     , m_loadingFromPageCache(false)
     135    , m_loadingFromCachedPage(false)
    135136    , m_stopRecordingResponses(false)
    136137{
     
    542543}
    543544
    544 void DocumentLoader::loadFromPageCache(PassRefPtr<PageCache> pageCache)
    545 {
     545void DocumentLoader::loadFromCachedPage(PassRefPtr<CachedPage> cachedPage)
     546{
     547    LOG(PageCache, "WebCorePageCache: DocumentLoader %p loading from cached page %p", this, cachedPage.get());
     548   
    546549    prepareForLoadStart();
    547     setLoadingFromPageCache(true);
     550    setLoadingFromCachedPage(true);
    548551    setCommitted(true);
    549     frameLoader()->commitProvisionalLoad(pageCache);
     552    frameLoader()->commitProvisionalLoad(cachedPage);
    550553}
    551554
     
    555558}
    556559
    557 void DocumentLoader::setLoadingFromPageCache(bool loading)
    558 {
    559     m_loadingFromPageCache = loading;
    560 }
    561 
    562 bool DocumentLoader::isLoadingFromPageCache() const
    563 {
    564     return m_loadingFromPageCache;
     560void DocumentLoader::setLoadingFromCachedPage(bool loading)
     561{
     562    m_loadingFromCachedPage = loading;
     563}
     564
     565bool DocumentLoader::isLoadingFromCachedPage() const
     566{
     567    return m_loadingFromCachedPage;
    565568}
    566569
  • trunk/WebCore/loader/DocumentLoader.h

    r19737 r20837  
    4343namespace WebCore {
    4444
     45    class CachedPage;
    4546    class Frame;
    4647    class FrameLoader;
     
    4849    class KURL;
    4950    class MainResourceLoader;
    50     class PageCache;
    5151    class ResourceLoader;
    5252    class SharedBuffer;
     
    127127        KURL urlForHistory() const;
    128128       
    129         void loadFromPageCache(PassRefPtr<PageCache>);
    130         void setLoadingFromPageCache(bool);
    131         bool isLoadingFromPageCache() const;
     129        void loadFromCachedPage(PassRefPtr<CachedPage>);
     130        void setLoadingFromCachedPage(bool);
     131        bool isLoadingFromCachedPage() const;
    132132       
    133133        void setDefersLoading(bool);
     
    193193        bool m_primaryLoadComplete;
    194194        bool m_isClientRedirect;
    195         bool m_loadingFromPageCache;
     195        bool m_loadingFromCachedPage;
    196196
    197197        String m_pageTitle;
  • trunk/WebCore/loader/FrameLoader.cpp

    r20813 r20837  
    3232
    3333#include "Cache.h"
     34#include "CachedPage.h"
    3435#include "Chrome.h"
    3536#include "CString.h"
     
    6364#include "MainResourceLoader.h"
    6465#include "Page.h"
    65 #include "PageCache.h"
    66 #include "PageState.h"
    6766#include "ProgressTracker.h"
    6867#include "RenderPart.h"
     
    14881487        && !documentLoader()->isStopping()) {
    14891488        if (m_client->canCachePage()) {
    1490             if (!m_currentHistoryItem->pageCache()) {
     1489            if (!m_currentHistoryItem->cachedPage()) {
    14911490                // Add the items to this page's cache.
    1492                 if (createPageCache(m_currentHistoryItem.get())) {
    1493                     // See if any page caches need to be purged after the addition of this new page cache.
     1491                if (cachePageToHistoryItem(m_currentHistoryItem.get())) {
     1492                    LOG(PageCache, "WebCorePageCache: CachedPage %p created for HistoryItem %p (%s)", m_currentHistoryItem->cachedPage(), m_currentHistoryItem.get(),
     1493                        m_currentHistoryItem->urlString().ascii().data());
     1494                       
     1495                    // See if any cached pages need to be purged after the addition of this new cached page.
    14941496                    purgePageCache();
    14951497                }
     
    22782280}
    22792281
    2280 void FrameLoader::commitProvisionalLoad(PassRefPtr<PageCache> prpPageCache)
    2281 {
    2282     RefPtr<PageCache> pageCache = prpPageCache;
     2282void FrameLoader::commitProvisionalLoad(PassRefPtr<CachedPage> prpCachedPage)
     2283{
     2284    RefPtr<CachedPage> cachedPage = prpCachedPage;
    22832285    RefPtr<DocumentLoader> pdl = m_provisionalDocumentLoader;
    22842286   
     
    22862288        closeOldDataSources();
    22872289   
    2288     if (!pageCache)
     2290    if (!cachedPage)
    22892291        m_client->makeRepresentation(pdl.get());
    22902292   
    2291     transitionToCommitted(pageCache);
     2293    transitionToCommitted(cachedPage);
    22922294   
    22932295    // Call -_clientRedirectCancelledOrFinished: here so that the frame load delegate is notified that the redirect's
     
    22982300        clientRedirectCancelledOrFinished(false);
    22992301   
    2300     RefPtr<PageState> pageState;
    2301     if (pageCache)
    2302         pageState = pageCache->pageState();
    2303     if (pageState) {
    2304         open(*pageState);
    2305         pageState->clear();
     2302    if (cachedPage && cachedPage->document()) {
     2303        open(*cachedPage);
     2304        cachedPage->clear();
    23062305    } else {       
    23072306        KURL url = pdl->URL();
     
    23162315}
    23172316
    2318 void FrameLoader::transitionToCommitted(PassRefPtr<PageCache> pageCache)
     2317void FrameLoader::transitionToCommitted(PassRefPtr<CachedPage> cachedPage)
    23192318{
    23202319    ASSERT(m_client->hasWebView());
     
    23492348
    23502349                // Create a document view for this document, or used the cached view.
    2351                 if (pageCache)
    2352                     m_client->setDocumentViewFromPageCache(pageCache.get());
     2350                if (cachedPage)
     2351                    m_client->setDocumentViewFromCachedPage(cachedPage.get());
    23532352                else
    23542353                    m_client->makeDocumentView();
     
    24512450}
    24522451
    2453 void FrameLoader::open(PageState& state)
     2452void FrameLoader::open(CachedPage& cachedPage)
    24542453{
    24552454    ASSERT(m_frame->page()->mainFrame() == m_frame);
     
    24712470    }
    24722471
    2473     KURL URL = state.URL();
     2472    KURL URL = cachedPage.URL();
    24742473
    24752474    if (URL.protocol().startsWith("http") && !URL.host().isEmpty() && URL.path().isEmpty())
     
    24832482    clear();
    24842483
    2485     Document* document = state.document();
     2484    Document* document = cachedPage.document();
    24862485    ASSERT(document);
    24872486    document->setInPageCache(false);
     
    24992498    updatePolicyBaseURL();
    25002499
    2501     state.restore(m_frame->page());
     2500    cachedPage.restore(m_frame->page());
    25022501
    25032502    checkCompleted();
     
    30483047        return;
    30493048
    3050     m_provisionalDocumentLoader->setLoadingFromPageCache(false);
     3049    m_provisionalDocumentLoader->setLoadingFromCachedPage(false);
    30513050
    30523051    unsigned long identifier = m_frame->page()->progress()->createUniqueIdentifier();
     
    31223121        if (document)
    31233122            document->setInPageCache(false);
    3124         invalidateCurrentItemPageCache();
     3123        invalidateCurrentItemCachedPage();
    31253124       
    31263125        // Call clientRedirectCancelledOrFinished here so that the frame load delegate is notified that the redirect's
     
    31873186        updateHistoryForClientRedirect();
    31883187
    3189     if (m_documentLoader->isLoadingFromPageCache()) {
     3188    if (m_documentLoader->isLoadingFromCachedPage()) {
    31903189        // Force a layout to update view size and thereby update scrollbars.
    31913190        m_client->forceLayout();
     
    32033202        }
    32043203       
    3205         m_client->loadedFromPageCache();
     3204        m_client->loadedFromCachedPage();
    32063205
    32073206        m_documentLoader->setPrimaryLoadComplete(true);
     
    33523351    setPolicyDocumentLoader(0);
    33533352
    3354     if (isBackForwardLoadType(type) && loadProvisionalItemFromPageCache())
     3353    if (isBackForwardLoadType(type) && loadProvisionalItemFromCachedPage())
    33553354        return;
    33563355
     
    34803479}
    34813480
    3482 bool FrameLoader::loadProvisionalItemFromPageCache()
    3483 {
    3484     if (!m_provisionalHistoryItem || !m_provisionalHistoryItem->hasPageCache())
     3481bool FrameLoader::loadProvisionalItemFromCachedPage()
     3482{
     3483    if (!m_provisionalHistoryItem || !m_provisionalHistoryItem->cachedPage())
    34853484        return false;
    34863485
    3487     RefPtr<PageState> state = m_provisionalHistoryItem->pageCache()->pageState();
    3488     if (!state)
     3486    if (!m_provisionalHistoryItem->cachedPage()->document())
    34893487        return false;
    34903488   
    3491     provisionalDocumentLoader()->loadFromPageCache(m_provisionalHistoryItem->pageCache());
     3489    provisionalDocumentLoader()->loadFromCachedPage(m_provisionalHistoryItem->cachedPage());
    34923490    return true;
    34933491}
    34943492
    3495 bool FrameLoader::createPageCache(HistoryItem* item)
    3496 {
    3497     RefPtr<PageState> pageState = PageState::create(m_frame->page());
    3498    
    3499     if (!pageState) {
    3500         item->setHasPageCache(false);
     3493bool FrameLoader::cachePageToHistoryItem(HistoryItem* item)
     3494{
     3495    RefPtr<CachedPage> cachedPage = CachedPage::create(m_frame->page());
     3496   
     3497    if (!cachedPage) {
     3498        item->setCachedPage(0);
    35013499        return false;
    35023500    }
    35033501   
    3504     item->setHasPageCache(true);
    3505     RefPtr<PageCache> pageCache = item->pageCache();
    3506 
    3507     pageCache->setPageState(pageState.release());
    3508     pageCache->setTimeStampToNow();
    3509     pageCache->setDocumentLoader(documentLoader());
    3510     m_client->saveDocumentViewToPageCache(pageCache.get());
     3502    item->setCachedPage(cachedPage);
     3503
     3504    cachedPage->setTimeStampToNow();
     3505    cachedPage->setDocumentLoader(documentLoader());
     3506    m_client->saveDocumentViewToCachedPage(cachedPage.get());
    35113507
    35123508    return true;
     
    35403536    }
    35413537
    3542     LOG (History, "WebCoreHistory - Creating item for %s", url.url().ascii());
     3538    LOG (History, "WebCoreHistory: Creating item for %s", url.url().ascii());
    35433539   
    35443540    // Frames that have never successfully loaded any content
     
    36573653   
    36583654    for (; i < items.size(); ++i) {
    3659         if (items[i]->hasPageCache()) {
    3660             if (!oldestNonSnapbackItem && !items[i]->alwaysAttemptToUsePageCache())
     3655        if (items[i]->cachedPage()) {
     3656            if (!oldestNonSnapbackItem && !items[i]->alwaysAttemptToUseCachedPage())
    36613657                oldestNonSnapbackItem = items[i];
    36623658            pagesCached++;
     
    36673663    if (pagesCached >= sizeLimit && oldestNonSnapbackItem) {
    36683664        LOG(PageCache, "Purging back/forward cache, %s\n", oldestNonSnapbackItem->url().url().ascii());
    3669         oldestNonSnapbackItem->setHasPageCache(false);
    3670     }
    3671 }
    3672 
    3673 void FrameLoader::invalidateCurrentItemPageCache()
     3665        oldestNonSnapbackItem->setCachedPage(0);
     3666    }
     3667}
     3668
     3669void FrameLoader::invalidateCurrentItemCachedPage()
    36743670{
    36753671    // When we are pre-commit, the currentItem is where the pageCache data resides   
    3676     PageCache* pageCache = m_currentHistoryItem ? m_currentHistoryItem->pageCache() : 0;
    3677     PageState* pageState = pageCache ? pageCache->pageState() : 0;
     3672    CachedPage* cachedPage = m_currentHistoryItem ? m_currentHistoryItem->cachedPage() : 0;
    36783673
    36793674    // FIXME: This is a grotesque hack to fix <rdar://problem/4059059> Crash in RenderFlow::detach
     
    36813676    // Both Xcode and FileMaker see this crash, Safari does not.
    36823677   
    3683     ASSERT(!pageState || pageState->document() == m_frame->document());
    3684     if (pageState && pageState->document() == m_frame->document())
    3685         pageState->clear();
     3678    ASSERT(!cachedPage || cachedPage->document() == m_frame->document());
     3679    if (cachedPage && cachedPage->document() == m_frame->document())
     3680        cachedPage->clear();
    36863681   
    36873682    if (m_currentHistoryItem)
    3688         m_currentHistoryItem->setHasPageCache(false);
     3683        m_currentHistoryItem->setCachedPage(0);
    36893684}
    36903685
     
    37743769        // if one exists and it is less than _backForwardCacheExpirationInterval
    37753770        // seconds old.  If the cache is expired it gets flushed here.
    3776         if (item->hasPageCache()) {
    3777             RefPtr<PageCache> pageCache = item->pageCache();
    3778             double interval = currentTime() - pageCache->timeStamp();
     3771        if (item->cachedPage()) {
     3772            RefPtr<CachedPage> cachedPage = item->cachedPage();
     3773            double interval = currentTime() - cachedPage->timeStamp();
    37793774           
    37803775            // FIXME: 1800 is the current backforwardcache expiration time, but we actually store as a pref -
     
    37823777            //if (interval <= [[getWebView(self) preferences] _backForwardCacheExpirationInterval]) {
    37833778            if (interval <= 1800) {
    3784                 load(pageCache->documentLoader(), loadType, 0);   
     3779                load(cachedPage->documentLoader(), loadType, 0);   
    37853780                inPageCache = true;
    37863781            } else {
    37873782                LOG (PageCache, "Not restoring page for %s from back/forward cache because cache entry has expired", m_provisionalHistoryItem->url().url().ascii());
    3788                 item->setHasPageCache(false);
     3783                item->setCachedPage(0);
    37893784            }
    37903785        }
     
    39623957void FrameLoader::updateHistoryForStandardLoad()
    39633958{
    3964     LOG(History, "WebCoreHistory - Updating History for Standard Load in frame %s", documentLoader()->URL().url().ascii());
     3959    LOG(History, "WebCoreHistory: Updating History for Standard Load in frame %s", documentLoader()->URL().url().ascii());
    39653960
    39663961    if (!documentLoader()->isClientRedirect()) {
     
    39833978#if !LOG_DISABLED
    39843979    if (documentLoader())
    3985         LOG(History, "WebCoreHistory - Updating History for client redirect in frame %s", documentLoader()->title().utf8().data());
     3980        LOG(History, "WebCoreHistory: Updating History for client redirect in frame %s", documentLoader()->title().utf8().data());
    39863981#endif
    39873982
     
    39983993#if !LOG_DISABLED
    39993994    if (documentLoader())
    4000         LOG(History, "WebCoreHistory - Updating History for back/forward navigation in frame %s", documentLoader()->title().utf8().data());
     3995        LOG(History, "WebCoreHistory: Updating History for back/forward navigation in frame %s", documentLoader()->title().utf8().data());
    40013996#endif
    40023997
     
    40094004#if !LOG_DISABLED
    40104005    if (documentLoader())
    4011         LOG(History, "WebCoreHistory - Updating History for reload in frame %s", documentLoader()->title().utf8().data());
     4006        LOG(History, "WebCoreHistory: Updating History for reload in frame %s", documentLoader()->title().utf8().data());
    40124007#endif
    40134008
    40144009    if (m_previousHistoryItem) {
    4015         m_previousHistoryItem->setHasPageCache(false);
     4010        m_previousHistoryItem->setCachedPage(0);
    40164011   
    40174012        if (loadType() == FrameLoadTypeReload)
     
    40324027#if !LOG_DISABLED
    40334028    if (documentLoader())
    4034         LOG(History, "WebCoreHistory - Updating History for internal load in frame %s", documentLoader()->title().utf8().data());
     4029        LOG(History, "WebCoreHistory: Updating History for internal load in frame %s", documentLoader()->title().utf8().data());
    40354030#endif
    40364031   
     
    40604055#if !LOG_DISABLED
    40614056    if (documentLoader())
    4062         LOG(History, "WebCoreHistory - Updating History for commit in frame %s", documentLoader()->title().utf8().data());
     4057        LOG(History, "WebCoreHistory: Updating History for commit in frame %s", documentLoader()->title().utf8().data());
    40634058#endif
    40644059    FrameLoadType type = loadType();
  • trunk/WebCore/loader/FrameLoader.h

    r20813 r20837  
    5252
    5353    class AuthenticationChallenge;
     54    class CachedPage;
    5455    class Document;
    5556    class DocumentLoader;
     
    6768    class Node;
    6869    class Page;
    69     class PageCache;
    70     class PageState;
    7170    class RenderPart;
    7271    class ResourceError;
     
    395394        bool shouldTreatURLAsSameAsCurrent(const KURL&) const;
    396395
    397         void commitProvisionalLoad(PassRefPtr<PageCache>);
     396        void commitProvisionalLoad(PassRefPtr<CachedPage>);
    398397
    399398        void goToItem(HistoryItem*, FrameLoadType);
     
    427426        bool urlsMatchItem(HistoryItem*) const;
    428427        void purgePageCache();
    429         void invalidateCurrentItemPageCache();
     428        void invalidateCurrentItemCachedPage();
    430429        void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType);
    431430        bool childFramesMatchItem(HistoryItem*) const;
     
    452451        const Vector<String>& paramNames, const Vector<String>& paramValues, bool useFallback);
    453452       
    454         bool loadProvisionalItemFromPageCache();
    455         bool createPageCache(HistoryItem*);
     453        bool loadProvisionalItemFromCachedPage();
     454        bool cachePageToHistoryItem(HistoryItem*);
    456455
    457456        void emitLoadEvent();
     
    473472        void markLoadComplete();
    474473        void commitProvisionalLoad();
    475         void transitionToCommitted(PassRefPtr<PageCache>);
     474        void transitionToCommitted(PassRefPtr<CachedPage>);
    476475        void frameLoadCompleted();
    477476
     
    511510
    512511        void closeOldDataSources();
    513         void open(PageState&);
     512        void open(CachedPage&);
    514513        void opened();
    515514        void updateHistoryAfterClientRedirect();
  • trunk/WebCore/loader/FrameLoaderClient.h

    r20227 r20837  
    3737
    3838    class AuthenticationChallenge;
     39    class CachedPage;
    3940    class DocumentLoader;
    4041    class Element;
     
    4748    class KURL;
    4849    class NavigationAction;
    49     class PageCache;
    5050    class ResourceError;
    5151    class ResourceHandle;
     
    7272        virtual void makeDocumentView() = 0;
    7373        virtual void makeRepresentation(DocumentLoader*) = 0;
    74         virtual void setDocumentViewFromPageCache(PageCache*) = 0;
     74        virtual void setDocumentViewFromCachedPage(CachedPage*) = 0;
    7575        virtual void forceLayout() = 0;
    7676        virtual void forceLayoutForNonHTML() = 0;
     
    8282        virtual void detachedFromParent4() = 0;
    8383
    84         virtual void loadedFromPageCache() = 0;
     84        virtual void loadedFromCachedPage() = 0;
    8585
    8686        virtual void assignIdentifierToInitialRequest(unsigned long identifier, DocumentLoader*, const ResourceRequest&) = 0;
     
    184184        virtual String userAgent(const KURL&) = 0;
    185185       
    186         virtual void saveDocumentViewToPageCache(PageCache*) = 0;
     186        virtual void saveDocumentViewToCachedPage(CachedPage*) = 0;
    187187        virtual bool canCachePage() const = 0;
    188188        virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) = 0;
  • trunk/WebCore/page/mac/WebCoreFrameBridge.h

    r20269 r20837  
    5252@protocol WebCoreRenderTreeCopier;
    5353
    54 extern NSString *WebCorePageCacheStateKey;
    55 
    5654enum WebCoreDeviceType {
    5755    WebCoreDeviceScreen,
  • trunk/WebCore/page/mac/WebCoreFrameBridge.mm

    r20725 r20837  
    117117
    118118using KJS::Bindings::RootObject;
    119 
    120 NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
    121119
    122120static PassRefPtr<RootObject> createRootObject(void* nativeHandle)
  • trunk/WebCore/platform/graphics/svg/SVGImage.cpp

    r20182 r20837  
    2727#if ENABLE(SVG)
    2828
     29#include "CachedPage.h"
    2930#include "DocumentLoader.h"
    3031#include "FloatRect.h"
     
    3435#include "GraphicsContext.h"
    3536#include "Page.h"
    36 #include "PageCache.h"
    3737#include "ResourceError.h"
    3838#include "SVGDocument.h"
  • trunk/WebCore/platform/graphics/svg/SVGImageEmptyClients.h

    r20227 r20837  
    125125   
    126126    virtual bool provisionalItemIsTarget() const { return false; }
    127     virtual bool loadProvisionalItemFromPageCache() { return false; }
    128     virtual void invalidateCurrentItemPageCache() { }
     127    virtual bool loadProvisionalItemFromCachedPage() { return false; }
     128    virtual void invalidateCurrentItemCachedPage() { }
    129129   
    130130    virtual bool privateBrowsingEnabled() const { return false; }
     
    150150    virtual void detachedFromParent4() { }
    151151   
    152     virtual void loadedFromPageCache() { }
     152    virtual void loadedFromCachedPage() { }
    153153   
    154154    virtual void download(ResourceHandle*, const ResourceRequest&, const ResourceResponse&) { }
     
    193193   
    194194    virtual void dispatchDidLoadMainResource(DocumentLoader*) { }
    195     virtual void clearLoadingFromPageCache(DocumentLoader*) { }
    196     virtual bool isLoadingFromPageCache(DocumentLoader*) { return 0; }
     195    virtual void clearLoadingFromCachedPage(DocumentLoader*) { }
     196    virtual bool isLoadingFromCachedPage(DocumentLoader*) { return 0; }
    197197    virtual void revertToProvisionalState(DocumentLoader*) { }
    198198    virtual void setMainDocumentError(DocumentLoader*, const ResourceError&) { }
     
    251251    virtual String userAgent(const KURL&) { return ""; }
    252252   
    253     virtual void setDocumentViewFromPageCache(PageCache*) { }
     253    virtual void setDocumentViewFromCachedPage(CachedPage*) { }
    254254    virtual void updateGlobalHistoryForStandardLoad(const KURL&) { }
    255255    virtual void updateGlobalHistoryForReload(const KURL&) { }
    256256    virtual bool shouldGoToHistoryItem(HistoryItem*) const { return false; }
    257257    virtual void saveViewStateToItem(HistoryItem*) { }
    258     virtual void saveDocumentViewToPageCache(PageCache*) { }
     258    virtual void saveDocumentViewToCachedPage(CachedPage*) { }
    259259    virtual bool canCachePage() const { return false; }
    260260
  • trunk/WebKit/ChangeLog

    r20820 r20837  
     12007-04-10  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Darin
     4
     5        <rdar://problem/4887095> - PageCache and PageState should be combined
     6
     7        WebKit side of the change to reflect the new object name of CachedPage and new Client method names
     8
     9        * History/WebHistoryItem.mm:
     10        (-[WebHistoryItem setAlwaysAttemptToUsePageCache:]):
     11        (+[WebHistoryItem _releaseAllPendingPageCaches]):
     12        (-[WebWindowWatcher windowWillClose:]):
     13
     14        * WebCoreSupport/WebFrameLoaderClient.h:
     15        * WebCoreSupport/WebFrameLoaderClient.mm:
     16        (WebFrameLoaderClient::setDocumentViewFromCachedPage):
     17        (WebFrameLoaderClient::loadedFromCachedPage):
     18        (WebFrameLoaderClient::saveDocumentViewToCachedPage):
     19
    1202007-04-09  Geoffrey Garen  <ggaren@apple.com>
    221
  • trunk/WebKit/History/WebHistoryItem.mm

    r19921 r20837  
    4444#import "WebPluginController.h"
    4545#import <JavaScriptCore/Assertions.h>
     46#import <WebCore/CachedPage.h>
    4647#import <WebCore/HistoryItem.h>
    4748#import <WebCore/Image.h>
    4849#import <WebCore/KURL.h>
    49 #import <WebCore/PageState.h>
    5050#import <WebCore/PlatformString.h>
    5151#import <WebCore/ThreadCheck.h>
     
    464464- (void)setAlwaysAttemptToUsePageCache: (BOOL)flag
    465465{
    466     core(_private)->setAlwaysAttemptToUsePageCache(flag);
     466    core(_private)->setAlwaysAttemptToUseCachedPage(flag);
    467467}
    468468
     
    500500+ (void)_releaseAllPendingPageCaches
    501501{
    502     HistoryItem::releaseAllPendingPageCaches();
     502    HistoryItem::performPendingReleaseOfCachedPages();
    503503}
    504504
     
    511511-(void)windowWillClose:(NSNotification *)notification
    512512{
    513     WebCoreHistoryItem::releaseAllPendingPageCaches();
     513    WebCoreHistoryItem::performPendingReleaseOfCachedPages();
    514514}
    515515@end
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.h

    r20476 r20837  
    4040namespace WebCore {
    4141    class AuthenticationChallenge;
     42    class CachedPage;
    4243    class HistoryItem;
    43     class PageCache;
    4444    class String;
    4545    class ResourceLoader;
     
    6666    virtual void makeDocumentView();
    6767    virtual void makeRepresentation(WebCore::DocumentLoader*);
    68     virtual void setDocumentViewFromPageCache(WebCore::PageCache*);
     68    virtual void setDocumentViewFromCachedPage(WebCore::CachedPage*);
    6969    virtual void forceLayout();
    7070    virtual void forceLayoutForNonHTML();
     
    7676    virtual void detachedFromParent4();
    7777
    78     virtual void loadedFromPageCache();
     78    virtual void loadedFromCachedPage();
    7979
    8080    virtual void download(WebCore::ResourceHandle*, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
     
    204204    NSDictionary *actionDictionary(const WebCore::NavigationAction&) const;
    205205
    206     void saveDocumentViewToPageCache(WebCore::PageCache* pageCache);
     206    void saveDocumentViewToCachedPage(WebCore::CachedPage* cachedPage);
    207207   
    208208    virtual bool canCachePage() const;
  • trunk/WebKit/WebCoreSupport/WebFrameLoaderClient.mm

    r20388 r20837  
    6969#import <WebCore/AuthenticationMac.h>
    7070#import <WebCore/BlockExceptions.h>
     71#import <WebCore/CachedPage.h>
    7172#import <WebCore/Chrome.h>
    7273#import <WebCore/Document.h>
     
    8586#import <WebCore/MouseEvent.h>
    8687#import <WebCore/Page.h>
    87 #import <WebCore/PageCache.h>
    88 #import <WebCore/PageState.h>
    8988#import <WebCore/PlatformString.h>
    9089#import <WebCore/ResourceError.h>
     
    169168}
    170169
    171 void WebFrameLoaderClient::setDocumentViewFromPageCache(PageCache* pageCache)
    172 {
    173     DocumentLoader* cachedDocumentLoader = pageCache->documentLoader();
     170void WebFrameLoaderClient::setDocumentViewFromCachedPage(CachedPage* cachedPage)
     171{
     172    DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader();
    174173    ASSERT(cachedDocumentLoader);
    175174    cachedDocumentLoader->setFrame(core(m_webFrame.get()));
    176     NSView <WebDocumentView> *cachedView = pageCache->documentView();
     175    NSView <WebDocumentView> *cachedView = cachedPage->documentView();
    177176    ASSERT(cachedView != nil);
    178177    [cachedView setDataSource:dataSource(cachedDocumentLoader)];
     
    226225}
    227226
    228 void WebFrameLoaderClient::loadedFromPageCache()
     227void WebFrameLoaderClient::loadedFromCachedPage()
    229228{
    230229    // Release the resources kept in the page cache.
     
    232231    // The WebCore side of the page cache will have already been invalidated by
    233232    // the bridge to prevent premature release.
    234     core(m_webFrame.get())->loader()->currentHistoryItem()->setHasPageCache(false);
     233    core(m_webFrame.get())->loader()->currentHistoryItem()->setCachedPage(0);
    235234}
    236235
     
    958957}
    959958
    960 void WebFrameLoaderClient::saveDocumentViewToPageCache(PageCache* pageCache)
    961 {
    962     pageCache->setDocumentView([m_webFrame->_private->webFrameView documentView]);
     959void WebFrameLoaderClient::saveDocumentViewToCachedPage(CachedPage* cachedPage)
     960{
     961    cachedPage->setDocumentView([m_webFrame->_private->webFrameView documentView]);
    963962}
    964963
Note: See TracChangeset for help on using the changeset viewer.