Changeset 143287 in webkit


Ignore:
Timestamp:
Feb 18, 2013 6:55:26 PM (11 years ago)
Author:
andersca@apple.com
Message:

Add a DefaultHash for RefPtr<SecurityOrigin>
https://bugs.webkit.org/show_bug.cgi?id=110170

Reviewed by Andreas Kling.

Remove all explicit uses of SecurityOriginHash.

Source/WebCore:

  • Modules/webdatabase/DatabaseTracker.h:
  • Modules/webdatabase/OriginQuotaManager.h:
  • loader/appcache/ApplicationCacheStorage.cpp:

(WebCore::ApplicationCacheStorage::getOriginsWithCache):

  • loader/cache/MemoryCache.h:
  • page/SecurityOriginHash.h:
  • storage/StorageNamespaceImpl.h:

(StorageNamespaceImpl):

Source/WebKit/mac:

  • WebCoreSupport/WebApplicationCache.mm:

(+[WebApplicationCache originsWithCache]):

Source/WebKit2:

  • UIProcess/Storage/StorageManager.cpp:

(StorageManager::SessionStorageNamespace):

  • WebProcess/ApplicationCache/WebApplicationCacheManager.cpp:

(WebKit::WebApplicationCacheManager::getApplicationCacheOrigins):

  • WebProcess/InjectedBundle/InjectedBundle.cpp:

(WebKit::InjectedBundle::originsWithApplicationCache):

  • WebProcess/Notifications/NotificationPermissionRequestManager.h:

Include SecurityOriginHash.h. This fixes a bug where m_originToIDMap used pointer-equality
for looking up security origins.

  • WebProcess/ResourceCache/WebResourceCacheManager.cpp:

(WebKit::WebResourceCacheManager::clearCacheForOrigin):
This can just take a const reference.

  • WebProcess/ResourceCache/WebResourceCacheManager.h:
Location:
trunk/Source
Files:
16 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r143284 r143287  
     12013-02-18  Anders Carlsson  <andersca@apple.com>
     2
     3        Add a DefaultHash for RefPtr<SecurityOrigin>
     4        https://bugs.webkit.org/show_bug.cgi?id=110170
     5
     6        Reviewed by Andreas Kling.
     7
     8        Remove all explicit uses of SecurityOriginHash.
     9
     10        * Modules/webdatabase/DatabaseTracker.h:
     11        * Modules/webdatabase/OriginQuotaManager.h:
     12        * loader/appcache/ApplicationCacheStorage.cpp:
     13        (WebCore::ApplicationCacheStorage::getOriginsWithCache):
     14        * loader/cache/MemoryCache.h:
     15        * page/SecurityOriginHash.h:
     16        * storage/StorageNamespaceImpl.h:
     17        (StorageNamespaceImpl):
     18
    1192013-02-18  David Hyatt  <hyatt@apple.com>
    220
  • trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h

    r142030 r143287  
    4141#include "DatabaseDetails.h"
    4242#include "SQLiteDatabase.h"
     43#include "SecurityOriginHash.h"
    4344#include <wtf/OwnPtr.h>
    4445#endif // !PLATFORM(CHROMIUM)
     
    5051class SecurityOrigin;
    5152
    52 struct SecurityOriginHash;
    53 
    5453#if !PLATFORM(CHROMIUM)
    5554class DatabaseManagerClient;
    5655
    57 struct SecurityOriginTraits;
    5856#endif // !PLATFORM(CHROMIUM)
    5957
     
    146144    typedef HashSet<DatabaseBackend*> DatabaseSet;
    147145    typedef HashMap<String, DatabaseSet*> DatabaseNameMap;
    148     typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*, SecurityOriginHash> DatabaseOriginMap;
     146    typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*> DatabaseOriginMap;
    149147
    150148    Mutex m_openDatabaseMapGuard;
     
    155153    SQLiteDatabase m_database;
    156154
    157     typedef HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash> QuotaMap;
     155    typedef HashMap<RefPtr<SecurityOrigin>, unsigned long long> QuotaMap;
    158156    mutable OwnPtr<QuotaMap> m_quotaMap;
    159157
     
    166164    CreateSet m_beingCreated;
    167165    typedef HashSet<String> NameSet;
    168     HashMap<RefPtr<SecurityOrigin>, NameSet*, SecurityOriginHash> m_beingDeleted;
    169     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> m_originsBeingDeleted;
     166    HashMap<RefPtr<SecurityOrigin>, NameSet*> m_beingDeleted;
     167    HashSet<RefPtr<SecurityOrigin> > m_originsBeingDeleted;
    170168    bool isDeletingDatabaseOrOriginFor(SecurityOrigin*, const String& name);
    171169    void recordCreatingDatabase(SecurityOrigin*, const String& name);
  • trunk/Source/WebCore/Modules/webdatabase/OriginQuotaManager.h

    r141207 r143287  
    4141class DatabaseBackend;
    4242class OriginUsageRecord;
     43class SecurityOrigin;
    4344
    4445class OriginQuotaManager {
     
    6667#endif
    6768
    68     typedef HashMap<RefPtr<SecurityOrigin>, OriginUsageRecord*, SecurityOriginHash> OriginUsageMap;
     69    typedef HashMap<RefPtr<SecurityOrigin>, OriginUsageRecord*> OriginUsageMap;
    6970    OriginUsageMap m_usageMap;
    7071};
  • trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp

    r130612 r143287  
    15131513}
    15141514
    1515 void ApplicationCacheStorage::getOriginsWithCache(HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>& origins)
     1515void ApplicationCacheStorage::getOriginsWithCache(HashSet<RefPtr<SecurityOrigin> >& origins)
    15161516{
    15171517    Vector<KURL> urls;
  • trunk/Source/WebCore/loader/cache/MemoryCache.h

    r128418 r143287  
    2727
    2828#include "CachedResource.h"
     29#include "SecurityOriginHash.h"
    2930#include <wtf/HashMap.h>
    3031#include <wtf/HashSet.h>
     
    159160    void resourceAccessed(CachedResource*);
    160161
    161     typedef HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> SecurityOriginSet;
     162    typedef HashSet<RefPtr<SecurityOrigin> > SecurityOriginSet;
    162163    void removeResourcesWithOrigin(SecurityOrigin*);
    163164    void getOriginsWithCache(SecurityOriginSet& origins);
  • trunk/Source/WebCore/page/SecurityOriginHash.h

    r95901 r143287  
    7979} // namespace WebCore
    8080
    81 #endif
     81namespace WTF {
     82    template<typename> struct DefaultHash;
     83
     84    template<> struct DefaultHash<RefPtr<WebCore::SecurityOrigin> > {
     85        typedef WebCore::SecurityOriginHash Hash;
     86    };
     87
     88} // namespace WTF
     89
     90#endif // SecurityOriginHash_h
  • trunk/Source/WebCore/storage/StorageNamespaceImpl.h

    r136323 r143287  
    6060        StorageNamespaceImpl(StorageType, const String& path, unsigned quota);
    6161
    62         typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl>, SecurityOriginHash> StorageAreaMap;
     62        typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl> > StorageAreaMap;
    6363        StorageAreaMap m_storageAreaMap;
    6464
  • trunk/Source/WebKit/mac/ChangeLog

    r143096 r143287  
     12013-02-18  Anders Carlsson  <andersca@apple.com>
     2
     3        Add a DefaultHash for RefPtr<SecurityOrigin>
     4        https://bugs.webkit.org/show_bug.cgi?id=110170
     5
     6        Reviewed by Andreas Kling.
     7
     8        Remove all explicit uses of SecurityOriginHash.
     9
     10        * WebCoreSupport/WebApplicationCache.mm:
     11        (+[WebApplicationCache originsWithCache]):
     12
    1132013-02-15  Eric Carlson  <eric.carlson@apple.com>
    214
  • trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm

    r95919 r143287  
    7474+ (NSArray *)originsWithCache
    7575{
    76     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> coreOrigins;
     76    HashSet<RefPtr<SecurityOrigin> > coreOrigins;
    7777    cacheStorage().getOriginsWithCache(coreOrigins);
    7878   
    7979    NSMutableArray *webOrigins = [[[NSMutableArray alloc] initWithCapacity:coreOrigins.size()] autorelease];
    8080   
    81     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator end = coreOrigins.end();
    82     for (HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator it = coreOrigins.begin(); it != end; ++it) {
     81    HashSet<RefPtr<SecurityOrigin> >::const_iterator end = coreOrigins.end();
     82    for (HashSet<RefPtr<SecurityOrigin> >::const_iterator it = coreOrigins.begin(); it != end; ++it) {
    8383        RetainPtr<WebSecurityOrigin> webOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:(*it).get()]);
    8484        [webOrigins addObject:webOrigin.get()];
  • trunk/Source/WebKit2/ChangeLog

    r143277 r143287  
     12013-02-18  Anders Carlsson  <andersca@apple.com>
     2
     3        Add a DefaultHash for RefPtr<SecurityOrigin>
     4        https://bugs.webkit.org/show_bug.cgi?id=110170
     5
     6        Reviewed by Andreas Kling.
     7
     8        Remove all explicit uses of SecurityOriginHash.
     9
     10        * UIProcess/Storage/StorageManager.cpp:
     11        (StorageManager::SessionStorageNamespace):
     12        * WebProcess/ApplicationCache/WebApplicationCacheManager.cpp:
     13        (WebKit::WebApplicationCacheManager::getApplicationCacheOrigins):
     14        * WebProcess/InjectedBundle/InjectedBundle.cpp:
     15        (WebKit::InjectedBundle::originsWithApplicationCache):
     16        * WebProcess/Notifications/NotificationPermissionRequestManager.h:
     17        Include SecurityOriginHash.h. This fixes a bug where m_originToIDMap used pointer-equality
     18        for looking up security origins.
     19
     20        * WebProcess/ResourceCache/WebResourceCacheManager.cpp:
     21        (WebKit::WebResourceCacheManager::clearCacheForOrigin):
     22        This can just take a const reference.
     23
     24        * WebProcess/ResourceCache/WebResourceCacheManager.h:
     25
    1262013-02-18  Anders Carlsson  <andersca@apple.com>
    227
  • trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp

    r143277 r143287  
    7070    SessionStorageNamespace();
    7171
    72     HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> m_storageAreaMap;
     72    HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea> > m_storageAreaMap;
    7373};
    7474
  • trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp

    r141711 r143287  
    5454void WebApplicationCacheManager::getApplicationCacheOrigins(uint64_t callbackID)
    5555{
    56     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins;
     56    HashSet<RefPtr<SecurityOrigin> > origins;
    5757
    5858    cacheStorage().getOriginsWithCache(origins);
     
    6161    identifiers.reserveCapacity(origins.size());
    6262
    63     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end();
    64     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator i = origins.begin();
     63    HashSet<RefPtr<SecurityOrigin> >::iterator end = origins.end();
     64    HashSet<RefPtr<SecurityOrigin> >::iterator i = origins.begin();
    6565    for (; i != end; ++i) {
    6666        RefPtr<SecurityOrigin> origin = *i;
  • trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp

    r142509 r143287  
    399399PassRefPtr<ImmutableArray> InjectedBundle::originsWithApplicationCache()
    400400{
    401     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins;
     401    HashSet<RefPtr<SecurityOrigin> > origins;
    402402    cacheStorage().getOriginsWithCache(origins);
    403403    Vector< RefPtr<APIObject> > originsVector;
    404404
    405     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator it = origins.begin();
    406     HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end();
     405    HashSet<RefPtr<SecurityOrigin> >::iterator it = origins.begin();
     406    HashSet<RefPtr<SecurityOrigin> >::iterator end = origins.end();
    407407    for ( ; it != end; ++it)
    408408        originsVector.append(WebString::create((*it)->databaseIdentifier()));
  • trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h

    r127299 r143287  
    2929#include <WebCore/NotificationClient.h>
    3030#include <WebCore/NotificationPermissionCallback.h>
     31#include <WebCore/SecurityOriginHash.h>
    3132#include <WebCore/VoidCallback.h>
    3233#include <wtf/HashMap.h>
  • trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp

    r141658 r143287  
    8787}
    8888
    89 void WebResourceCacheManager::clearCacheForOrigin(SecurityOriginData originData, uint32_t cachesToClear) const
     89void WebResourceCacheManager::clearCacheForOrigin(const SecurityOriginData& originData, uint32_t cachesToClear) const
    9090{
    9191#if USE(CFURLCACHE)
  • trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.h

    r141658 r143287  
    5252
    5353    void getCacheOrigins(uint64_t callbackID) const;
    54     void clearCacheForOrigin(SecurityOriginData, uint32_t cachesToClear) const;
     54    void clearCacheForOrigin(const SecurityOriginData&, uint32_t cachesToClear) const;
    5555    void clearCacheForAllOrigins(uint32_t cachesToClear) const;
    5656
Note: See TracChangeset for help on using the changeset viewer.