[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

rjw rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:43:41 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 94db643121ce4b5c323db285ba264c706e2431d1
Author: rjw <rjw at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat May 31 00:37:40 2003 +0000

    WebKit:
            Fixed 3272516.  Items are now expired from the
            b/f cache if they are older than 30 minutes.  This
            number was pulled out of our #!$es.  Also did
            some cleanup of the b/f cache code.
    
            Reviewed by Ken.
    
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge saveDocumentToPageCache:]):
            * WebView.subproj/WebFramePrivate.h:
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _transitionToCommitted:]):
            (-[WebFrame _createPageCacheForItem:]):
            (-[WebFrame _setState:]):
            (-[WebFrame _loadItem:withLoadType:]):
            (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
            * WebView.subproj/WebPreferences.m:
            (+[WebPreferences initialize]):
            (-[WebPreferences _resourceTimedLayoutEnabled]):
            (-[WebPreferences _backForwardCacheExpirationInterval]):
            * WebView.subproj/WebPreferencesPrivate.h:
            * WebView.subproj/WebView.h:
    
            * WebView.subproj/WebPreferences.h: Cleaned up some headerdoc
            comments.
    
    WebCore:
            As part of some cleanup when fixing 3272516 changed use of
            @"" for cache keys to NSString declarations.
    
            Reviewed by Ken.
    
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@4458 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index b183709..53e2cd7 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,13 @@
+2003-05-30  Richard Williamson  <rjw at apple.com>
+
+	As part of some cleanup when fixing 3272516 changed use of
+	@"" for cache keys to NSString declarations.
+
+        Reviewed by Ken.
+
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
+
 2003-05-30  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3269129 and 3269220.  setAttribute('value') didn't work
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index b183709..53e2cd7 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2003-05-30  Richard Williamson  <rjw at apple.com>
+
+	As part of some cleanup when fixing 3272516 changed use of
+	@"" for cache keys to NSString declarations.
+
+        Reviewed by Ken.
+
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge openURL:reload:contentType:refresh:lastModified:pageCache:]):
+
 2003-05-30  David Hyatt  <hyatt at apple.com>
 
 	Fix for 3269129 and 3269220.  setAttribute('value') didn't work
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index a418ed8..25d6511 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -92,6 +92,8 @@ NSString *WebCoreElementLinkLabelKey = 		@"WebElementLinkLabel";
 NSString *WebCoreElementLinkTitleKey = 		@"WebElementLinkTitle";
 NSString *WebCoreElementNameKey = 		@"WebElementName";
 
+NSString *WebCorePageCacheStateKey =               @"WebCorePageCacheState";
+
 @implementation WebCoreBridge
 
 static bool initializedObjectCacheSize = FALSE;
@@ -159,7 +161,7 @@ static bool initializedObjectCacheSize = FALSE;
 - (void)openURL:(NSString *)URL reload:(BOOL)reload contentType:(NSString *)contentType refresh:(NSString *)refresh lastModified:(NSDate *)lastModified pageCache:(NSDictionary *)pageCache
 {
     if (pageCache) {
-        KWQPageState *state = [pageCache objectForKey:@"WebCorePageState"];
+        KWQPageState *state = [pageCache objectForKey:WebCorePageCacheStateKey];
         _part->openURLFromPageCache(state);
         [state invalidate];
         return;
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index e570d23..d46c471 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,31 @@
+2003-05-30  Richard Williamson  <rjw at apple.com>
+
+	Fixed 3272516.  Items are now expired from the
+	b/f cache if they are older than 30 minutes.  This
+	number was pulled out of our #!$es.  Also did
+	some cleanup of the b/f cache code.
+
+        Reviewed by Ken.
+
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge saveDocumentToPageCache:]):
+        * WebView.subproj/WebFramePrivate.h:
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _transitionToCommitted:]):
+        (-[WebFrame _createPageCacheForItem:]):
+        (-[WebFrame _setState:]):
+        (-[WebFrame _loadItem:withLoadType:]):
+        (-[WebFrame _continueLoadRequestAfterNavigationPolicy:formState:]):
+        * WebView.subproj/WebPreferences.m:
+        (+[WebPreferences initialize]):
+        (-[WebPreferences _resourceTimedLayoutEnabled]):
+        (-[WebPreferences _backForwardCacheExpirationInterval]):
+        * WebView.subproj/WebPreferencesPrivate.h:
+        * WebView.subproj/WebView.h:
+
+        * WebView.subproj/WebPreferences.h: Cleaned up some headerdoc
+	comments.
+	
 2003-05-29  Richard Williamson   <rjw at apple.com>
 
 	Implemented 'estimatedProgress' method on WebView.  This should
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index d111115..d88ccbc 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -506,7 +506,7 @@
     if (![item hasPageCache]) {
         return false;
     }
-    [[item pageCache] setObject: documentInfo forKey: @"WebCorePageState"];
+    [[item pageCache] setObject: documentInfo forKey: WebCorePageCacheStateKey];
     return true;
 }
 
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 4030e71..53cb543 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -50,6 +50,12 @@ typedef enum {
 #define WebPreviousFrameState @"WebPreviousFrameState"
 #define WebCurrentFrameState  @"WebCurrentFrameState"
 
+// Keys for accessing the values in the page cache dictionary.
+extern NSString *WebPageCacheEntryDateKey;
+extern NSString *WebPageCacheDataSourceKey;
+extern NSString *WebPageCacheDocumentViewKey;
+extern NSString *WebCorePageCacheStateKey;
+
 @interface WebFramePrivate : NSObject
 {
 @public
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 6bb5db5..14de4c2 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -92,6 +92,11 @@ Repeat load of the same URL (by any other means of navigation other than the rel
  Add to back/forward list: NO
 */
 
+NSString *WebPageCacheEntryDateKey = @"WebPageCacheEntryDateKey";
+NSString *WebPageCacheDataSourceKey = @"WebPageCacheDataSourceKey";
+NSString *WebPageCacheDocumentViewKey = @"WebPageCacheDocumentViewKey";
+NSString *WebCorePageCacheStateKey = @"WebCorePageCacheState";
+
 @interface NSObject (WebExtraPerformMethod)
 
 - (id)performSelector:(SEL)aSelector withObject:(id)object1 withObject:(id)object2 withObject:(id)object3;
@@ -634,7 +639,7 @@ Repeat load of the same URL (by any other means of navigation other than the rel
                     
                     // Create a document view for this document, or used the cached view.
                     if (pageCache){
-                        NSView <WebDocumentView> *cachedView = [pageCache objectForKey: @"WebKitDocumentView"];
+                        NSView <WebDocumentView> *cachedView = [pageCache objectForKey: WebPageCacheDocumentViewKey];
                         ASSERT(cachedView != nil);
                         [[self frameView] _setDocumentView: cachedView];
                     }
@@ -782,6 +787,19 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     return _timeOfLastCompletedLoad;
 }
 
+- (void)_createPageCacheForItem:(WebHistoryItem *)item
+{
+    NSMutableDictionary *pageCache;
+
+    [item setHasPageCache: YES];
+    pageCache = [item pageCache];
+    [[self dataSource] _setStoredInPageCache: YES];
+    [pageCache setObject: [NSDate date]  forKey: WebPageCacheEntryDateKey];
+    [pageCache setObject: [self dataSource] forKey: WebPageCacheDataSourceKey];
+    [pageCache setObject: [[self frameView] documentView] forKey: WebPageCacheDocumentViewKey];
+    [_private->bridge saveDocumentToPageCache];
+}
+
 - (void)_setState: (WebFrameState)newState
 {
     LOG(Loading, "%@:  transition from %s to %s", [self name], stateNames[_private->state], stateNames[newState]);
@@ -826,14 +844,18 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         {
             if (![item pageCache]){
                 LOG(PageCache, "Saving page to back/forward cache, %s\n", [[[[self dataSource] _URL] absoluteString] cString]);
-                [item setHasPageCache: YES];
-                [[self dataSource] _setStoredInPageCache: YES];
-                [[item pageCache] setObject: [self dataSource] forKey: @"WebKitDataSource"];
-                [[item pageCache] setObject: [[self frameView] documentView] forKey: @"WebKitDocumentView"];
-                [_private->bridge saveDocumentToPageCache];
+
+                // Add the items to this page's cache.
+                [self _createPageCacheForItem:item];
+
+                // See if any page caches need to be purged after the addition of this
+                // new page cache.
                 [self _purgePageCache];
             }
         }
+        else {
+            LOG(PageCache, "NOT saving page to back/forward cache, %s\n", [[[[self dataSource] _URL] absoluteString] cString]);
+        }
     }
     
     if (_private->state == WebFrameStateComplete) {
@@ -1167,11 +1189,28 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
         [_private setProvisionalItem:item];
 
         WebDataSource *newDataSource;
+        BOOL inPageCache = NO;
+        
+        // Check if we'll be using the page cache.  We only use the page cache
+        // if one exists and it is less than _backForwardCacheExpirationInterval
+        // seconds old.  If the cache is expired it gets flushed here.
         if ([item hasPageCache]){
-            newDataSource = [[item pageCache] objectForKey: @"WebKitDataSource"];
-            [self _loadDataSource:newDataSource withLoadType:loadType formState:nil];            
+            NSDictionary *pageCache = [item pageCache];
+            NSDate *cacheDate = [pageCache objectForKey: WebPageCacheEntryDateKey];
+            NSTimeInterval delta = [[NSDate date] timeIntervalSinceDate: cacheDate];
+
+            if (delta <= [[WebPreferences standardPreferences] _backForwardCacheExpirationInterval]){
+                newDataSource = [pageCache objectForKey: WebPageCacheDataSourceKey];
+                [self _loadDataSource:newDataSource withLoadType:loadType formState:nil];   
+                inPageCache = YES;
+            }         
+            else {
+                LOG (PageCache, "Not restoring page from back/forward cache because cache entry has expired, %s (%3.5f > %3.5f seconds)\n", [[[[_private provisionalItem] URL] absoluteString] cString], delta, [[WebPreferences standardPreferences] _backForwardCacheExpirationInterval]);
+                [item setHasPageCache: NO];
+            }
         }
-        else {
+        
+        if (!inPageCache) {
             NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:itemURL];
             [self _addExtraFieldsToRequest:request alwaysFromRequest: (formData != nil)?YES:NO];
 
@@ -2010,25 +2049,28 @@ static CFAbsoluteTime _timeOfLastCompletedLoad;
     if (self == [[self webView] mainFrame])
         LOG(DocumentLoad, "loading %@", [[[self provisionalDataSource] request] URL]);
 
+    WebHistoryItem *item = [_private provisionalItem];
     WebFrameLoadType loadType = [self _loadType];
     if ((loadType == WebFrameLoadTypeForward ||
         loadType == WebFrameLoadTypeBack ||
         loadType == WebFrameLoadTypeIndexedBackForward) &&
-        [[_private provisionalItem] hasPageCache]){
+        [item hasPageCache]){
         NSDictionary *pageCache = [[_private provisionalItem] pageCache];
-        if ([pageCache objectForKey:@"WebCorePageState"]){
+        if ([pageCache objectForKey:WebCorePageCacheStateKey]){
             LOG (PageCache, "Restoring page from back/forward cache, %s\n", [[[[_private provisionalItem] URL] absoluteString] cString]);
             [_private->provisionalDataSource _startLoading: pageCache];
+            return;
         }
-    } else {
-        if (formState) {
-            // It's a bit of a hack to reuse the WebPolicyDecisionListener for the continuation
-            // mechanism across the willSubmitForm callout.
-            _private->listener = [[WebPolicyDecisionListener alloc] _initWithTarget:self action:@selector(_continueAfterWillSubmitForm:)];
-            [[[self webView] _formDelegate] frame:self sourceFrame:[formState sourceFrame] willSubmitForm:[formState form] withValues:[formState values] submissionListener:_private->listener];
-        } else {
-            [self _continueAfterWillSubmitForm:WebPolicyUse];
-        }
+    }
+
+    if (formState) {
+        // It's a bit of a hack to reuse the WebPolicyDecisionListener for the continuation
+        // mechanism across the willSubmitForm callout.
+        _private->listener = [[WebPolicyDecisionListener alloc] _initWithTarget:self action:@selector(_continueAfterWillSubmitForm:)];
+        [[[self webView] _formDelegate] frame:self sourceFrame:[formState sourceFrame] willSubmitForm:[formState form] withValues:[formState values] submissionListener:_private->listener];
+    } 
+    else {
+        [self _continueAfterWillSubmitForm:WebPolicyUse];
     }
 }
 
diff --git a/WebKit/WebView.subproj/WebPreferences.h b/WebKit/WebView.subproj/WebPreferences.h
index 6f46a97..e3aece2 100644
--- a/WebKit/WebView.subproj/WebPreferences.h
+++ b/WebKit/WebView.subproj/WebPreferences.h
@@ -253,7 +253,7 @@ extern NSString *WebPreferencesChangedNotification;
 - (BOOL)loadsImagesAutomatically;
 
 /*!
-    @method setAutosavesPreferences:
+    @method setAutosaves:
     @param flag 
     @discussion If autosave preferences is YES the settings represented by
     WebPreferences will be stored in the user defaults database.
@@ -261,7 +261,7 @@ extern NSString *WebPreferencesChangedNotification;
 - (void)setAutosaves:(BOOL)flag;
 
 /*!
-    @method autosavesPreferences
+    @method autosaves
     @result The value of the autosave preferences flag.
 */
 - (BOOL)autosaves;
diff --git a/WebKit/WebView.subproj/WebPreferences.m b/WebKit/WebView.subproj/WebPreferences.m
index ee69230..e3a5814 100644
--- a/WebKit/WebView.subproj/WebPreferences.m
+++ b/WebKit/WebView.subproj/WebPreferences.m
@@ -37,6 +37,7 @@
 #define WebKitDisplayImagesKey @"WebKitDisplayImagesKey"
 #define WebKitPageCacheSizePreferenceKey @"WebKitPageCacheSizePreferenceKey"
 #define WebKitObjectCacheSizePreferenceKey @"WebKitObjectCacheSizePreferenceKey"
+#define WebKitBackForwardCacheExpirationIntervalKey @"WebKitBackForwardCacheExpirationIntervalKey"
 
 NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
 
@@ -197,6 +198,7 @@ NS_ENDHANDLER
         [NSNumber numberWithBool:YES],  WebKitAllowAnimatedImagesPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitAllowAnimatedImageLoopingPreferenceKey,
         [NSNumber numberWithBool:YES],  WebKitDisplayImagesKey,
+        @"1800",                        WebKitBackForwardCacheExpirationIntervalKey,
         nil];
 
     [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
@@ -512,6 +514,11 @@ NS_ENDHANDLER
     return [[NSUserDefaults standardUserDefaults] boolForKey:WebKitResourceTimedLayoutEnabledPreferenceKey];
 }
 
+- (NSTimeInterval)_backForwardCacheExpirationInterval
+{
+    return (NSTimeInterval)[[NSUserDefaults standardUserDefaults] floatForKey:WebKitBackForwardCacheExpirationIntervalKey];
+}
+
 static NSMutableDictionary *webPreferencesInstances = nil;
 
 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
diff --git a/WebKit/WebView.subproj/WebPreferencesPrivate.h b/WebKit/WebView.subproj/WebPreferencesPrivate.h
index abae4c1..d5dbcf0 100644
--- a/WebKit/WebView.subproj/WebPreferencesPrivate.h
+++ b/WebKit/WebView.subproj/WebPreferencesPrivate.h
@@ -19,5 +19,6 @@
 + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)identifier;
 + (void)_removeReferenceForIdentifier:(NSString *)identifier;
 + (NSArray *)_userDefaultsKeysForIB;
+- (NSTimeInterval)_backForwardCacheExpirationInterval;
 
 @end
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 4b03d0c..14f311e 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -31,11 +31,11 @@ extern NSString *WebElementLinkTitleKey;	// NSString of the title of the anchor
 extern NSString *WebElementLinkLabelKey;	// NSString of the text within the anchor
 
 /*
- @discussion Notification sent by WebView when the value of estimatedProgress.
- @constant WebViewProgressStartedNotification Posted from whenever a load begins in the WebView, including
+ @discussion Notifications sent by WebView to mark the progress of loads.
+ @constant WebViewProgressStartedNotification Posted whenever a load begins in the WebView, including
  a load that is initiated in a subframe.  After receiving this notification zero or more
  WebViewProgressEstimateChangedNotifications will be sent.  The userInfo will be nil.
- @constant WebViewProgressEstimateChangedNotification Posted from whenever the value of
+ @constant WebViewProgressEstimateChangedNotification Posted whenever the value of
  estimatedProgress changes.  The userInfo will be nil.
  @constant WebViewProgressFinishedNotification Posted when the load for a WebView has finished.
  The userInfo will be nil.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list