Changeset 182540 in webkit


Ignore:
Timestamp:
Apr 8, 2015, 9:10:56 AM (10 years ago)
Author:
andersca@apple.com
Message:

Get rid of uses of ApplicationCacheStorage::singleton() from WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=143504

Reviewed by Sam Weinig.

Source/WebKit:

  • WebKit.xcodeproj/project.pbxproj:

Add WebApplicationCacheInternal.h.

Source/WebKit/mac:

Add a webApplicationCacheStorage() function and use it throughout WebKitLegacy.
In the future, webApplicationCacheStorage will return a custom singleton, but for now
it just returns ApplicationCacheStorage::singleton().

  • Misc/WebCache.mm:

(+[WebCache empty]):

  • WebCoreSupport/WebApplicationCache.mm:

(+[WebApplicationCache maximumSize]):
(+[WebApplicationCache setMaximumSize:]):
(+[WebApplicationCache defaultOriginQuota]):
(+[WebApplicationCache setDefaultOriginQuota:]):
(+[WebApplicationCache originsWithCache]):
(webApplicationCacheStorage):

  • WebCoreSupport/WebApplicationCacheInternal.h: Added.
  • WebCoreSupport/WebApplicationCacheQuotaManager.mm:

(-[WebApplicationCacheQuotaManager usage]):
(-[WebApplicationCacheQuotaManager quota]):
(-[WebApplicationCacheQuotaManager setQuota:]):

  • WebView/WebView.mm:

(WebKitInitializeApplicationCachePathIfNecessary):

Location:
trunk/Source/WebKit
Files:
7 edited
1 copied

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r182365 r182540  
     12015-04-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Get rid of uses of ApplicationCacheStorage::singleton() from WebKitLegacy
     4        https://bugs.webkit.org/show_bug.cgi?id=143504
     5
     6        Reviewed by Sam Weinig.
     7
     8        * WebKit.xcodeproj/project.pbxproj:
     9        Add WebApplicationCacheInternal.h.
     10
    1112015-04-05  Gyuyoung Kim  <gyuyoung.kim@samsung.com>
    212
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r181838 r182540  
    5353                1A77B02E0EE7730500C8A1F9 /* WebPluginRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A77B02C0EE7730500C8A1F9 /* WebPluginRequest.h */; };
    5454                1A77B02F0EE7730500C8A1F9 /* WebPluginRequest.m in Sources */ = {isa = PBXBuildFile; fileRef = 1A77B02D0EE7730500C8A1F9 /* WebPluginRequest.m */; };
     55                1A86CCD41AD48A620074BA89 /* WebApplicationCacheInternal.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */; };
    5556                1A8DED500EE88B8A00F25022 /* HostedNetscapePluginStream.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A8DED4E0EE88B8A00F25022 /* HostedNetscapePluginStream.h */; };
    5657                1A8DED510EE88B8A00F25022 /* HostedNetscapePluginStream.mm in Sources */ = {isa = PBXBuildFile; fileRef = 1A8DED4F0EE88B8A00F25022 /* HostedNetscapePluginStream.mm */; };
     
    518519                1A77B02C0EE7730500C8A1F9 /* WebPluginRequest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebPluginRequest.h; sourceTree = "<group>"; };
    519520                1A77B02D0EE7730500C8A1F9 /* WebPluginRequest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WebPluginRequest.m; sourceTree = "<group>"; };
     521                1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebApplicationCacheInternal.h; sourceTree = "<group>"; };
    520522                1A8DED4E0EE88B8A00F25022 /* HostedNetscapePluginStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HostedNetscapePluginStream.h; sourceTree = "<group>"; };
    521523                1A8DED4F0EE88B8A00F25022 /* HostedNetscapePluginStream.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = HostedNetscapePluginStream.mm; sourceTree = "<group>"; };
     
    15881590                                B68049710FFBCEC1009F7F62 /* WebApplicationCache.h */,
    15891591                                B68049720FFBCEC1009F7F62 /* WebApplicationCache.mm */,
     1592                                1A86CCD31AD48A620074BA89 /* WebApplicationCacheInternal.h */,
    15901593                                A5DEFC1111D5344B00885273 /* WebApplicationCacheQuotaManager.h */,
    15911594                                A5DEFC1211D5344B00885273 /* WebApplicationCacheQuotaManager.mm */,
     
    19341937                                939810A40824BF01008DF038 /* WebPDFView.h in Headers */,
    19351938                                1AA879B611CBE9BF003C664F /* WebPlatformStrategies.h in Headers */,
     1939                                1A86CCD41AD48A620074BA89 /* WebApplicationCacheInternal.h in Headers */,
    19361940                                939810350824BF01008DF038 /* WebPlugin.h in Headers */,
    19371941                                939810360824BF01008DF038 /* WebPluginContainer.h in Headers */,
  • trunk/Source/WebKit/mac/ChangeLog

    r182494 r182540  
     12015-04-07  Anders Carlsson  <andersca@apple.com>
     2
     3        Get rid of uses of ApplicationCacheStorage::singleton() from WebKitLegacy
     4        https://bugs.webkit.org/show_bug.cgi?id=143504
     5
     6        Reviewed by Sam Weinig.
     7
     8        Add a webApplicationCacheStorage() function and use it throughout WebKitLegacy.
     9        In the future, webApplicationCacheStorage will return a custom singleton, but for now
     10        it just returns ApplicationCacheStorage::singleton().
     11
     12        * Misc/WebCache.mm:
     13        (+[WebCache empty]):
     14        * WebCoreSupport/WebApplicationCache.mm:
     15        (+[WebApplicationCache maximumSize]):
     16        (+[WebApplicationCache setMaximumSize:]):
     17        (+[WebApplicationCache defaultOriginQuota]):
     18        (+[WebApplicationCache setDefaultOriginQuota:]):
     19        (+[WebApplicationCache originsWithCache]):
     20        (webApplicationCacheStorage):
     21        * WebCoreSupport/WebApplicationCacheInternal.h: Added.
     22        * WebCoreSupport/WebApplicationCacheQuotaManager.mm:
     23        (-[WebApplicationCacheQuotaManager usage]):
     24        (-[WebApplicationCacheQuotaManager quota]):
     25        (-[WebApplicationCacheQuotaManager setQuota:]):
     26        * WebView/WebView.mm:
     27        (WebKitInitializeApplicationCachePathIfNecessary):
     28
    1292015-04-07  Brady Eidson  <beidson@apple.com>
    230
  • trunk/Source/WebKit/mac/Misc/WebCache.mm

    r182449 r182540  
    2626#import "WebCache.h"
    2727
     28#import "WebApplicationCacheInternal.h"
    2829#import "WebNSObjectExtras.h"
    2930#import "WebPreferences.h"
     
    120121
    121122    // Empty the application cache.
    122     WebCore::ApplicationCacheStorage::singleton().empty();
     123    webApplicationCacheStorage().empty();
    123124
    124125    // Empty the Cross-Origin Preflight cache
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm

    r180963 r182540  
    2424 */
    2525
    26 #import "WebApplicationCache.h"
     26#import "WebApplicationCacheInternal.h"
    2727
    2828#import "WebSecurityOriginInternal.h"
     
    5454    SQLiteDatabaseTracker::setClient(WebSQLiteDatabaseTrackerClient::sharedWebSQLiteDatabaseTrackerClient());
    5555
    56     ApplicationCacheStorage::singleton().setCacheDirectory([NSString _webkit_localCacheDirectoryWithBundleIdentifier:bundleIdentifier]);
     56    webApplicationCacheStorage().setCacheDirectory([NSString _webkit_localCacheDirectoryWithBundleIdentifier:bundleIdentifier]);
    5757   
    5858    initialized = YES;
     
    6262+ (long long)maximumSize
    6363{
    64     return ApplicationCacheStorage::singleton().maximumSize();
     64    return webApplicationCacheStorage().maximumSize();
    6565}
    6666
    6767+ (void)setMaximumSize:(long long)size
    6868{
    69     auto& cacheStorage = ApplicationCacheStorage::singleton();
    70     cacheStorage.deleteAllEntries();
    71     cacheStorage.setMaximumSize(size);
     69    webApplicationCacheStorage().deleteAllEntries();
     70    webApplicationCacheStorage().setMaximumSize(size);
    7271}
    7372
    7473+ (long long)defaultOriginQuota
    7574{
    76     return ApplicationCacheStorage::singleton().defaultOriginQuota();
     75    return webApplicationCacheStorage().defaultOriginQuota();
    7776}
    7877
    7978+ (void)setDefaultOriginQuota:(long long)size
    8079{
    81     ApplicationCacheStorage::singleton().setDefaultOriginQuota(size);
     80    webApplicationCacheStorage().setDefaultOriginQuota(size);
    8281}
    8382
     
    10099{
    101100    HashSet<RefPtr<SecurityOrigin>> coreOrigins;
    102     ApplicationCacheStorage::singleton().getOriginsWithCache(coreOrigins);
     101    webApplicationCacheStorage().getOriginsWithCache(coreOrigins);
    103102   
    104103    NSMutableArray *webOrigins = [[[NSMutableArray alloc] initWithCapacity:coreOrigins.size()] autorelease];
     
    114113
    115114@end
     115
     116WebCore::ApplicationCacheStorage& webApplicationCacheStorage()
     117{
     118    return ApplicationCacheStorage::singleton();
     119}
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheInternal.h

    r182497 r182540  
    11/*
    2  * Copyright (C) 2010 Apple Inc. All rights reserved.
     2 * Copyright (C) 2015 Apple Inc. All rights reserved.
    33 *
    44 * Redistribution and use in source and binary forms, with or without
     
    2424 */
    2525
    26 #import "WebApplicationCacheQuotaManager.h"
     26#import "WebApplicationCache.h"
    2727
    28 #import "WebSecurityOriginInternal.h"
    29 #import <WebCore/ApplicationCacheStorage.h>
    30 
    31 using namespace WebCore;
    32 
    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;
     28namespace WebCore {
     29class ApplicationCacheStorage;
    4330}
    4431
    45 - (WebSecurityOrigin *)origin
    46 {
    47     return _origin;
    48 }
     32WebCore::ApplicationCacheStorage& webApplicationCacheStorage();
    4933
    50 - (unsigned long long)usage
    51 {
    52     long long usage;
    53     if (ApplicationCacheStorage::singleton().calculateUsageForOrigin([_origin _core], usage))
    54         return usage;
    55     return 0;
    56 }
    57 
    58 - (unsigned long long)quota
    59 {
    60     long long quota;
    61     if (ApplicationCacheStorage::singleton().calculateQuotaForOrigin([_origin _core], quota))
    62         return quota;
    63     return 0;
    64 }
    65 
    66 - (void)setQuota:(unsigned long long)quota
    67 {
    68     ApplicationCacheStorage::singleton().storeUpdatedQuotaForOrigin([_origin _core], quota);
    69 }
    70 
    71 @end
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCacheQuotaManager.mm

    r180963 r182540  
    2626#import "WebApplicationCacheQuotaManager.h"
    2727
     28#import "WebApplicationCacheInternal.h"
    2829#import "WebSecurityOriginInternal.h"
    2930#import <WebCore/ApplicationCacheStorage.h>
     
    5152{
    5253    long long usage;
    53     if (ApplicationCacheStorage::singleton().calculateUsageForOrigin([_origin _core], usage))
     54    if (webApplicationCacheStorage().calculateUsageForOrigin([_origin _core], usage))
    5455        return usage;
    5556    return 0;
     
    5960{
    6061    long long quota;
    61     if (ApplicationCacheStorage::singleton().calculateQuotaForOrigin([_origin _core], quota))
     62    if (webApplicationCacheStorage().calculateQuotaForOrigin([_origin _core], quota))
    6263        return quota;
    6364    return 0;
     
    6667- (void)setQuota:(unsigned long long)quota
    6768{
    68     ApplicationCacheStorage::singleton().storeUpdatedQuotaForOrigin([_origin _core], quota);
     69    webApplicationCacheStorage().storeUpdatedQuotaForOrigin([_origin _core], quota);
    6970}
    7071
  • trunk/Source/WebKit/mac/WebView/WebView.mm

    r181866 r182540  
    3939#import "StorageThread.h"
    4040#import "WebAlternativeTextClient.h"
    41 #import "WebApplicationCache.h"
     41#import "WebApplicationCacheInternal.h"
    4242#import "WebBackForwardListInternal.h"
    4343#import "WebBaseNetscapePluginView.h"
     
    745745    NSString* cacheDir = [NSString _webkit_localCacheDirectoryWithBundleIdentifier:appName];
    746746
    747     ApplicationCacheStorage::singleton().setCacheDirectory(cacheDir);
     747    webApplicationCacheStorage().setCacheDirectory(cacheDir);
    748748    initialized = YES;
    749749}
Note: See TracChangeset for help on using the changeset viewer.