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

kocienda kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:47:29 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 48e77d8d2e769baae5388887eb84d64f94c1d71c
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 7 18:35:29 2002 +0000

    	Fixed problem in the disk cache where disk writes, once they start, were not being
    	preempted by future activity through the cache (as it should). The issue here is
    	that the disk cache was simply "borrowing" the thread that was used to call into
    	the disk cache to schedule a timer. This turned out to be bad, since that thread
    	was raised to maximum priority some time ago.
    
    	I fixed this by giving the disk cache its own (minimum priority) thread to
    	write files. This will insulate it from unrelated threading changes in other code.
    
            * Database.subproj/WebFileDatabase.m:
            (+[WebFileDatabase _syncLoop:])
            (databaseInit)
            (-[WebFileDatabase setTimer])
            (-[WebFileDatabase setObject:forKey:])
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2263 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/Misc.subproj/WebFileDatabase.m b/WebKit/Misc.subproj/WebFileDatabase.m
index 9bf1e6b..30597f3 100644
--- a/WebKit/Misc.subproj/WebFileDatabase.m
+++ b/WebKit/Misc.subproj/WebFileDatabase.m
@@ -13,13 +13,26 @@
 #import "WebFileDatabase.h"
 #import "WebNSFileManagerExtras.h"
 #import "WebFoundationLogging.h"
+#import "WebSystemBits.h"
 
 #define SIZE_FILE_NAME @".size"
 #define SIZE_FILE_NAME_CSTRING ".size"
 
+#if ERROR_DISABLED
+#define BEGIN_EXCEPTION_HANDLER
+#define END_EXCEPTION_HANDLER
+#else
+#define BEGIN_EXCEPTION_HANDLER NS_DURING
+#define END_EXCEPTION_HANDLER \
+    NS_HANDLER \
+        ERROR("Uncaught exception: %@ [%@] [%@]", [localException class], [localException reason], [localException userInfo]); \
+    NS_ENDHANDLER
+#endif
+
 static pthread_once_t databaseInitControl = PTHREAD_ONCE_INIT;
 static NSNumber *WebFileDirectoryPOSIXPermissions;
 static NSNumber *WebFilePOSIXPermissions;
+static NSRunLoop *syncRunLoop;
 
 typedef enum
 {
@@ -453,6 +466,28 @@ static void URLFileReaderInit(void)
 // creation functions ---------------------------------------------------------------------------
 #pragma mark creation functions
 
++(void)_syncLoop:(id)arg
+{
+    WebSetThreadPriority(WebMinThreadPriority);
+
+    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
+
+    BEGIN_EXCEPTION_HANDLER
+
+    syncRunLoop = [NSRunLoop currentRunLoop];
+
+    while (YES) {
+        BEGIN_EXCEPTION_HANDLER
+        // we specifically use an NSRunLoop here to get autorelease pool support
+        [[NSRunLoop currentRunLoop] run];
+        END_EXCEPTION_HANDLER
+    }
+
+    END_EXCEPTION_HANDLER
+
+    [pool release];
+}
+
 static void databaseInit()
 {
     // set file perms to owner read/write/execute only
@@ -460,6 +495,8 @@ static void databaseInit()
 
     // set file perms to owner read/write only
     WebFilePOSIXPermissions = [[NSNumber numberWithInt:(WEB_UREAD | WEB_UWRITE)] retain];
+
+    [NSThread detachNewThreadSelector:@selector(_syncLoop:) toTarget:[WebFileDatabase class] withObject:nil];
 }
 
 -(id)initWithPath:(NSString *)thePath
@@ -502,7 +539,8 @@ static void databaseInit()
 -(void)setTimer
 {
     if (timer == nil) {
-        timer = [[NSTimer scheduledTimerWithTimeInterval:SYNC_IDLE_THRESHOLD target:self selector:@selector(lazySync:) userInfo:nil repeats:YES] retain];
+        timer = [[NSTimer timerWithTimeInterval:SYNC_IDLE_THRESHOLD target:self selector:@selector(lazySync:) userInfo:nil repeats:YES] retain];
+        [syncRunLoop addTimer:timer forMode:NSDefaultRunLoopMode];
     }
 }
 
@@ -517,6 +555,8 @@ static void databaseInit()
     ASSERT(key);
 
     touch = CFAbsoluteTimeGetCurrent();
+
+    LOG(DiskCacheActivity, "setObject - %p - %@", object, key);
     
     [mutex lock];
     

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list