[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

joepeck at webkit.org joepeck at webkit.org
Wed Dec 22 11:41:44 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 012da65c62a13f427a46fc1efebcbc9ce2fc7fd2
Author: joepeck at webkit.org <joepeck at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Aug 4 01:50:10 2010 +0000

    2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
    
    Reviewed by David Kilzer.
    
    WebKit:
    
        2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers
    
                * WebKit.xcodeproj/project.pbxproj: Add new Quota Managers, remove old SecurityOrigin subclasses.
    
    WebKit/mac:
    
        2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
    
                Reviewed by David Kilzer.
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers
    
                Per-Origin quotas exist for Databases and Application Caches. Clients
                given a WebSecurityOrigin have the ability to set the quota for any
                per-origin quota type. This puts quota management into an interface
                and WebSecurityOrigin allows access to quota managers for the
                different types of quotas.
    
                This also deprecates the old methods on WebSecurityOrigin. They are
                left in for now to prevent breaking older clients.
    
                  The WebQuotaManager interface allows querying and modifying a
                  per-origin quota. This is implemented for both Databases and
                  Application Caches.
    
                * Misc/WebQuotaManager.h: Added. Interface for quota management (usage, quota, setQuota).
                * Storage/WebDatabaseQuotaManager.h: Added.
                * Storage/WebDatabaseQuotaManager.mm: Added.
                (-[WebDatabaseQuotaManager origin]):
                (-[WebDatabaseQuotaManager usage]):
                (-[WebDatabaseQuotaManager quota]):
                (-[WebDatabaseQuotaManager setQuota:]):
                * Storage/WebDatabaseSecurityOrigin.h: Removed.
                * Storage/WebDatabaseSecurityOrigin.mm: Removed.
                * WebCoreSupport/WebApplicationCacheQuotaManager.h: Added.
                * WebCoreSupport/WebApplicationCacheQuotaManager.mm: Added.
                (-[WebApplicationCacheQuotaManager origin]):
                (-[WebApplicationCacheQuotaManager usage]):
                (-[WebApplicationCacheQuotaManager quota]):
                (-[WebApplicationCacheQuotaManager setQuota:]):
                * WebCoreSupport/WebSecurityOriginPrivate.h: Added a category to access managers. Deprecated old methods.
    
                  Remove the WebSecurityOrigin sub-classes. Managers are better.
    
                * WebCoreSupport/WebApplicationCacheSecurityOrigin.h: Removed.
                * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: Removed.
    
                  Create the managers lazily. Change old style calls to make use
                  of the managers.
    
                * WebCoreSupport/WebChromeClient.mm:
                (WebChromeClient::exceededDatabaseQuota):
                (WebChromeClient::reachedApplicationCacheOriginQuota):
                * WebCoreSupport/WebSecurityOrigin.mm:
                (-[WebSecurityOrigin applicationCacheQuotaManager]):
                (-[WebSecurityOrigin databaseQuotaManager]):
                (-[WebSecurityOrigin dealloc]): release the managers if they exist.
    
    WebKitTools:
    
        2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
    
                Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
                https://bugs.webkit.org/show_bug.cgi?id=40627
    
                Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers
    
                  Change old style calls to make use of the managers.
    
                * DumpRenderTree/mac/LayoutTestControllerMac.mm:
                (LayoutTestController::setDatabaseQuota):
                * DumpRenderTree/mac/UIDelegate.mm:
                (-[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:]):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64612 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 75181e6..5c83bfb 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,14 @@
+2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers
+
+        * WebKit.xcodeproj/project.pbxproj: Add new Quota Managers, remove old SecurityOrigin subclasses.
+
 2010-07-31  David Kilzer  <ddkilzer at apple.com>
 
         <http://webkit.org/b/43307> Make sure all private headers are copied to PrivateHeaders directory
diff --git a/WebKit/WebKit.xcodeproj/project.pbxproj b/WebKit/WebKit.xcodeproj/project.pbxproj
index e447b7f..52d5b6c 100644
--- a/WebKit/WebKit.xcodeproj/project.pbxproj
+++ b/WebKit/WebKit.xcodeproj/project.pbxproj
@@ -313,13 +313,14 @@
 		93EB178D09F88D460091F8FF /* WebSystemInterface.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93EB178C09F88D460091F8FF /* WebSystemInterface.mm */; };
 		93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB178E09F88D510091F8FF /* WebSystemInterface.h */; };
 		93FDE9330D79CAF30074F029 /* WebHistoryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */; };
+		A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A57E2F22120749E600048DF3 /* WebQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */; };
 		A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */; };
 		A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; };
-		A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */; };
-		A5DEFC1011D5343E00885273 /* WebDatabaseSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */; };
-		A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */; };
-		A5DEFC1411D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */; };
+		A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
+		A5DEFC1011D5343E00885273 /* WebDatabaseQuotaManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */; };
+		A5DEFC1311D5344B00885273 /* WebApplicationCacheQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */; };
+		A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */; };
 		A70936AF0B5608DC00CDB48E /* WebDragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A70936AD0B5608DC00CDB48E /* WebDragClient.h */; };
 		A70936B00B5608DC00CDB48E /* WebDragClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A70936AE0B5608DC00CDB48E /* WebDragClient.mm */; };
 		A7D3C5BC0B5773C5002CA450 /* WebPasteboardHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */; };
@@ -608,13 +609,14 @@
 		9CAE9D070252A4130ECA16EA /* WebPreferencesPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebPreferencesPrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageRendererFactory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
 		9CF0E249021361B00ECA16EA /* WebFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFramePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+		A57E2F22120749E600048DF3 /* WebQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebQuotaManager.h; sourceTree = "<group>"; };
 		A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; };
 		A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; };
 		A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; };
-		A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseSecurityOrigin.h; sourceTree = "<group>"; };
-		A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseSecurityOrigin.mm; sourceTree = "<group>"; };
-		A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheSecurityOrigin.h; sourceTree = "<group>"; };
-		A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCacheSecurityOrigin.mm; sourceTree = "<group>"; };
+		A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseQuotaManager.h; sourceTree = "<group>"; };
+		A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseQuotaManager.mm; sourceTree = "<group>"; };
+		A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheQuotaManager.h; sourceTree = "<group>"; };
+		A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCacheQuotaManager.mm; sourceTree = "<group>"; };
 		A70936AD0B5608DC00CDB48E /* WebDragClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDragClient.h; sourceTree = "<group>"; };
 		A70936AE0B5608DC00CDB48E /* WebDragClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClient.mm; sourceTree = "<group>"; };
 		A7D3C5BA0B5773C5002CA450 /* WebPasteboardHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPasteboardHelper.h; sourceTree = "<group>"; };
@@ -969,6 +971,7 @@
 				F508946A02B71D59018A9CD4 /* WebNSViewExtras.m */,
 				9345DDAE0365FB27008635CE /* WebNSWindowExtras.h */,
 				9345DDAF0365FB27008635CE /* WebNSWindowExtras.m */,
+				A57E2F22120749E600048DF3 /* WebQuotaManager.h */,
 				F59668C802AD2923018635CA /* WebStringTruncator.h */,
 				F59668C902AD2923018635CA /* WebStringTruncator.mm */,
 				DD7CDEE60A23BA9E00069928 /* WebTypesInternal.h */,
@@ -1020,8 +1023,8 @@
 				511F3FD10CECC88F00852565 /* WebDatabaseManager.mm */,
 				51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */,
 				511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */,
-				A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */,
-				A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */,
+				A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */,
+				A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */,
 				511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */,
 				511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */,
 			);
@@ -1238,8 +1241,8 @@
 			children = (
 				B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
 				B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
-				A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */,
-				A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */,
+				A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */,
+				A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */,
 				51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */,
 				14D8252D0AF955090004F057 /* WebChromeClient.h */,
 				14D8252E0AF955090004F057 /* WebChromeClient.mm */,
@@ -1569,8 +1572,9 @@
 				41F4484F10338E8C0030E55E /* WebWorkersPrivate.h in Headers */,
 				A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */,
 				A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */,
-				A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */,
-				A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */,
+				A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */,
+				A5DEFC1311D5344B00885273 /* WebApplicationCacheQuotaManager.h in Headers */,
+				A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
@@ -1930,8 +1934,8 @@
 				0FD3B0F91076C3F700039B96 /* WebWindowAnimation.m in Sources */,
 				41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */,
 				A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */,
-				A5DEFC1011D5343E00885273 /* WebDatabaseSecurityOrigin.mm in Sources */,
-				A5DEFC1411D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm in Sources */,
+				A5DEFC1011D5343E00885273 /* WebDatabaseQuotaManager.mm in Sources */,
+				A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 19a18de..d453073 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,58 @@
+2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers
+
+        Per-Origin quotas exist for Databases and Application Caches. Clients
+        given a WebSecurityOrigin have the ability to set the quota for any
+        per-origin quota type. This puts quota management into an interface
+        and WebSecurityOrigin allows access to quota managers for the
+        different types of quotas.
+
+        This also deprecates the old methods on WebSecurityOrigin. They are
+        left in for now to prevent breaking older clients.
+
+          The WebQuotaManager interface allows querying and modifying a
+          per-origin quota. This is implemented for both Databases and
+          Application Caches.
+
+        * Misc/WebQuotaManager.h: Added. Interface for quota management (usage, quota, setQuota).
+        * Storage/WebDatabaseQuotaManager.h: Added.
+        * Storage/WebDatabaseQuotaManager.mm: Added.
+        (-[WebDatabaseQuotaManager origin]):
+        (-[WebDatabaseQuotaManager usage]):
+        (-[WebDatabaseQuotaManager quota]):
+        (-[WebDatabaseQuotaManager setQuota:]):
+        * Storage/WebDatabaseSecurityOrigin.h: Removed.
+        * Storage/WebDatabaseSecurityOrigin.mm: Removed.
+        * WebCoreSupport/WebApplicationCacheQuotaManager.h: Added.
+        * WebCoreSupport/WebApplicationCacheQuotaManager.mm: Added.
+        (-[WebApplicationCacheQuotaManager origin]):
+        (-[WebApplicationCacheQuotaManager usage]):
+        (-[WebApplicationCacheQuotaManager quota]):
+        (-[WebApplicationCacheQuotaManager setQuota:]):
+        * WebCoreSupport/WebSecurityOriginPrivate.h: Added a category to access managers. Deprecated old methods.
+
+          Remove the WebSecurityOrigin sub-classes. Managers are better.
+
+        * WebCoreSupport/WebApplicationCacheSecurityOrigin.h: Removed.
+        * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: Removed.
+
+          Create the managers lazily. Change old style calls to make use
+          of the managers.
+
+        * WebCoreSupport/WebChromeClient.mm:
+        (WebChromeClient::exceededDatabaseQuota):
+        (WebChromeClient::reachedApplicationCacheOriginQuota):
+        * WebCoreSupport/WebSecurityOrigin.mm:
+        (-[WebSecurityOrigin applicationCacheQuotaManager]):
+        (-[WebSecurityOrigin databaseQuotaManager]):
+        (-[WebSecurityOrigin dealloc]): release the managers if they exist.
+
 2010-08-03  Alex Milowski  <alex at milowski.com>
 
         Reviewed by Beth Dakin.
diff --git a/WebKit/mac/Misc/WebQuotaManager.h b/WebKit/mac/Misc/WebQuotaManager.h
new file mode 100644
index 0000000..45074e4
--- /dev/null
+++ b/WebKit/mac/Misc/WebQuotaManager.h
@@ -0,0 +1,65 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+ at class WebSecurityOrigin;
+
+/*!
+    @protocol WebQuotaManager
+    @discussion This protocol is used to view and manipulate a per-origin storage quota.
+*/
+ at protocol WebQuotaManager
+
+/*!
+    @method initWithOrigin:
+    @param The security origin this will manage.
+    @result A new WebQuotaManager object.
+*/
+- (id)initWithOrigin:(WebSecurityOrigin *)origin;
+
+/*!
+    @method origin
+    @result The security origin this manager is managing.
+*/
+- (WebSecurityOrigin *)origin;
+
+/*!
+    @method usage
+    @result The current total usage of all relevant items in this security origin in bytes.
+*/
+- (unsigned long long)usage;
+
+/*!
+    @method quota
+    @result The current quota of security origin in bytes.
+*/
+- (unsigned long long)quota;
+
+/*!
+    @method setQuota:
+    @param Sets a new quota, in bytes, on this security origin.
+*/
+- (void)setQuota:(unsigned long long)quota;
+
+ at end
diff --git a/WebKit/mac/Storage/WebDatabaseQuotaManager.h b/WebKit/mac/Storage/WebDatabaseQuotaManager.h
new file mode 100644
index 0000000..8219da4
--- /dev/null
+++ b/WebKit/mac/Storage/WebDatabaseQuotaManager.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebQuotaManager.h"
+
+ at interface WebDatabaseQuotaManager : NSObject <WebQuotaManager> {
+    WebSecurityOrigin *_origin;
+}
+
+ at end
diff --git a/WebKit/mac/Storage/WebDatabaseQuotaManager.mm b/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
new file mode 100644
index 0000000..e26ae33
--- /dev/null
+++ b/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
@@ -0,0 +1,78 @@
+/*
+ * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebDatabaseQuotaManager.h"
+
+#import "WebSecurityOriginInternal.h"
+#import <WebCore/DatabaseTracker.h>
+
+using namespace WebCore;
+
+ at implementation WebDatabaseQuotaManager
+
+- (id)initWithOrigin:(WebSecurityOrigin *)origin
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _origin = origin;
+    return self;
+}
+
+- (WebSecurityOrigin *)origin
+{
+    return _origin;
+}
+
+- (unsigned long long)usage
+{
+#if ENABLE(DATABASE)
+    return DatabaseTracker::tracker().usageForOrigin([_origin _core]);
+#else
+    return 0;
+#endif
+}
+
+- (unsigned long long)quota
+{
+#if ENABLE(DATABASE)
+    return DatabaseTracker::tracker().quotaForOrigin([_origin _core]);
+#else
+    return 0;
+#endif
+}
+
+// If the quota is set to a value lower than the current usage, that quota will
+// "stick" but no data will be purged to meet the new quota. This will simply
+// prevent new data from being added to databases in that origin.
+- (void)setQuota:(unsigned long long)quota
+{
+#if ENABLE(DATABASE)
+    DatabaseTracker::tracker().setQuota([_origin _core], quota);
+#endif
+}
+
+ at end
diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h
deleted file mode 100644
index a06ca3d..0000000
--- a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WebSecurityOriginInternal.h"
-
- at interface WebDatabaseSecurityOrigin : WebSecurityOrigin
- at end
diff --git a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm b/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm
deleted file mode 100644
index a0c3529..0000000
--- a/WebKit/mac/Storage/WebDatabaseSecurityOrigin.mm
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright (C) 2007, 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WebDatabaseSecurityOrigin.h"
-#import <WebCore/SecurityOrigin.h>
-
-using namespace WebCore;
-
- at implementation WebDatabaseSecurityOrigin
-
-// FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627
-// Proper steps should be taken to have subclass implementations of SecurityOrigin's
-// origin, quota, and setQuota methods.
-
- at end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.h b/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.h
new file mode 100644
index 0000000..6d30148
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.h
@@ -0,0 +1,32 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebQuotaManager.h"
+
+ at interface WebApplicationCacheQuotaManager : NSObject <WebQuotaManager> {
+    WebSecurityOrigin *_origin;
+}
+
+ at end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm b/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm
new file mode 100644
index 0000000..562bb29
--- /dev/null
+++ b/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#import "WebApplicationCacheQuotaManager.h"
+
+#import "WebSecurityOriginInternal.h"
+#import <WebCore/ApplicationCacheStorage.h>
+
+using namespace WebCore;
+
+ at implementation WebApplicationCacheQuotaManager
+
+- (id)initWithOrigin:(WebSecurityOrigin *)origin
+{
+    self = [super init];
+    if (!self)
+        return nil;
+
+    _origin = origin;
+    return self;
+}
+
+- (WebSecurityOrigin *)origin
+{
+    return _origin;
+}
+
+- (unsigned long long)usage
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    long long usage;
+    if (cacheStorage().usageForOrigin([_origin _core], usage))
+        return usage;
+    return 0;
+#else
+    return 0;
+#endif
+}
+
+- (unsigned long long)quota
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    long long quota;
+    if (cacheStorage().quotaForOrigin([_origin _core], quota))
+        return quota;
+    return 0;
+#else
+    return 0;
+#endif
+}
+
+- (void)setQuota:(unsigned long long)quota
+{
+#if ENABLE(OFFLINE_WEB_APPLICATIONS)
+    cacheStorage().storeUpdatedQuotaForOrigin([_origin _core], quota);
+#endif
+}
+
+ at end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h
deleted file mode 100644
index 09c0610..0000000
--- a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.h
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WebSecurityOriginInternal.h"
-
- at interface WebApplicationCacheSecurityOrigin : WebSecurityOrigin
- at end
diff --git a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm
deleted file mode 100644
index dac41ae..0000000
--- a/WebKit/mac/WebCoreSupport/WebApplicationCacheSecurityOrigin.mm
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#import "WebApplicationCacheSecurityOrigin.h"
-
-#import <WebCore/ApplicationCacheStorage.h>
-
-using namespace WebCore;
-
- at implementation WebApplicationCacheSecurityOrigin
-
-- (unsigned long long)usage
-{
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    long long usage;
-    if (cacheStorage().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private), usage))
-        return usage;
-    return 0;
-#else
-    return 0;
-#endif
-}
-
-- (unsigned long long)quota
-{
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    long long quota;
-    if (cacheStorage().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota))
-        return quota;
-    return 0;
-#else
-    return 0;
-#endif
-}
-
-- (void)setQuota:(unsigned long long)quota
-{
-#if ENABLE(OFFLINE_WEB_APPLICATIONS)
-    cacheStorage().storeUpdatedQuotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private), quota);
-#endif
-}
-
- at end
diff --git a/WebKit/mac/WebCoreSupport/WebChromeClient.mm b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
index 1a3736e..c80721f 100644
--- a/WebKit/mac/WebCoreSupport/WebChromeClient.mm
+++ b/WebKit/mac/WebCoreSupport/WebChromeClient.mm
@@ -30,8 +30,6 @@
 #import "WebChromeClient.h"
 
 #import "DOMNodeInternal.h"
-#import "WebApplicationCacheSecurityOrigin.h"
-#import "WebDatabaseSecurityOrigin.h"
 #import "WebDefaultUIDelegate.h"
 #import "WebDelegateImplementationCaching.h"
 #import "WebElementDictionary.h"
@@ -43,6 +41,7 @@
 #import "WebKitSystemInterface.h"
 #import "WebNSURLRequestExtras.h"
 #import "WebPlugin.h"
+#import "WebQuotaManager.h"
 #import "WebSecurityOriginInternal.h"
 #import "WebUIDelegatePrivate.h"
 #import "WebView.h"
@@ -559,11 +558,11 @@ void WebChromeClient::exceededDatabaseQuota(Frame* frame, const String& database
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    WebDatabaseSecurityOrigin *webOrigin = [[WebDatabaseSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
+    WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];
     // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented.
     if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) {
         const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support.
-        [webOrigin setQuota:defaultQuota];
+        [[webOrigin databaseQuotaManager] setQuota:defaultQuota];
     } else
         CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName);
     [webOrigin release];
@@ -582,7 +581,7 @@ void WebChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin* origin)
 {
     BEGIN_BLOCK_OBJC_EXCEPTIONS;
 
-    WebApplicationCacheSecurityOrigin *webOrigin = [[WebApplicationCacheSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];
+    WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];
     CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:), webOrigin);
     [webOrigin release];
 
diff --git a/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
index 0d49445..f19dcb5 100644
--- a/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
+++ b/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
@@ -28,9 +28,12 @@
 
 #import "WebSecurityOriginInternal.h"
 
+#import "WebApplicationCacheQuotaManager.h"
+#import "WebDatabaseQuotaManager.h"
+#import "WebQuotaManager.h"
 #import <WebCore/KURL.h>
-#import <WebCore/SecurityOrigin.h>
 #import <WebCore/DatabaseTracker.h>
+#import <WebCore/SecurityOrigin.h>
 
 using namespace WebCore;
 
@@ -69,38 +72,6 @@ using namespace WebCore;
     return reinterpret_cast<SecurityOrigin*>(_private)->port();
 }
 
-// FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627
-// Proper steps should be taken to have subclass implementations of SecurityOrigin's
-// origin, quota, and setQuota methods.
-
-- (unsigned long long)usage
-{
-#if ENABLE(DATABASE)
-    return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
-#else
-    return 0;
-#endif
-}
-
-- (unsigned long long)quota
-{
-#if ENABLE(DATABASE)
-    return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
-#else
-    return 0;
-#endif
-}
-
-// If the quota is set to a value lower than the current usage, that quota will
-// "stick" but no data will be purged to meet the new quota. This will simply
-// prevent new data from being added to databases in that origin
-- (void)setQuota:(unsigned long long)quota
-{
-#if ENABLE(DATABASE)
-    DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
-#endif
-}
-
 - (BOOL)isEqual:(id)anObject
 {
     if (![anObject isMemberOfClass:[WebSecurityOrigin class]]) {
@@ -114,6 +85,10 @@ using namespace WebCore;
 {
     if (_private)
         reinterpret_cast<SecurityOrigin*>(_private)->deref();
+    if (_applicationCacheQuotaManager)
+        [(NSObject *)_applicationCacheQuotaManager release];
+    if (_databaseQuotaManager)
+        [(NSObject *)_databaseQuotaManager release];
     [super dealloc];
 }
 
@@ -147,3 +122,62 @@ using namespace WebCore;
 }
 
 @end
+
+
+#pragma mark -
+#pragma mark WebQuotaManagers
+
+ at implementation WebSecurityOrigin (WebQuotaManagers)
+
+- (id<WebQuotaManager>)applicationCacheQuotaManager
+{
+    if (!_applicationCacheQuotaManager)
+        _applicationCacheQuotaManager = [[WebApplicationCacheQuotaManager alloc] initWithOrigin:self];
+    return _applicationCacheQuotaManager;
+}
+
+- (id<WebQuotaManager>)databaseQuotaManager
+{
+    if (!_databaseQuotaManager)
+        _databaseQuotaManager = [[WebDatabaseQuotaManager alloc] initWithOrigin:self];
+    return _databaseQuotaManager;
+}
+
+ at end
+
+
+#pragma mark -
+#pragma mark Deprecated
+
+// FIXME: The following methods are deprecated and should removed later.
+// Clients should instead get a WebQuotaManager, and query / set the quota via the Manager.
+// NOTE: the <WebCore/DatabaseTracker.h> #include should be removed as well.
+
+ at implementation WebSecurityOrigin (Deprecated)
+
+- (unsigned long long)usage
+{
+#if ENABLE(DATABASE)
+    return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+#else
+    return 0;
+#endif
+}
+
+- (unsigned long long)quota
+{
+#if ENABLE(DATABASE)
+    return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));
+#else
+    return 0;
+#endif
+}
+
+- (void)setQuota:(unsigned long long)quota
+{
+#if ENABLE(DATABASE)
+    DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);
+#endif
+}
+
+ at end
diff --git a/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
index 6518a16..2973d92 100644
--- a/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
+++ b/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2007, 2010 Apple Inc.  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,9 +27,12 @@
  */
 
 @class WebSecurityOriginPrivate;
+ at protocol WebQuotaManager;
 
 @interface WebSecurityOrigin : NSObject {
     WebSecurityOriginPrivate *_private;
+    id<WebQuotaManager> _applicationCacheQuotaManager;
+    id<WebQuotaManager> _databaseQuotaManager;
 }
 
 - (id)initWithURL:(NSURL *)url;
@@ -40,16 +43,17 @@
 // Returns zero if the port is the default port for the protocol, non-zero otherwise.
 - (unsigned short)port;
 
-// Meant to be implemented in a subclass.
-// Returns the current total usage of all relevant items in this security origin in bytes.
-- (unsigned long long)usage;
+ at end
 
-// Meant to be implemented in a subclass.
-// Returns the quota of this security origin in bytes.
-- (unsigned long long)quota;
+ at interface WebSecurityOrigin (WebQuotaManagers)
+- (id<WebQuotaManager>)applicationCacheQuotaManager;
+- (id<WebQuotaManager>)databaseQuotaManager;
+ at end
 
-// Meant to be implemented in a subclass.
-// Sets the storage quota in bytes.
+// FIXME: The following methods are deprecated and should removed later.
+// Clients should instead get a WebQuotaManager, and query / set the quota via the Manager.
+ at interface WebSecurityOrigin (Deprecated)
+- (unsigned long long)usage;
+- (unsigned long long)quota;
 - (void)setQuota:(unsigned long long)quota;
-
 @end
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 99e67ff..9ef1daa 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,19 @@
+2010-08-03  Joseph Pecoraro  <joepeck at webkit.org>
+
+        Reviewed by David Kilzer.
+
+        Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas)
+        https://bugs.webkit.org/show_bug.cgi?id=40627
+
+        Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers
+
+          Change old style calls to make use of the managers.
+
+        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+        (LayoutTestController::setDatabaseQuota):
+        * DumpRenderTree/mac/UIDelegate.mm:
+        (-[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:]):
+
 2010-08-03  Mark Rowe  <mrowe at apple.com>
 
         Add a new Leopard build slave to run the release tests.
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 7db7fff..7e812a0 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -60,6 +60,7 @@
 #import <WebKit/WebKitErrors.h>
 #import <WebKit/WebPreferences.h>
 #import <WebKit/WebPreferencesPrivate.h>
+#import <WebKit/WebQuotaManager.h>
 #import <WebKit/WebScriptWorld.h>
 #import <WebKit/WebSecurityOriginPrivate.h>
 #import <WebKit/WebTypesInternal.h>
@@ -310,7 +311,7 @@ void LayoutTestController::setCustomPolicyDelegate(bool setDelegate, bool permis
 void LayoutTestController::setDatabaseQuota(unsigned long long quota)
 {    
     WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:@"file:///"]];
-    [origin setQuota:quota];
+    [[origin databaseQuotaManager] setQuota:quota];
     [origin release];
 }
 
diff --git a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
index 3dc378a..cc9a5d4 100644
--- a/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
+++ b/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
@@ -35,6 +35,7 @@
 #import "LayoutTestController.h"
 #import <WebKit/WebFramePrivate.h>
 #import <WebKit/WebHTMLViewPrivate.h>
+#import <WebKit/WebQuotaManager.h>
 #import <WebKit/WebSecurityOriginPrivate.h>
 #import <WebKit/WebUIDelegatePrivate.h>
 #import <WebKit/WebView.h>
@@ -160,7 +161,7 @@ DumpRenderTreeDraggingInfo *draggingInfo = nil;
             [origin port], [databaseIdentifier UTF8String]);
 
     static const unsigned long long defaultQuota = 5 * 1024 * 1024;    
-    [origin setQuota:defaultQuota];
+    [[origin databaseQuotaManager] setQuota:defaultQuota];
 }
 
 - (void)webView:(WebView *)sender setStatusText:(NSString *)text

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list