WebKit2: Use CFNetwork Sessions API.
authorjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 20:37:53 +0000 (20:37 +0000)
committerjberlin@webkit.org <jberlin@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 4 Mar 2011 20:37:53 +0000 (20:37 +0000)
https://bugs.webkit.org/show_bug.cgi?id=55435.

Reviewed by Maciej Stachowiak.

When Private Browsing is enabled, get the cached url response from the cache associated with
the Private Browsing Storage Session.

Source/WebCore:

* WebCore.exp.in:
Export the symbol for ResourceHandle::privateBrowsingStorageSession.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _cachedResponseForURL:]):

Source/WebKit2:

* WebProcess/WebPage/mac/WebPageMac.mm:
(WebKit::WebPage::platformHasLocalDataForURL):
If Private Browsing is enabled, call into WKSI to get the response.
(WebKit::WebPage::cachedResponseMIMETypeForURL):
Ditto.
* WebProcess/WebPage/win/WebPageWin.cpp:
(WebKit::WebPage::platformHasLocalDataForURL):
If Private Browsing is enabled, call into WKSI to get the CFURLCacheRef.
(WebKit::WebPage::cachedResponseMIMETypeForURL):
Ditto.

WebKitLibraries:

Update WebKitSystemInterface headers and libraries with the new functions.

* WebKitSystemInterface.h:
* libWebKitSystemInterfaceLeopard.a:
* libWebKitSystemInterfaceSnowLeopard.a:
* win/include/WebKitSystemInterface/WebKitSystemInterface.h:
* win/lib/WebKitSystemInterface.lib:

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

13 files changed:
Source/WebCore/ChangeLog
Source/WebCore/WebCore.exp.in
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/WebProcess/WebPage/mac/WebPageMac.mm
Source/WebKit2/WebProcess/WebPage/win/WebPageWin.cpp
WebKitLibraries/ChangeLog
WebKitLibraries/WebKitSystemInterface.h
WebKitLibraries/libWebKitSystemInterfaceLeopard.a
WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a
WebKitLibraries/win/include/WebKitSystemInterface/WebKitSystemInterface.h
WebKitLibraries/win/lib/WebKitSystemInterface.lib

index ba4289a..785c7ef 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        * WebCore.exp.in:
+        Export the symbol for ResourceHandle::privateBrowsingStorageSession.
+
 2011-03-04  Steve Block  <steveblock@google.com>
 
         Reviewed by Jeremy Orlow.
index 638c502..27cc1e5 100644 (file)
@@ -1790,4 +1790,5 @@ __ZN7WebCore12EventHandler18handleGestureEventERKNS_20PlatformGestureEventE
 
 #if USE(CFURLSTORAGESESSIONS)
 __ZN7WebCore14ResourceHandle46setPrivateBrowsingStorageSessionIdentifierBaseERKN3WTF6StringE
+__ZN7WebCore14ResourceHandle29privateBrowsingStorageSessionEv
 #endif
index 7fea19e..17dc4d4 100644 (file)
@@ -1,3 +1,16 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        * WebView/WebView.mm:
+        (-[WebView _cachedResponseForURL:]):
+
 2011-03-03  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Sam Weinig.
index 81dbc61..2f45ca4 100644 (file)
@@ -1871,7 +1871,13 @@ static inline IMP getMethod(id o, SEL s)
 {
     NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
     [request _web_setHTTPUserAgent:[self userAgentForURL:URL]];
-    NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+    NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cachedResponse = WKCachedResponseForRequest(storageSession, request);
+    else
+#endif
+        cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
     [request release];
     return cachedResponse;
 }
index 2eb26df..d24365f 100644 (file)
@@ -1,3 +1,24 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        * WebProcess/WebPage/mac/WebPageMac.mm:
+        (WebKit::WebPage::platformHasLocalDataForURL):
+        If Private Browsing is enabled, call into WKSI to get the response.
+        (WebKit::WebPage::cachedResponseMIMETypeForURL):
+        Ditto.
+        * WebProcess/WebPage/win/WebPageWin.cpp:
+        (WebKit::WebPage::platformHasLocalDataForURL):
+        If Private Browsing is enabled, call into WKSI to get the CFURLCacheRef.
+        (WebKit::WebPage::cachedResponseMIMETypeForURL):
+        Ditto.
+
 2011-03-04  Jeff Miller  <jeffm@apple.com>
 
         Reviewed by Darin Adler.
index 423e3a2..4cae5aa 100644 (file)
@@ -42,6 +42,7 @@
 #import <WebCore/KeyboardEvent.h>
 #import <WebCore/Page.h>
 #import <WebCore/PlatformKeyboardEvent.h>
+#import <WebCore/ResourceHandle.h>
 #import <WebCore/ScrollView.h>
 #import <WebCore/TextIterator.h>
 #import <WebCore/WindowsKeyboardCodes.h>
@@ -443,7 +444,13 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
 {
     NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
     [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
-    NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+    NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cachedResponse = WKCachedResponseForRequest(storageSession, request);
+    else
+#endif
+        cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
     [request release];
     
     return cachedResponse;
@@ -453,7 +460,13 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
 {
     NSMutableURLRequest* request = [[NSMutableURLRequest alloc] initWithURL:url];
     [request setValue:(NSString*)userAgent() forHTTPHeaderField:@"User-Agent"];
-    NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+    NSCachedURLResponse *cachedResponse;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cachedResponse = WKCachedResponseForRequest(storageSession, request);
+    else
+#endif
+        cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
     [request release];
     
     return [[cachedResponse response] MIMEType];
index e20af3a..73ba2b2 100644 (file)
@@ -36,6 +36,7 @@
 #include <WebCore/KeyboardEvent.h>
 #include <WebCore/Page.h>
 #include <WebCore/PlatformKeyboardEvent.h>
+#include <WebCore/ResourceHandle.h>
 #include <WebCore/Settings.h>
 #if PLATFORM(CG)
 #include <WebKitSystemInterface/WebKitSystemInterface.h>
@@ -253,7 +254,13 @@ bool WebPage::platformHasLocalDataForURL(const WebCore::KURL& url)
     RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
     CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
 
-    RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+    RetainPtr<CFURLCacheRef> cache;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cache.adoptCF(wkCopyURLCache(storageSession));
+    else
+#endif
+        cache.adoptCF(CFURLCacheCopySharedURLCache());
 
     RetainPtr<CFCachedURLResponseRef> response(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));    
     return response;
@@ -271,7 +278,13 @@ String WebPage::cachedResponseMIMETypeForURL(const WebCore::KURL& url)
     RetainPtr<CFStringRef> userAgent(AdoptCF, userAgent().createCFString());
     CFURLRequestSetHTTPHeaderFieldValue(request.get(), CFSTR("User-Agent"), userAgent.get());
 
-    RetainPtr<CFURLCacheRef> cache(AdoptCF, CFURLCacheCopySharedURLCache());
+    RetainPtr<CFURLCacheRef> cache;
+#if USE(CFURLSTORAGESESSIONS)
+    if (CFURLStorageSessionRef storageSession = ResourceHandle::privateBrowsingStorageSession())
+        cache.adoptCF(wkCopyURLCache(storageSession));
+    else
+#endif
+        cache.adoptCF(CFURLCacheCopySharedURLCache());
 
     RetainPtr<CFCachedURLResponseRef> cachedResponse(AdoptCF, CFURLCacheCopyResponseForRequest(cache.get(), request.get()));
     
index a3d65e9..d89e9da 100644 (file)
@@ -1,3 +1,21 @@
+2011-03-04  Jessie Berlin  <jberlin@apple.com>
+
+        Reviewed by Maciej Stachowiak.
+
+        WebKit2: Use CFNetwork Sessions API.
+        https://bugs.webkit.org/show_bug.cgi?id=55435.
+
+        When Private Browsing is enabled, get the cached url response from the cache associated with
+        the Private Browsing Storage Session.
+
+        Update WebKitSystemInterface headers and libraries with the new functions.
+
+        * WebKitSystemInterface.h:
+        * libWebKitSystemInterfaceLeopard.a:
+        * libWebKitSystemInterfaceSnowLeopard.a:
+        * win/include/WebKitSystemInterface/WebKitSystemInterface.h:
+        * win/lib/WebKitSystemInterface.lib:
+
 2011-03-03  Jessie Berlin  <jberlin@apple.com>
 
         Reviewed by Adam Roben.
index efa7895..cd5281f 100644 (file)
@@ -236,6 +236,7 @@ CFStringRef WKCopyFoundationCacheDirectory(void);
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
 CFURLStorageSessionRef WKCreatePrivateStorageSession(CFStringRef);
 NSURLRequest *WKCopyRequestWithStorageSession(CFURLStorageSessionRef, NSURLRequest*);
+NSCachedURLResponse *WKCachedResponseForRequest(CFURLStorageSessionRef, NSURLRequest*);
 
 void WKSetVisibleApplicationName(CFStringRef);
 
index ba01d8a..c621579 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceLeopard.a differ
index 3f9bf21..dbda67e 100644 (file)
Binary files a/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a and b/WebKitLibraries/libWebKitSystemInterfaceSnowLeopard.a differ
index 575ef5c..28b2704 100644 (file)
@@ -65,6 +65,7 @@ typedef struct _CAImageQueue *CAImageQueueRef;
 typedef unsigned long CFTypeID;
 typedef struct _CFURLCredential* WKCFURLCredentialRef;
 typedef const struct __CFURLStorageSession* CFURLStorageSessionRef;
+typedef const struct _CFURLCache* CFURLCacheRef;
 
 void wkSetFontSmoothingLevel(int type);
 int wkGetFontSmoothingLevel();
@@ -98,6 +99,7 @@ void wkCFURLRequestSetHTTPRequestBodyParts(CFMutableURLRequestRef, CFArrayRef bo
 
 CFURLStorageSessionRef wkCreatePrivateStorageSession(CFStringRef identifier);
 void wkSetRequestStorageSession(CFURLStorageSessionRef, CFMutableURLRequestRef);
+CFURLCacheRef wkCopyURLCache(CFURLStorageSessionRef);
 
 CFArrayRef wkCFURLCacheCopyAllHostNamesInPersistentStore();
 void wkCFURLCacheDeleteHostNamesInPersistentStore(CFArrayRef hostNames);
index 5ab1d7c..50e5443 100644 (file)
Binary files a/WebKitLibraries/win/lib/WebKitSystemInterface.lib and b/WebKitLibraries/win/lib/WebKitSystemInterface.lib differ