Changeset 64662 in webkit


Ignore:
Timestamp:
Aug 4, 2010 11:55:22 AM (14 years ago)
Author:
beidson@apple.com
Message:

2010-08-04 Brady Eidson <beidson@apple.com>

Reviewed by Sam Weinig.

Lay the groundwork for saving/restoring page session state to WK2
https://bugs.webkit.org/show_bug.cgi?id=43495

  • WebKit2.xcodeproj/project.pbxproj:
  • win/WebKit2.vcproj:
  • Shared/APIObject.h: (WebKit::APIObject::):
  • UIProcess/API/C/WKAPICast.h:
  • UIProcess/API/C/WKBase.h:


Arbitrary byte buffer:

  • Shared/WebData.h: Added. (WebKit::WebData::create): (WebKit::WebData::bytes): (WebKit::WebData::size): (WebKit::WebData::WebData): (WebKit::WebData::type):


API facing object to act as a byte buffer:

  • UIProcess/API/C/WKData.cpp: Added. (WKDataGetTypeID): (WKDataCreate): (WKDataGetBytes): (WKDataGetSize): (WKDataRetain): (WKDataRelease):
  • UIProcess/API/C/WKData.h: Added.

API for saving/restoring state:

  • UIProcess/API/C/WKPage.cpp: (WKPageCopySessionState): (WKPageRestoreFromSessionState):
  • UIProcess/API/C/WKPage.h:

These will be filled in later:

  • UIProcess/WebPageProxy.cpp: (WebKit::WebPageProxy::sessionState): (WebKit::WebPageProxy::restoreFromSessionState):
  • UIProcess/WebPageProxy.h:
Location:
trunk/WebKit2
Files:
3 added
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit2/ChangeLog

    r64661 r64662  
     12010-08-04  Brady Eidson  <beidson@apple.com>
     2
     3        Reviewed by Sam Weinig.
     4
     5        Lay the groundwork for saving/restoring page session state to WK2
     6        https://bugs.webkit.org/show_bug.cgi?id=43495
     7
     8        * WebKit2.xcodeproj/project.pbxproj:
     9        * win/WebKit2.vcproj:
     10
     11        * Shared/APIObject.h:
     12        (WebKit::APIObject::):
     13        * UIProcess/API/C/WKAPICast.h:
     14        * UIProcess/API/C/WKBase.h:
     15       
     16        Arbitrary byte buffer:
     17        * Shared/WebData.h: Added.
     18        (WebKit::WebData::create):
     19        (WebKit::WebData::bytes):
     20        (WebKit::WebData::size):
     21        (WebKit::WebData::WebData):
     22        (WebKit::WebData::type):
     23       
     24        API facing object to act as a byte buffer:
     25        * UIProcess/API/C/WKData.cpp: Added.
     26        (WKDataGetTypeID):
     27        (WKDataCreate):
     28        (WKDataGetBytes):
     29        (WKDataGetSize):
     30        (WKDataRetain):
     31        (WKDataRelease):
     32        * UIProcess/API/C/WKData.h: Added.
     33
     34        API for saving/restoring state:
     35        * UIProcess/API/C/WKPage.cpp:
     36        (WKPageCopySessionState):
     37        (WKPageRestoreFromSessionState):
     38        * UIProcess/API/C/WKPage.h:
     39
     40        These will be filled in later:
     41        * UIProcess/WebPageProxy.cpp:
     42        (WebKit::WebPageProxy::sessionState):
     43        (WebKit::WebPageProxy::restoreFromSessionState):
     44        * UIProcess/WebPageProxy.h:
     45
     46
    1472010-08-04  Sam Weinig  <sam@webkit.org>
    248
  • trunk/WebKit2/Shared/APIObject.h

    r64253 r64662  
    3636        // Base types
    3737        TypeArray,
     38        TypeData,
    3839        TypeString,
    3940        TypeURL,
  • trunk/WebKit2/UIProcess/API/C/WKAPICast.h

    r64255 r64662  
    4343class WebBackForwardListItem;
    4444class WebContext;
     45class WebData;
    4546class WebFramePolicyListenerProxy;
    4647class WebFrameProxy;
     
    5354template<typename APIType> struct APITypeInfo { };
    5455template<> struct APITypeInfo<WKTypeRef>                        { typedef APIObject* ImplType; };
     56template<> struct APITypeInfo<WKArrayRef>                       { typedef ImmutableArray* ImplType; };
     57template<> struct APITypeInfo<WKBackForwardListItemRef>         { typedef WebBackForwardListItem* ImplType; };
     58template<> struct APITypeInfo<WKBackForwardListRef>             { typedef WebBackForwardList* ImplType; };
     59template<> struct APITypeInfo<WKContextRef>                     { typedef WebContext* ImplType; };
     60template<> struct APITypeInfo<WKDataRef>                        { typedef WebData* ImplType; };
     61template<> struct APITypeInfo<WKFramePolicyListenerRef>         { typedef WebFramePolicyListenerProxy* ImplType; };
    5562template<> struct APITypeInfo<WKFrameRef>                       { typedef WebFrameProxy* ImplType; };
     63template<> struct APITypeInfo<WKNavigationDataRef>              { typedef WebNavigationData* ImplType; };
     64template<> struct APITypeInfo<WKPageNamespaceRef>               { typedef WebPageNamespace* ImplType; };
    5665template<> struct APITypeInfo<WKPageRef>                        { typedef WebPageProxy* ImplType; };
    57 template<> struct APITypeInfo<WKContextRef>                     { typedef WebContext* ImplType; };
    58 template<> struct APITypeInfo<WKPageNamespaceRef>               { typedef WebPageNamespace* ImplType; };
    59 template<> struct APITypeInfo<WKFramePolicyListenerRef>         { typedef WebFramePolicyListenerProxy* ImplType; };
    6066template<> struct APITypeInfo<WKPreferencesRef>                 { typedef WebPreferences* ImplType; };
    6167template<> struct APITypeInfo<WKStringRef>                      { typedef WebString* ImplType; };
    6268template<> struct APITypeInfo<WKURLRef>                         { typedef WebURL* ImplType; };
    63 template<> struct APITypeInfo<WKNavigationDataRef>              { typedef WebNavigationData* ImplType; };
    64 template<> struct APITypeInfo<WKArrayRef>                       { typedef ImmutableArray* ImplType; };
    65 template<> struct APITypeInfo<WKBackForwardListItemRef>         { typedef WebBackForwardListItem* ImplType; };
    66 template<> struct APITypeInfo<WKBackForwardListRef>             { typedef WebBackForwardList* ImplType; };
     69
    6770
    6871template<typename ImplType> struct ImplTypeInfo { };
    6972template<> struct ImplTypeInfo<APIObject*>                      { typedef WKTypeRef APIType; };
     73template<> struct ImplTypeInfo<ImmutableArray*>                 { typedef WKArrayRef APIType; };
     74template<> struct ImplTypeInfo<WebBackForwardList*>             { typedef WKBackForwardListRef APIType; };
     75template<> struct ImplTypeInfo<WebBackForwardListItem*>         { typedef WKBackForwardListItemRef APIType; };
     76template<> struct ImplTypeInfo<WebContext*>                     { typedef WKContextRef APIType; };
     77template<> struct ImplTypeInfo<WebData*>                        { typedef WKDataRef APIType; };
     78template<> struct ImplTypeInfo<WebFramePolicyListenerProxy*>    { typedef WKFramePolicyListenerRef APIType; };
    7079template<> struct ImplTypeInfo<WebFrameProxy*>                  { typedef WKFrameRef APIType; };
     80template<> struct ImplTypeInfo<WebNavigationData*>              { typedef WKNavigationDataRef APIType; };
     81template<> struct ImplTypeInfo<WebPageNamespace*>               { typedef WKPageNamespaceRef APIType; };
    7182template<> struct ImplTypeInfo<WebPageProxy*>                   { typedef WKPageRef APIType; };
    72 template<> struct ImplTypeInfo<WebContext*>                     { typedef WKContextRef APIType; };
    73 template<> struct ImplTypeInfo<WebPageNamespace*>               { typedef WKPageNamespaceRef APIType; };
    74 template<> struct ImplTypeInfo<WebFramePolicyListenerProxy*>    { typedef WKFramePolicyListenerRef APIType; };
    7583template<> struct ImplTypeInfo<WebPreferences*>                 { typedef WKPreferencesRef APIType; };
    7684template<> struct ImplTypeInfo<WebString*>                      { typedef WKStringRef APIType; };
    7785template<> struct ImplTypeInfo<WebURL*>                         { typedef WKURLRef APIType; };
    78 template<> struct ImplTypeInfo<WebNavigationData*>              { typedef WKNavigationDataRef APIType; };
    79 template<> struct ImplTypeInfo<ImmutableArray*>                 { typedef WKArrayRef APIType; };
    80 template<> struct ImplTypeInfo<WebBackForwardListItem*>         { typedef WKBackForwardListItemRef APIType; };
    81 template<> struct ImplTypeInfo<WebBackForwardList*>             { typedef WKBackForwardListRef APIType; };
     86
    8287
    8388template<typename ImplType, typename APIType = typename ImplTypeInfo<ImplType*>::APIType>
  • trunk/WebKit2/UIProcess/API/C/WKBase.h

    r64380 r64662  
    4040typedef struct OpaqueWKBackForwardListRef* WKBackForwardListRef;
    4141typedef struct OpaqueWKContext* WKContextRef;
     42typedef struct OpaqueWKData* WKDataRef;
    4243typedef struct OpaqueWKFrame* WKFrameRef;
    4344typedef struct OpaqueWKFramePolicyListener* WKFramePolicyListenerRef;
  • trunk/WebKit2/UIProcess/API/C/WKPage.cpp

    r64386 r64662  
    2929#include "WKAPICast.h"
    3030#include "WebBackForwardList.h"
     31#include "WebData.h"
    3132#include "WebPageProxy.h"
    3233
     
    132133}
    133134
     135WKDataRef WKPageCopySessionState(WKPageRef pageRef)
     136{
     137    RefPtr<WebData> state = toWK(pageRef)->sessionState();
     138    return toRef(state.release().releaseRef());
     139}
     140
     141void WKPageRestoreFromSessionState(WKPageRef pageRef, WKDataRef sessionStateData)
     142{
     143    toWK(pageRef)->restoreFromSessionState(toWK(sessionStateData));
     144}
     145
    134146void WKPageSetPageLoaderClient(WKPageRef pageRef, const WKPageLoaderClient* wkClient)
    135147{
  • trunk/WebKit2/UIProcess/API/C/WKPage.h

    r64317 r64662  
    161161WK_EXPORT void WKPageTerminate(WKPageRef page);
    162162
     163WK_EXPORT WKDataRef WKPageCopySessionState(WKPageRef page);
     164WK_EXPORT void WKPageRestoreFromSessionState(WKPageRef page, WKDataRef sessionStateData);
     165
    163166WK_EXPORT void WKPageSetPageLoaderClient(WKPageRef page, const WKPageLoaderClient* client);
    164167WK_EXPORT void WKPageSetPagePolicyClient(WKPageRef page, const WKPagePolicyClient* client);
  • trunk/WebKit2/UIProcess/WebPageProxy.cpp

    r64594 r64662  
    3333#include "WebContext.h"
    3434#include "WebCoreArgumentCoders.h"
     35#include "WebData.h"
    3536#include "WebEvent.h"
    3637#include "WebPageMessageKinds.h"
     
    339340
    340341    process()->terminate();
     342}
     343
     344PassRefPtr<WebData> WebPageProxy::sessionState() const
     345{
     346    // FIXME: Return session state data for saving Page state.
     347    return 0;
     348}
     349
     350void WebPageProxy::restoreFromSessionState(WebData*)
     351{
     352    // FIXME: Restore the Page from the passed in session state data.
    341353}
    342354
  • trunk/WebKit2/UIProcess/WebPageProxy.h

    r64485 r64662  
    6464class WebBackForwardList;
    6565class WebBackForwardListItem;
     66class WebData;
    6667class WebKeyboardEvent;
    6768class WebMouseEvent;
     
    131132
    132133    void terminateProcess();
     134   
     135    PassRefPtr<WebData> sessionState() const;
     136    void restoreFromSessionState(WebData*);
    133137
    134138    void runJavaScriptInMainFrame(const WebCore::String&, PassRefPtr<ScriptReturnValueCallback>);
  • trunk/WebKit2/WebKit2.xcodeproj/project.pbxproj

    r64594 r64662  
    8787                1AEFD2F711D1807B008219D3 /* ArgumentCoders.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */; };
    8888                1AF3060A111B599E00F96436 /* WebKit2.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 8DC2EF5B0486A6940098B216 /* WebKit2.framework */; };
     89                514AF6C81209EE7300A26C97 /* WKData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 514AF6C61209EE7300A26C97 /* WKData.cpp */; };
     90                514AF6C91209EE7300A26C97 /* WKData.h in Headers */ = {isa = PBXBuildFile; fileRef = 514AF6C71209EE7300A26C97 /* WKData.h */; };
     91                51578B831209ECEF00A37C4A /* WebData.h in Headers */ = {isa = PBXBuildFile; fileRef = 51578B821209ECEF00A37C4A /* WebData.h */; };
    8992                5DAD729C116FF86200EE5396 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 0867D6A5FE840307C02AAC07 /* AppKit.framework */; };
    9093                6D8A91A611F0EFD100DD01FE /* com.apple.WebProcess.sb in Resources */ = {isa = PBXBuildFile; fileRef = 6D8A91A511F0EFD100DD01FE /* com.apple.WebProcess.sb */; };
     
    389392                1AEFD2F611D1807B008219D3 /* ArgumentCoders.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ArgumentCoders.h; sourceTree = "<group>"; };
    390393                32DBCF5E0370ADEE00C91783 /* WebKit2Prefix.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKit2Prefix.h; sourceTree = "<group>"; };
     394                514AF6C61209EE7300A26C97 /* WKData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKData.cpp; sourceTree = "<group>"; };
     395                514AF6C71209EE7300A26C97 /* WKData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKData.h; sourceTree = "<group>"; };
     396                51578B821209ECEF00A37C4A /* WebData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebData.h; sourceTree = "<group>"; };
    391397                5DAD7294116FF70B00EE5396 /* WebProcess.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = WebProcess.xcconfig; sourceTree = "<group>"; };
    392398                5DAD73F1116FF90C00EE5396 /* BaseTarget.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = BaseTarget.xcconfig; sourceTree = "<group>"; };
     
    773779                                0FB659221208B4DB0044816C /* DrawingAreaBase.h */,
    774780                                0FB659A51208B9EE0044816C /* DrawingAreaBase.cpp */,
    775                                 BCF04C8E11FF9F6E00F86A58 /* WebString.h */,
    776                                 BCDB86C01200FB97007254BE /* WebURL.h */,
    777781                                1A6F9F8E11E13EFC00DB1371 /* CommandLine.h */,
    778782                                BC64696D11DBE603006455B0 /* ImmutableArray.cpp */,
     
    780784                                BCC57161115ADB42001CCAF9 /* NotImplemented.h */,
    781785                                BC1DD7B1114DC396005ADAF3 /* WebCoreArgumentCoders.h */,
     786                                51578B821209ECEF00A37C4A /* WebData.h */,
    782787                                BC032DAF10F4380F0058C15A /* WebEvent.h */,
    783788                                BC032DB010F4380F0058C15A /* WebEventConversion.cpp */,
     
    786791                                BCD598AB112B7FDF00EC8C23 /* WebPreferencesStore.cpp */,
    787792                                BCD598AA112B7FDF00EC8C23 /* WebPreferencesStore.h */,
     793                                BCF04C8E11FF9F6E00F86A58 /* WebString.h */,
     794                                BCDB86C01200FB97007254BE /* WebURL.h */,
    788795                        );
    789796                        path = Shared;
     
    983990                                BCB9E2491120E15C00A137E0 /* WKContext.h */,
    984991                                BCC938E01180DE440085E5FE /* WKContextPrivate.h */,
     992                                514AF6C61209EE7300A26C97 /* WKData.cpp */,
     993                                514AF6C71209EE7300A26C97 /* WKData.h */,
    985994                                BCD01398110FA420003B8A67 /* WKFrame.cpp */,
    986995                                BCD01397110FA420003B8A67 /* WKFrame.h */,
     
    13471356                                D3B9484911FF4B6500032B39 /* WebSearchPopupMenu.h in Headers */,
    13481357                                0FB659231208B4DB0044816C /* DrawingAreaBase.h in Headers */,
     1358                                51578B831209ECEF00A37C4A /* WebData.h in Headers */,
     1359                                514AF6C91209EE7300A26C97 /* WKData.h in Headers */,
    13491360                        );
    13501361                        runOnlyForDeploymentPostprocessing = 0;
     
    15511562                                D3B9484811FF4B6500032B39 /* WebSearchPopupMenu.cpp in Sources */,
    15521563                                0FB659A61208B9EE0044816C /* DrawingAreaBase.cpp in Sources */,
     1564                                514AF6C81209EE7300A26C97 /* WKData.cpp in Sources */,
    15531565                        );
    15541566                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/WebKit2/win/WebKit2.vcproj

    r64645 r64662  
    974974                        </File>
    975975                        <File
     976                                RelativePath="..\UIProcess\WebData.h"
     977                                >
     978                        </File>
     979                        <File
    976980                                RelativePath="..\UIProcess\WebFramePolicyListenerProxy.cpp"
    977981                                >
     
    11211125                                        <File
    11221126                                                RelativePath="..\UIProcess\API\C\WKContextPrivate.h"
     1127                                                >
     1128                                        </File>
     1129                                        <File
     1130                                                RelativePath="..\UIProcess\API\C\WKData.cpp"
     1131                                                >
     1132                                        </File>
     1133                                        <File
     1134                                                RelativePath="..\UIProcess\API\C\WKData.h"
    11231135                                                >
    11241136                                        </File>
Note: See TracChangeset for help on using the changeset viewer.