[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:17:39 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 4ac4c4b8a036a6bd5835d8dbd852561bcb95403a
Author: kocienda <kocienda at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jun 7 23:04:51 2002 +0000

    2002-06-07  Kenneth Kocienda  <kocienda at apple.com>
    
            Reviewed by: Darin Adler
    
            Fix for this bug:
    
            Radar 2949680 (IFURLFileDatabase will not work properly with hard disk quotas)
    
            Rearranges calls through to the code that expires files from the disk cache
            when the quota is exceeded. Now, files are deleted before writing a new cache
            entry, rather than writing the file first, and deleting files to get back under
            the quota.
    
            * Database.subproj/IFURLFileDatabase.m:
            (-[IFURLFileDatabase performSetObject:forKey:])
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@1303 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/Misc.subproj/WebFileDatabase.m b/WebKit/Misc.subproj/WebFileDatabase.m
index 96e7d0a..304eb8f 100644
--- a/WebKit/Misc.subproj/WebFileDatabase.m
+++ b/WebKit/Misc.subproj/WebFileDatabase.m
@@ -672,6 +672,11 @@ static void databaseInit()
     filePath = [[NSString alloc] initWithFormat:@"%@/%@", path, [IFURLFileDatabase uniqueFilePathForKey:key]];
     attributes = [defaultManager fileAttributesAtPath:filePath traverseLink:YES];
 
+    // update usage and truncate before writing file
+    // this has the effect of _always_ keeping disk usage under sizeLimit by clearing away space in anticipation of the write.
+    usage += [data length];
+    [self truncateToSizeLimit:[self sizeLimit]];
+
     result = [defaultManager _IF_createFileAtPathWithIntermediateDirectories:filePath contents:data attributes:attributes directoryAttributes:directoryAttributes];
 
     if (result) {
@@ -683,9 +688,11 @@ static void databaseInit()
                 usage -= [oldSize unsignedIntValue];
             }
         }
-        usage += [data length];
         [self writeSizeFile:usage];
-        [self truncateToSizeLimit:[self sizeLimit]];
+    }
+    else {
+        // we failed to write the file. don't charge this against usage.
+        usage -= [data length];
     }
 
     [archiver release];

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list