Changeset 64612 in webkit
- Timestamp:
- Aug 3, 2010 6:50:10 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 9 edited
- 4 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebKit/ChangeLog
r64428 r64612 1 2010-08-03 Joseph Pecoraro <joepeck@webkit.org> 2 3 Reviewed by David Kilzer. 4 5 Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) 6 https://bugs.webkit.org/show_bug.cgi?id=40627 7 8 Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers 9 10 * WebKit.xcodeproj/project.pbxproj: Add new Quota Managers, remove old SecurityOrigin subclasses. 11 1 12 2010-07-31 David Kilzer <ddkilzer@apple.com> 2 13 -
trunk/WebKit/WebKit.xcodeproj/project.pbxproj
r64428 r64612 314 314 93EB178F09F88D510091F8FF /* WebSystemInterface.h in Headers */ = {isa = PBXBuildFile; fileRef = 93EB178E09F88D510091F8FF /* WebSystemInterface.h */; }; 315 315 93FDE9330D79CAF30074F029 /* WebHistoryInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDE9320D79CAF30074F029 /* WebHistoryInternal.h */; }; 316 A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A57E2F22120749E600048DF3 /* WebQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; 316 317 A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */; }; 317 318 A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */; }; 318 319 A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */; settings = {ATTRIBUTES = (Private, ); }; }; 319 A5DEFC0F11D5343E00885273 /* WebDatabase SecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0D11D5343E00885273 /* WebDatabaseSecurityOrigin.h */; };320 A5DEFC1011D5343E00885273 /* WebDatabase SecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0E11D5343E00885273 /* WebDatabaseSecurityOrigin.mm */; };321 A5DEFC1311D5344B00885273 /* WebApplicationCache SecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC1111D5344B00885273 /* WebApplicationCacheSecurityOrigin.h */; };322 A5DEFC1411D5344B00885273 /* WebApplicationCache SecurityOrigin.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC1211D5344B00885273 /* WebApplicationCacheSecurityOrigin.mm */; };320 A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; 321 A5DEFC1011D5343E00885273 /* WebDatabaseQuotaManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */; }; 322 A5DEFC1311D5344B00885273 /* WebApplicationCacheQuotaManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */; }; 323 A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */ = {isa = PBXBuildFile; fileRef = A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */; }; 323 324 A70936AF0B5608DC00CDB48E /* WebDragClient.h in Headers */ = {isa = PBXBuildFile; fileRef = A70936AD0B5608DC00CDB48E /* WebDragClient.h */; }; 324 325 A70936B00B5608DC00CDB48E /* WebDragClient.mm in Sources */ = {isa = PBXBuildFile; fileRef = A70936AE0B5608DC00CDB48E /* WebDragClient.mm */; }; … … 609 610 9CE1F8A302A5C6F30ECA2ACD /* WebImageRendererFactory.m */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.objc; path = WebImageRendererFactory.m; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 610 611 9CF0E249021361B00ECA16EA /* WebFramePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = WebFramePrivate.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 612 A57E2F22120749E600048DF3 /* WebQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebQuotaManager.h; sourceTree = "<group>"; }; 611 613 A5DEFC0711D5331C00885273 /* WebSecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebSecurityOrigin.mm; sourceTree = "<group>"; }; 612 614 A5DEFC0811D5331C00885273 /* WebSecurityOriginInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginInternal.h; sourceTree = "<group>"; }; 613 615 A5DEFC0911D5331C00885273 /* WebSecurityOriginPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebSecurityOriginPrivate.h; sourceTree = "<group>"; }; 614 A5DEFC0D11D5343E00885273 /* WebDatabase SecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseSecurityOrigin.h; sourceTree = "<group>"; };615 A5DEFC0E11D5343E00885273 /* WebDatabase SecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseSecurityOrigin.mm; sourceTree = "<group>"; };616 A5DEFC1111D5344B00885273 /* WebApplicationCache SecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheSecurityOrigin.h; sourceTree = "<group>"; };617 A5DEFC1211D5344B00885273 /* WebApplicationCache SecurityOrigin.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCacheSecurityOrigin.mm; sourceTree = "<group>"; };616 A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebDatabaseQuotaManager.h; sourceTree = "<group>"; }; 617 A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDatabaseQuotaManager.mm; sourceTree = "<group>"; }; 618 A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheQuotaManager.h; sourceTree = "<group>"; }; 619 A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebApplicationCacheQuotaManager.mm; sourceTree = "<group>"; }; 618 620 A70936AD0B5608DC00CDB48E /* WebDragClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebDragClient.h; sourceTree = "<group>"; }; 619 621 A70936AE0B5608DC00CDB48E /* WebDragClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebDragClient.mm; sourceTree = "<group>"; }; … … 970 972 9345DDAE0365FB27008635CE /* WebNSWindowExtras.h */, 971 973 9345DDAF0365FB27008635CE /* WebNSWindowExtras.m */, 974 A57E2F22120749E600048DF3 /* WebQuotaManager.h */, 972 975 F59668C802AD2923018635CA /* WebStringTruncator.h */, 973 976 F59668C902AD2923018635CA /* WebStringTruncator.mm */, … … 1021 1024 51AEDEF00CECF45700854328 /* WebDatabaseManagerInternal.h */, 1022 1025 511F3FD20CECC88F00852565 /* WebDatabaseManagerPrivate.h */, 1023 A5DEFC0D11D5343E00885273 /* WebDatabase SecurityOrigin.h */,1024 A5DEFC0E11D5343E00885273 /* WebDatabase SecurityOrigin.mm */,1026 A5DEFC0D11D5343E00885273 /* WebDatabaseQuotaManager.h */, 1027 A5DEFC0E11D5343E00885273 /* WebDatabaseQuotaManager.mm */, 1025 1028 511F3FD30CECC88F00852565 /* WebDatabaseTrackerClient.h */, 1026 1029 511F3FD40CECC88F00852565 /* WebDatabaseTrackerClient.mm */, … … 1239 1242 B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */, 1240 1243 B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */, 1241 A5DEFC1111D5344B00885273 /* WebApplicationCache SecurityOrigin.h */,1242 A5DEFC1211D5344B00885273 /* WebApplicationCache SecurityOrigin.mm */,1244 A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */, 1245 A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */, 1243 1246 51CBFCAC0D10E6C5002DBF51 /* WebCachedFramePlatformData.h */, 1244 1247 14D8252D0AF955090004F057 /* WebChromeClient.h */, … … 1570 1573 A5DEFC0B11D5331C00885273 /* WebSecurityOriginInternal.h in Headers */, 1571 1574 A5DEFC0C11D5331C00885273 /* WebSecurityOriginPrivate.h in Headers */, 1572 A5DEFC0F11D5343E00885273 /* WebDatabaseSecurityOrigin.h in Headers */, 1573 A5DEFC1311D5344B00885273 /* WebApplicationCacheSecurityOrigin.h in Headers */, 1575 A5DEFC0F11D5343E00885273 /* WebDatabaseQuotaManager.h in Headers */, 1576 A5DEFC1311D5344B00885273 /* WebApplicationCacheQuotaManager.h in Headers */, 1577 A57E2F24120749E600048DF3 /* WebQuotaManager.h in Headers */, 1574 1578 ); 1575 1579 runOnlyForDeploymentPostprocessing = 0; … … 1931 1935 41F4485010338E8C0030E55E /* WebWorkersPrivate.mm in Sources */, 1932 1936 A5DEFC0A11D5331C00885273 /* WebSecurityOrigin.mm in Sources */, 1933 A5DEFC1011D5343E00885273 /* WebDatabase SecurityOrigin.mm in Sources */,1934 A5DEFC1411D5344B00885273 /* WebApplicationCache SecurityOrigin.mm in Sources */,1937 A5DEFC1011D5343E00885273 /* WebDatabaseQuotaManager.mm in Sources */, 1938 A5DEFC1411D5344B00885273 /* WebApplicationCacheQuotaManager.mm in Sources */, 1935 1939 ); 1936 1940 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebKit/mac/ChangeLog
r64589 r64612 1 2010-08-03 Joseph Pecoraro <joepeck@webkit.org> 2 3 Reviewed by David Kilzer. 4 5 Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) 6 https://bugs.webkit.org/show_bug.cgi?id=40627 7 8 Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers 9 10 Per-Origin quotas exist for Databases and Application Caches. Clients 11 given a WebSecurityOrigin have the ability to set the quota for any 12 per-origin quota type. This puts quota management into an interface 13 and WebSecurityOrigin allows access to quota managers for the 14 different types of quotas. 15 16 This also deprecates the old methods on WebSecurityOrigin. They are 17 left in for now to prevent breaking older clients. 18 19 The WebQuotaManager interface allows querying and modifying a 20 per-origin quota. This is implemented for both Databases and 21 Application Caches. 22 23 * Misc/WebQuotaManager.h: Added. Interface for quota management (usage, quota, setQuota). 24 * Storage/WebDatabaseQuotaManager.h: Added. 25 * Storage/WebDatabaseQuotaManager.mm: Added. 26 (-[WebDatabaseQuotaManager origin]): 27 (-[WebDatabaseQuotaManager usage]): 28 (-[WebDatabaseQuotaManager quota]): 29 (-[WebDatabaseQuotaManager setQuota:]): 30 * Storage/WebDatabaseSecurityOrigin.h: Removed. 31 * Storage/WebDatabaseSecurityOrigin.mm: Removed. 32 * WebCoreSupport/WebApplicationCacheQuotaManager.h: Added. 33 * WebCoreSupport/WebApplicationCacheQuotaManager.mm: Added. 34 (-[WebApplicationCacheQuotaManager origin]): 35 (-[WebApplicationCacheQuotaManager usage]): 36 (-[WebApplicationCacheQuotaManager quota]): 37 (-[WebApplicationCacheQuotaManager setQuota:]): 38 * WebCoreSupport/WebSecurityOriginPrivate.h: Added a category to access managers. Deprecated old methods. 39 40 Remove the WebSecurityOrigin sub-classes. Managers are better. 41 42 * WebCoreSupport/WebApplicationCacheSecurityOrigin.h: Removed. 43 * WebCoreSupport/WebApplicationCacheSecurityOrigin.mm: Removed. 44 45 Create the managers lazily. Change old style calls to make use 46 of the managers. 47 48 * WebCoreSupport/WebChromeClient.mm: 49 (WebChromeClient::exceededDatabaseQuota): 50 (WebChromeClient::reachedApplicationCacheOriginQuota): 51 * WebCoreSupport/WebSecurityOrigin.mm: 52 (-[WebSecurityOrigin applicationCacheQuotaManager]): 53 (-[WebSecurityOrigin databaseQuotaManager]): 54 (-[WebSecurityOrigin dealloc]): release the managers if they exist. 55 1 56 2010-08-03 Alex Milowski <alex@milowski.com> 2 57 -
trunk/WebKit/mac/Storage/WebDatabaseQuotaManager.h
r64611 r64612 24 24 */ 25 25 26 #import "Web SecurityOriginInternal.h"26 #import "WebQuotaManager.h" 27 27 28 @interface WebApplicationCacheSecurityOrigin : WebSecurityOrigin 28 @interface WebDatabaseQuotaManager : NSObject <WebQuotaManager> { 29 WebSecurityOrigin *_origin; 30 } 31 29 32 @end -
trunk/WebKit/mac/Storage/WebDatabaseQuotaManager.mm
r64611 r64612 24 24 */ 25 25 26 #import "WebDatabaseSecurityOrigin.h" 27 #import <WebCore/SecurityOrigin.h> 26 #import "WebDatabaseQuotaManager.h" 27 28 #import "WebSecurityOriginInternal.h" 29 #import <WebCore/DatabaseTracker.h> 28 30 29 31 using namespace WebCore; 30 32 31 @implementation WebDatabase SecurityOrigin33 @implementation WebDatabaseQuotaManager 32 34 33 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=40627 34 // Proper steps should be taken to have subclass implementations of SecurityOrigin's 35 // origin, quota, and setQuota methods. 35 - (id)initWithOrigin:(WebSecurityOrigin *)origin 36 { 37 self = [super init]; 38 if (!self) 39 return nil; 40 41 _origin = origin; 42 return self; 43 } 44 45 - (WebSecurityOrigin *)origin 46 { 47 return _origin; 48 } 49 50 - (unsigned long long)usage 51 { 52 #if ENABLE(DATABASE) 53 return DatabaseTracker::tracker().usageForOrigin([_origin _core]); 54 #else 55 return 0; 56 #endif 57 } 58 59 - (unsigned long long)quota 60 { 61 #if ENABLE(DATABASE) 62 return DatabaseTracker::tracker().quotaForOrigin([_origin _core]); 63 #else 64 return 0; 65 #endif 66 } 67 68 // If the quota is set to a value lower than the current usage, that quota will 69 // "stick" but no data will be purged to meet the new quota. This will simply 70 // prevent new data from being added to databases in that origin. 71 - (void)setQuota:(unsigned long long)quota 72 { 73 #if ENABLE(DATABASE) 74 DatabaseTracker::tracker().setQuota([_origin _core], quota); 75 #endif 76 } 36 77 37 78 @end -
trunk/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.h
r64611 r64612 24 24 */ 25 25 26 #import "Web SecurityOriginInternal.h"26 #import "WebQuotaManager.h" 27 27 28 @interface WebDatabaseSecurityOrigin : WebSecurityOrigin 28 @interface WebApplicationCacheQuotaManager : NSObject <WebQuotaManager> { 29 WebSecurityOrigin *_origin; 30 } 31 29 32 @end -
trunk/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm
r64611 r64612 24 24 */ 25 25 26 #import "WebApplicationCache SecurityOrigin.h"26 #import "WebApplicationCacheQuotaManager.h" 27 27 28 #import "WebSecurityOriginInternal.h" 28 29 #import <WebCore/ApplicationCacheStorage.h> 29 30 30 31 using namespace WebCore; 31 32 32 @implementation WebApplicationCacheSecurityOrigin 33 @implementation WebApplicationCacheQuotaManager 34 35 - (id)initWithOrigin:(WebSecurityOrigin *)origin 36 { 37 self = [super init]; 38 if (!self) 39 return nil; 40 41 _origin = origin; 42 return self; 43 } 44 45 - (WebSecurityOrigin *)origin 46 { 47 return _origin; 48 } 33 49 34 50 - (unsigned long long)usage … … 36 52 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 37 53 long long usage; 38 if (cacheStorage().usageForOrigin( reinterpret_cast<SecurityOrigin*>(_private), usage))54 if (cacheStorage().usageForOrigin([_origin _core], usage)) 39 55 return usage; 40 56 return 0; … … 48 64 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 49 65 long long quota; 50 if (cacheStorage().quotaForOrigin( reinterpret_cast<SecurityOrigin*>(_private), quota))66 if (cacheStorage().quotaForOrigin([_origin _core], quota)) 51 67 return quota; 52 68 return 0; … … 59 75 { 60 76 #if ENABLE(OFFLINE_WEB_APPLICATIONS) 61 cacheStorage().storeUpdatedQuotaForOrigin( reinterpret_cast<SecurityOrigin*>(_private), quota);77 cacheStorage().storeUpdatedQuotaForOrigin([_origin _core], quota); 62 78 #endif 63 79 } -
trunk/WebKit/mac/WebCoreSupport/WebChromeClient.mm
r64513 r64612 31 31 32 32 #import "DOMNodeInternal.h" 33 #import "WebApplicationCacheSecurityOrigin.h"34 #import "WebDatabaseSecurityOrigin.h"35 33 #import "WebDefaultUIDelegate.h" 36 34 #import "WebDelegateImplementationCaching.h" … … 44 42 #import "WebNSURLRequestExtras.h" 45 43 #import "WebPlugin.h" 44 #import "WebQuotaManager.h" 46 45 #import "WebSecurityOriginInternal.h" 47 46 #import "WebUIDelegatePrivate.h" … … 560 559 BEGIN_BLOCK_OBJC_EXCEPTIONS; 561 560 562 Web DatabaseSecurityOrigin *webOrigin = [[WebDatabaseSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()];561 WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:frame->document()->securityOrigin()]; 563 562 // FIXME: remove this workaround once shipping Safari has the necessary delegate implemented. 564 563 if (WKAppVersionCheckLessThan(@"com.apple.Safari", -1, 3.1)) { 565 564 const unsigned long long defaultQuota = 5 * 1024 * 1024; // 5 megabytes should hopefully be enough to test storage support. 566 [ webOriginsetQuota:defaultQuota];565 [[webOrigin databaseQuotaManager] setQuota:defaultQuota]; 567 566 } else 568 567 CallUIDelegate(m_webView, @selector(webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:), kit(frame), webOrigin, (NSString *)databaseName); … … 583 582 BEGIN_BLOCK_OBJC_EXCEPTIONS; 584 583 585 Web ApplicationCacheSecurityOrigin *webOrigin = [[WebApplicationCacheSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin];584 WebSecurityOrigin *webOrigin = [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:origin]; 586 585 CallUIDelegate(m_webView, @selector(webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:), webOrigin); 587 586 [webOrigin release]; -
trunk/WebKit/mac/WebCoreSupport/WebSecurityOrigin.mm
r64403 r64612 29 29 #import "WebSecurityOriginInternal.h" 30 30 31 #import "WebApplicationCacheQuotaManager.h" 32 #import "WebDatabaseQuotaManager.h" 33 #import "WebQuotaManager.h" 31 34 #import <WebCore/KURL.h> 35 #import <WebCore/DatabaseTracker.h> 32 36 #import <WebCore/SecurityOrigin.h> 33 #import <WebCore/DatabaseTracker.h>34 37 35 38 using namespace WebCore; … … 70 73 } 71 74 72 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=4062773 // Proper steps should be taken to have subclass implementations of SecurityOrigin's74 // origin, quota, and setQuota methods.75 76 - (unsigned long long)usage77 {78 #if ENABLE(DATABASE)79 return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private));80 #else81 return 0;82 #endif83 }84 85 - (unsigned long long)quota86 {87 #if ENABLE(DATABASE)88 return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private));89 #else90 return 0;91 #endif92 }93 94 // If the quota is set to a value lower than the current usage, that quota will95 // "stick" but no data will be purged to meet the new quota. This will simply96 // prevent new data from being added to databases in that origin97 - (void)setQuota:(unsigned long long)quota98 {99 #if ENABLE(DATABASE)100 DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota);101 #endif102 }103 104 75 - (BOOL)isEqual:(id)anObject 105 76 { … … 115 86 if (_private) 116 87 reinterpret_cast<SecurityOrigin*>(_private)->deref(); 88 if (_applicationCacheQuotaManager) 89 [(NSObject *)_applicationCacheQuotaManager release]; 90 if (_databaseQuotaManager) 91 [(NSObject *)_databaseQuotaManager release]; 117 92 [super dealloc]; 118 93 } … … 148 123 149 124 @end 125 126 127 #pragma mark - 128 #pragma mark WebQuotaManagers 129 130 @implementation WebSecurityOrigin (WebQuotaManagers) 131 132 - (id<WebQuotaManager>)applicationCacheQuotaManager 133 { 134 if (!_applicationCacheQuotaManager) 135 _applicationCacheQuotaManager = [[WebApplicationCacheQuotaManager alloc] initWithOrigin:self]; 136 return _applicationCacheQuotaManager; 137 } 138 139 - (id<WebQuotaManager>)databaseQuotaManager 140 { 141 if (!_databaseQuotaManager) 142 _databaseQuotaManager = [[WebDatabaseQuotaManager alloc] initWithOrigin:self]; 143 return _databaseQuotaManager; 144 } 145 146 @end 147 148 149 #pragma mark - 150 #pragma mark Deprecated 151 152 // FIXME: The following methods are deprecated and should removed later. 153 // Clients should instead get a WebQuotaManager, and query / set the quota via the Manager. 154 // NOTE: the <WebCore/DatabaseTracker.h> #include should be removed as well. 155 156 @implementation WebSecurityOrigin (Deprecated) 157 158 - (unsigned long long)usage 159 { 160 #if ENABLE(DATABASE) 161 return DatabaseTracker::tracker().usageForOrigin(reinterpret_cast<SecurityOrigin*>(_private)); 162 #else 163 return 0; 164 #endif 165 } 166 167 - (unsigned long long)quota 168 { 169 #if ENABLE(DATABASE) 170 return DatabaseTracker::tracker().quotaForOrigin(reinterpret_cast<SecurityOrigin*>(_private)); 171 #else 172 return 0; 173 #endif 174 } 175 176 - (void)setQuota:(unsigned long long)quota 177 { 178 #if ENABLE(DATABASE) 179 DatabaseTracker::tracker().setQuota(reinterpret_cast<SecurityOrigin*>(_private), quota); 180 #endif 181 } 182 183 @end -
trunk/WebKit/mac/WebCoreSupport/WebSecurityOriginPrivate.h
r64403 r64612 1 1 /* 2 * Copyright (C) 2007 Apple Inc. All rights reserved.2 * Copyright (C) 2007, 2010 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 28 28 29 29 @class WebSecurityOriginPrivate; 30 @protocol WebQuotaManager; 30 31 31 32 @interface WebSecurityOrigin : NSObject { 32 33 WebSecurityOriginPrivate *_private; 34 id<WebQuotaManager> _applicationCacheQuotaManager; 35 id<WebQuotaManager> _databaseQuotaManager; 33 36 } 34 37 … … 41 44 - (unsigned short)port; 42 45 43 // Meant to be implemented in a subclass. 44 // Returns the current total usage of all relevant items in this security origin in bytes. 46 @end 47 48 @interface WebSecurityOrigin (WebQuotaManagers) 49 - (id<WebQuotaManager>)applicationCacheQuotaManager; 50 - (id<WebQuotaManager>)databaseQuotaManager; 51 @end 52 53 // FIXME: The following methods are deprecated and should removed later. 54 // Clients should instead get a WebQuotaManager, and query / set the quota via the Manager. 55 @interface WebSecurityOrigin (Deprecated) 45 56 - (unsigned long long)usage; 46 47 // Meant to be implemented in a subclass.48 // Returns the quota of this security origin in bytes.49 57 - (unsigned long long)quota; 50 51 // Meant to be implemented in a subclass.52 // Sets the storage quota in bytes.53 58 - (void)setQuota:(unsigned long long)quota; 54 55 59 @end -
trunk/WebKitTools/ChangeLog
r64606 r64612 1 2010-08-03 Joseph Pecoraro <joepeck@webkit.org> 2 3 Reviewed by David Kilzer. 4 5 Limit ApplicationCache Total and Per-Origin Storage Capacity (Quotas) 6 https://bugs.webkit.org/show_bug.cgi?id=40627 7 8 Part 5 - Refactor Quota Management in WebSecurityOrigin into Managers 9 10 Change old style calls to make use of the managers. 11 12 * DumpRenderTree/mac/LayoutTestControllerMac.mm: 13 (LayoutTestController::setDatabaseQuota): 14 * DumpRenderTree/mac/UIDelegate.mm: 15 (-[UIDelegate webView:frame:exceededDatabaseQuotaForSecurityOrigin:database:]): 16 1 17 2010-08-03 Mark Rowe <mrowe@apple.com> 2 18 -
trunk/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
r64356 r64612 61 61 #import <WebKit/WebPreferences.h> 62 62 #import <WebKit/WebPreferencesPrivate.h> 63 #import <WebKit/WebQuotaManager.h> 63 64 #import <WebKit/WebScriptWorld.h> 64 65 #import <WebKit/WebSecurityOriginPrivate.h> … … 311 312 { 312 313 WebSecurityOrigin *origin = [[WebSecurityOrigin alloc] initWithURL:[NSURL URLWithString:@"file:///"]]; 313 [ originsetQuota:quota];314 [[origin databaseQuotaManager] setQuota:quota]; 314 315 [origin release]; 315 316 } -
trunk/WebKitTools/DumpRenderTree/mac/UIDelegate.mm
r62875 r64612 36 36 #import <WebKit/WebFramePrivate.h> 37 37 #import <WebKit/WebHTMLViewPrivate.h> 38 #import <WebKit/WebQuotaManager.h> 38 39 #import <WebKit/WebSecurityOriginPrivate.h> 39 40 #import <WebKit/WebUIDelegatePrivate.h> … … 161 162 162 163 static const unsigned long long defaultQuota = 5 * 1024 * 1024; 163 [ originsetQuota:defaultQuota];164 [[origin databaseQuotaManager] setQuota:defaultQuota]; 164 165 } 165 166
Note: See TracChangeset
for help on using the changeset viewer.