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

sullivan sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 05:57:35 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit ccdb9dc6087aa671031a201353d8a980d3d19825
Author: sullivan <sullivan at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Mar 15 23:59:28 2002 +0000

    	Impose default-based limit (1000 by default) on number of history items
    	saved/loaded. Also instrumented timing for saving/loading history.
    
    	* History.subproj/IFWebHistoryPrivate.m:
    	(+[IFWebHistoryPrivate initialize]): register default for WebKitHistoryItemLimit.
    
    	(-[IFWebHistoryPrivate arrayRepresentation]): respect limit
    	(-[IFWebHistoryPrivate loadHistory]): respect limit, time the load.
    	(-[IFWebHistoryPrivate saveHistory]): time the save.
    
    	* WebKit.pbproj/project.pbxproj: version wars
    
    	* Debug/DebugUtilities.m: (-[IFWebHistory populateHistoryWithTestData:]):
    	Changed number of items generated by Populate History menu item to 1000.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@754 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index df597f5..8d2d523 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,4 +1,18 @@
 2002-03-15  John Sullivan  <sullivan at apple.com>
+
+	Impose default-based limit (1000 by default) on number of history items
+	saved/loaded. Also instrumented timing for saving/loading history.
+
+	* History.subproj/IFWebHistoryPrivate.m: 
+	(+[IFWebHistoryPrivate initialize]): register default for WebKitHistoryItemLimit.
+
+	(-[IFWebHistoryPrivate arrayRepresentation]): respect limit
+	(-[IFWebHistoryPrivate loadHistory]): respect limit, time the load.
+	(-[IFWebHistoryPrivate saveHistory]): time the save.
+
+	* WebKit.pbproj/project.pbxproj: version wars
+
+2002-03-15  John Sullivan  <sullivan at apple.com>
 	
 	Fixed bug where history entry images weren't showing up, except by historical
 	accident in some cases.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index df597f5..8d2d523 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,4 +1,18 @@
 2002-03-15  John Sullivan  <sullivan at apple.com>
+
+	Impose default-based limit (1000 by default) on number of history items
+	saved/loaded. Also instrumented timing for saving/loading history.
+
+	* History.subproj/IFWebHistoryPrivate.m: 
+	(+[IFWebHistoryPrivate initialize]): register default for WebKitHistoryItemLimit.
+
+	(-[IFWebHistoryPrivate arrayRepresentation]): respect limit
+	(-[IFWebHistoryPrivate loadHistory]): respect limit, time the load.
+	(-[IFWebHistoryPrivate saveHistory]): time the save.
+
+	* WebKit.pbproj/project.pbxproj: version wars
+
+2002-03-15  John Sullivan  <sullivan at apple.com>
 	
 	Fixed bug where history entry images weren't showing up, except by historical
 	accident in some cases.
diff --git a/WebKit/History.subproj/IFWebHistoryPrivate.m b/WebKit/History.subproj/IFWebHistoryPrivate.m
index 83a330d..3f223e8 100644
--- a/WebKit/History.subproj/IFWebHistoryPrivate.m
+++ b/WebKit/History.subproj/IFWebHistoryPrivate.m
@@ -19,6 +19,12 @@
 
 #pragma mark OBJECT FRAMEWORK
 
++ (void)initialize
+{
+    [[NSUserDefaults standardUserDefaults] registerDefaults:
+        [NSDictionary dictionaryWithObject: @"1000" forKey: @"WebKitHistoryItemLimit"]];    
+}
+
 - (id)initWithFile: (NSString *)file
 {
     if (![super init]) {
@@ -244,10 +250,14 @@
 - (NSArray *)arrayRepresentation
 {
     int dateCount, dateIndex;
+    int limit, totalSoFar;
     NSMutableArray *arrayRep;
 
     arrayRep = [NSMutableArray array];
 
+    limit = [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryItemLimit"];
+    totalSoFar = 0;
+    
     dateCount = [_entriesByDate count];
     for (dateIndex = 0; dateIndex < dateCount; ++dateIndex) {
         int entryCount, entryIndex;
@@ -256,6 +266,9 @@
         entries = [_entriesByDate objectAtIndex:dateIndex];
         entryCount = [entries count];
         for (entryIndex = 0; entryIndex < entryCount; ++entryIndex) {
+            if (totalSoFar++ >= limit) {
+                break;
+            }
             [arrayRep addObject: [[entries objectAtIndex:entryIndex] dictionaryRepresentation]];
         }
     }
@@ -273,53 +286,78 @@
     NSString *path;
     NSArray *array;
     int index, count;
-    
+    int limit;
+    double start, duration;
+    BOOL result;
+
+    start = CFAbsoluteTimeGetCurrent();
+    result = YES;
+
     path = [self file];
     if (path == nil) {
         WEBKITDEBUG("couldn't load history; couldn't find or create directory to store it in\n");
-        return NO;
-    }
-
-    array = [NSArray arrayWithContentsOfFile: path];
-    if (array == nil) {
-        if (![[NSFileManager defaultManager] fileExistsAtPath: path]) {
-            WEBKITDEBUG1("no history file found at %s\n",
-                         DEBUG_OBJECT(path));
+        result = NO;
+    } else {
+        array = [NSArray arrayWithContentsOfFile: path];
+        if (array == nil) {
+            if (![[NSFileManager defaultManager] fileExistsAtPath: path]) {
+                WEBKITDEBUG1("no history file found at %s\n",
+                             DEBUG_OBJECT(path));
+            } else {
+                WEBKITDEBUG1("attempt to read history from %s failed; perhaps contents are corrupted\n",
+                             DEBUG_OBJECT(path));
+            }
+            result = NO;
         } else {
-            WEBKITDEBUG1("attempt to read history from %s failed; perhaps contents are corrupted\n",
-                         DEBUG_OBJECT(path));
+            count = [array count];
+            limit = [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryItemLimit"];
+            count = MIN(count, limit);
+            for (index = 0; index < count; ++index) {
+                IFURIEntry *entry = [[IFURIEntry alloc] initFromDictionaryRepresentation:
+                    [array objectAtIndex: index]];
+                [self addEntry: entry];
+            }
         }
-        return NO;
     }
 
-    count = [array count];
-    for (index = 0; index < count; ++index) {
-        IFURIEntry *entry = [[IFURIEntry alloc] initFromDictionaryRepresentation:
-            [array objectAtIndex: index]];
-        [self addEntry: entry];
+    if (result == YES) {
+        duration = CFAbsoluteTimeGetCurrent() - start;
+        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "loading history from %s took %f seconds\n",
+                           DEBUG_OBJECT([self file]), duration);
     }
 
-    return YES;
+    return result;
 }
 
 - (BOOL)saveHistory
 {
     NSString *path;
     NSArray *array;
+    double start, duration;
+    BOOL result;
 
+    start = CFAbsoluteTimeGetCurrent();
+    result = YES;
+    
     path = [self file];
     if (path == nil) {
         WEBKITDEBUG("couldn't save history; couldn't find or create directory to store it in\n");
-        return NO;
+        result = NO;
+    } else {
+        array = [self arrayRepresentation];
+        if (![array writeToFile:path atomically:YES]) {
+            WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
+            result = NO;
+        }
     }
 
-    array = [self arrayRepresentation];
-    if ([array writeToFile:path atomically:YES]) {
-        return YES;
+    if (result == YES) {
+        duration = CFAbsoluteTimeGetCurrent() - start;
+        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "saving history to %s took %f seconds\n",
+                           DEBUG_OBJECT([self file]), duration);
     }
 
-    WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
-    return NO;
+    return result;
 }
 
 @end
diff --git a/WebKit/History.subproj/WebHistoryPrivate.m b/WebKit/History.subproj/WebHistoryPrivate.m
index 83a330d..3f223e8 100644
--- a/WebKit/History.subproj/WebHistoryPrivate.m
+++ b/WebKit/History.subproj/WebHistoryPrivate.m
@@ -19,6 +19,12 @@
 
 #pragma mark OBJECT FRAMEWORK
 
++ (void)initialize
+{
+    [[NSUserDefaults standardUserDefaults] registerDefaults:
+        [NSDictionary dictionaryWithObject: @"1000" forKey: @"WebKitHistoryItemLimit"]];    
+}
+
 - (id)initWithFile: (NSString *)file
 {
     if (![super init]) {
@@ -244,10 +250,14 @@
 - (NSArray *)arrayRepresentation
 {
     int dateCount, dateIndex;
+    int limit, totalSoFar;
     NSMutableArray *arrayRep;
 
     arrayRep = [NSMutableArray array];
 
+    limit = [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryItemLimit"];
+    totalSoFar = 0;
+    
     dateCount = [_entriesByDate count];
     for (dateIndex = 0; dateIndex < dateCount; ++dateIndex) {
         int entryCount, entryIndex;
@@ -256,6 +266,9 @@
         entries = [_entriesByDate objectAtIndex:dateIndex];
         entryCount = [entries count];
         for (entryIndex = 0; entryIndex < entryCount; ++entryIndex) {
+            if (totalSoFar++ >= limit) {
+                break;
+            }
             [arrayRep addObject: [[entries objectAtIndex:entryIndex] dictionaryRepresentation]];
         }
     }
@@ -273,53 +286,78 @@
     NSString *path;
     NSArray *array;
     int index, count;
-    
+    int limit;
+    double start, duration;
+    BOOL result;
+
+    start = CFAbsoluteTimeGetCurrent();
+    result = YES;
+
     path = [self file];
     if (path == nil) {
         WEBKITDEBUG("couldn't load history; couldn't find or create directory to store it in\n");
-        return NO;
-    }
-
-    array = [NSArray arrayWithContentsOfFile: path];
-    if (array == nil) {
-        if (![[NSFileManager defaultManager] fileExistsAtPath: path]) {
-            WEBKITDEBUG1("no history file found at %s\n",
-                         DEBUG_OBJECT(path));
+        result = NO;
+    } else {
+        array = [NSArray arrayWithContentsOfFile: path];
+        if (array == nil) {
+            if (![[NSFileManager defaultManager] fileExistsAtPath: path]) {
+                WEBKITDEBUG1("no history file found at %s\n",
+                             DEBUG_OBJECT(path));
+            } else {
+                WEBKITDEBUG1("attempt to read history from %s failed; perhaps contents are corrupted\n",
+                             DEBUG_OBJECT(path));
+            }
+            result = NO;
         } else {
-            WEBKITDEBUG1("attempt to read history from %s failed; perhaps contents are corrupted\n",
-                         DEBUG_OBJECT(path));
+            count = [array count];
+            limit = [[NSUserDefaults standardUserDefaults] integerForKey: @"WebKitHistoryItemLimit"];
+            count = MIN(count, limit);
+            for (index = 0; index < count; ++index) {
+                IFURIEntry *entry = [[IFURIEntry alloc] initFromDictionaryRepresentation:
+                    [array objectAtIndex: index]];
+                [self addEntry: entry];
+            }
         }
-        return NO;
     }
 
-    count = [array count];
-    for (index = 0; index < count; ++index) {
-        IFURIEntry *entry = [[IFURIEntry alloc] initFromDictionaryRepresentation:
-            [array objectAtIndex: index]];
-        [self addEntry: entry];
+    if (result == YES) {
+        duration = CFAbsoluteTimeGetCurrent() - start;
+        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "loading history from %s took %f seconds\n",
+                           DEBUG_OBJECT([self file]), duration);
     }
 
-    return YES;
+    return result;
 }
 
 - (BOOL)saveHistory
 {
     NSString *path;
     NSArray *array;
+    double start, duration;
+    BOOL result;
 
+    start = CFAbsoluteTimeGetCurrent();
+    result = YES;
+    
     path = [self file];
     if (path == nil) {
         WEBKITDEBUG("couldn't save history; couldn't find or create directory to store it in\n");
-        return NO;
+        result = NO;
+    } else {
+        array = [self arrayRepresentation];
+        if (![array writeToFile:path atomically:YES]) {
+            WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
+            result = NO;
+        }
     }
 
-    array = [self arrayRepresentation];
-    if ([array writeToFile:path atomically:YES]) {
-        return YES;
+    if (result == YES) {
+        duration = CFAbsoluteTimeGetCurrent() - start;
+        WEBKITDEBUGLEVEL2 (WEBKIT_LOG_TIMING, "saving history to %s took %f seconds\n",
+                           DEBUG_OBJECT([self file]), duration);
     }
 
-    WEBKITDEBUG2("attempt to save %s to %s failed\n", DEBUG_OBJECT(array), DEBUG_OBJECT(path));
-    return NO;
+    return result;
 }
 
 @end
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 7f16e62..549cda3 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -3,7 +3,7 @@
 	archiveVersion = 1;
 	classes = {
 	};
-	objectVersion = 34;
+	objectVersion = 36;
 	objects = {
 		014CEA440018CDF011CA2923 = {
 			buildRules = (

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list