Title: [143287] trunk/Source
Revision
143287
Author
[email protected]
Date
2013-02-18 18:55:26 -0800 (Mon, 18 Feb 2013)

Log 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:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (143286 => 143287)


--- trunk/Source/WebCore/ChangeLog	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/ChangeLog	2013-02-19 02:55:26 UTC (rev 143287)
@@ -1,3 +1,21 @@
+2013-02-18  Anders Carlsson  <[email protected]>
+
+        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.
+
+        * 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):
+
 2013-02-18  David Hyatt  <[email protected]>
 
         Padding and border changes don't trigger the relayout of children in some cases.

Modified: trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h (143286 => 143287)


--- trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/Modules/webdatabase/DatabaseTracker.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -40,6 +40,7 @@
 #if !PLATFORM(CHROMIUM)
 #include "DatabaseDetails.h"
 #include "SQLiteDatabase.h"
+#include "SecurityOriginHash.h"
 #include <wtf/OwnPtr.h>
 #endif // !PLATFORM(CHROMIUM)
 
@@ -49,12 +50,9 @@
 class DatabaseBackendContext;
 class SecurityOrigin;
 
-struct SecurityOriginHash;
-
 #if !PLATFORM(CHROMIUM)
 class DatabaseManagerClient;
 
-struct SecurityOriginTraits;
 #endif // !PLATFORM(CHROMIUM)
 
 class DatabaseTracker {
@@ -145,7 +143,7 @@
 
     typedef HashSet<DatabaseBackend*> DatabaseSet;
     typedef HashMap<String, DatabaseSet*> DatabaseNameMap;
-    typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*, SecurityOriginHash> DatabaseOriginMap;
+    typedef HashMap<RefPtr<SecurityOrigin>, DatabaseNameMap*> DatabaseOriginMap;
 
     Mutex m_openDatabaseMapGuard;
     mutable OwnPtr<DatabaseOriginMap> m_openDatabaseMap;
@@ -154,7 +152,7 @@
     Mutex m_databaseGuard;
     SQLiteDatabase m_database;
 
-    typedef HashMap<RefPtr<SecurityOrigin>, unsigned long long, SecurityOriginHash> QuotaMap;
+    typedef HashMap<RefPtr<SecurityOrigin>, unsigned long long> QuotaMap;
     mutable OwnPtr<QuotaMap> m_quotaMap;
 
     String m_databaseDirectoryPath;
@@ -165,8 +163,8 @@
     typedef HashMap<RefPtr<SecurityOrigin>, NameCountMap*, SecurityOriginHash> CreateSet;
     CreateSet m_beingCreated;
     typedef HashSet<String> NameSet;
-    HashMap<RefPtr<SecurityOrigin>, NameSet*, SecurityOriginHash> m_beingDeleted;
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> m_originsBeingDeleted;
+    HashMap<RefPtr<SecurityOrigin>, NameSet*> m_beingDeleted;
+    HashSet<RefPtr<SecurityOrigin> > m_originsBeingDeleted;
     bool isDeletingDatabaseOrOriginFor(SecurityOrigin*, const String& name);
     void recordCreatingDatabase(SecurityOrigin*, const String& name);
     void doneCreatingDatabase(SecurityOrigin*, const String& name);

Modified: trunk/Source/WebCore/Modules/webdatabase/OriginQuotaManager.h (143286 => 143287)


--- trunk/Source/WebCore/Modules/webdatabase/OriginQuotaManager.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/Modules/webdatabase/OriginQuotaManager.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -40,6 +40,7 @@
 
 class DatabaseBackend;
 class OriginUsageRecord;
+class SecurityOrigin;
 
 class OriginQuotaManager {
     WTF_MAKE_NONCOPYABLE(OriginQuotaManager); WTF_MAKE_FAST_ALLOCATED;
@@ -65,7 +66,7 @@
     bool m_usageRecordGuardLocked;
 #endif
 
-    typedef HashMap<RefPtr<SecurityOrigin>, OriginUsageRecord*, SecurityOriginHash> OriginUsageMap;
+    typedef HashMap<RefPtr<SecurityOrigin>, OriginUsageRecord*> OriginUsageMap;
     OriginUsageMap m_usageMap;
 };
 

Modified: trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp (143286 => 143287)


--- trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/loader/appcache/ApplicationCacheStorage.cpp	2013-02-19 02:55:26 UTC (rev 143287)
@@ -1512,7 +1512,7 @@
     return totalSize;
 }
 
-void ApplicationCacheStorage::getOriginsWithCache(HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>& origins)
+void ApplicationCacheStorage::getOriginsWithCache(HashSet<RefPtr<SecurityOrigin> >& origins)
 {
     Vector<KURL> urls;
     if (!manifestURLs(&urls)) {

Modified: trunk/Source/WebCore/loader/cache/MemoryCache.h (143286 => 143287)


--- trunk/Source/WebCore/loader/cache/MemoryCache.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -26,6 +26,7 @@
 #define Cache_h
 
 #include "CachedResource.h"
+#include "SecurityOriginHash.h"
 #include <wtf/HashMap.h>
 #include <wtf/HashSet.h>
 #include <wtf/Noncopyable.h>
@@ -158,7 +159,7 @@
     
     void resourceAccessed(CachedResource*);
 
-    typedef HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> SecurityOriginSet;
+    typedef HashSet<RefPtr<SecurityOrigin> > SecurityOriginSet;
     void removeResourcesWithOrigin(SecurityOrigin*);
     void getOriginsWithCache(SecurityOriginSet& origins);
 

Modified: trunk/Source/WebCore/page/SecurityOriginHash.h (143286 => 143287)


--- trunk/Source/WebCore/page/SecurityOriginHash.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/page/SecurityOriginHash.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -78,4 +78,13 @@
 
 } // namespace WebCore
 
-#endif
+namespace WTF {
+    template<typename> struct DefaultHash;
+
+    template<> struct DefaultHash<RefPtr<WebCore::SecurityOrigin> > {
+        typedef WebCore::SecurityOriginHash Hash;
+    };
+
+} // namespace WTF
+
+#endif // SecurityOriginHash_h

Modified: trunk/Source/WebCore/storage/StorageNamespaceImpl.h (143286 => 143287)


--- trunk/Source/WebCore/storage/StorageNamespaceImpl.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebCore/storage/StorageNamespaceImpl.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -59,7 +59,7 @@
     private:
         StorageNamespaceImpl(StorageType, const String& path, unsigned quota);
 
-        typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl>, SecurityOriginHash> StorageAreaMap;
+        typedef HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageAreaImpl> > StorageAreaMap;
         StorageAreaMap m_storageAreaMap;
 
         StorageType m_storageType;

Modified: trunk/Source/WebKit/mac/ChangeLog (143286 => 143287)


--- trunk/Source/WebKit/mac/ChangeLog	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit/mac/ChangeLog	2013-02-19 02:55:26 UTC (rev 143287)
@@ -1,3 +1,15 @@
+2013-02-18  Anders Carlsson  <[email protected]>
+
+        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.
+
+        * WebCoreSupport/WebApplicationCache.mm:
+        (+[WebApplicationCache originsWithCache]):
+
 2013-02-15  Eric Carlson  <[email protected]>
 
         [Mac] remove wkCaptionAppearance from WebKitSystemInterface

Modified: trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm (143286 => 143287)


--- trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit/mac/WebCoreSupport/WebApplicationCache.mm	2013-02-19 02:55:26 UTC (rev 143287)
@@ -73,13 +73,13 @@
 
 + (NSArray *)originsWithCache
 {
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> coreOrigins;
+    HashSet<RefPtr<SecurityOrigin> > coreOrigins;
     cacheStorage().getOriginsWithCache(coreOrigins);
     
     NSMutableArray *webOrigins = [[[NSMutableArray alloc] initWithCapacity:coreOrigins.size()] autorelease];
     
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator end = coreOrigins.end();
-    for (HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::const_iterator it = coreOrigins.begin(); it != end; ++it) {
+    HashSet<RefPtr<SecurityOrigin> >::const_iterator end = coreOrigins.end();
+    for (HashSet<RefPtr<SecurityOrigin> >::const_iterator it = coreOrigins.begin(); it != end; ++it) {
         RetainPtr<WebSecurityOrigin> webOrigin(AdoptNS, [[WebSecurityOrigin alloc] _initWithWebCoreSecurityOrigin:(*it).get()]);
         [webOrigins addObject:webOrigin.get()];
     }

Modified: trunk/Source/WebKit2/ChangeLog (143286 => 143287)


--- trunk/Source/WebKit2/ChangeLog	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/ChangeLog	2013-02-19 02:55:26 UTC (rev 143287)
@@ -1,5 +1,30 @@
 2013-02-18  Anders Carlsson  <[email protected]>
 
+        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.
+
+        * 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:
+
+2013-02-18  Anders Carlsson  <[email protected]>
+
         Begin stubbing out session storage classes
         https://bugs.webkit.org/show_bug.cgi?id=110168
 

Modified: trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp (143286 => 143287)


--- trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/UIProcess/Storage/StorageManager.cpp	2013-02-19 02:55:26 UTC (rev 143287)
@@ -69,7 +69,7 @@
 private:
     SessionStorageNamespace();
 
-    HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea>, SecurityOriginHash> m_storageAreaMap;
+    HashMap<RefPtr<SecurityOrigin>, RefPtr<StorageArea> > m_storageAreaMap;
 };
 
 PassRefPtr<StorageManager::SessionStorageNamespace> StorageManager::SessionStorageNamespace::create()

Modified: trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp (143286 => 143287)


--- trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/WebProcess/ApplicationCache/WebApplicationCacheManager.cpp	2013-02-19 02:55:26 UTC (rev 143287)
@@ -53,15 +53,15 @@
 
 void WebApplicationCacheManager::getApplicationCacheOrigins(uint64_t callbackID)
 {
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins;
+    HashSet<RefPtr<SecurityOrigin> > origins;
 
     cacheStorage().getOriginsWithCache(origins);
 
     Vector<SecurityOriginData> identifiers;
     identifiers.reserveCapacity(origins.size());
 
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end();
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator i = origins.begin();
+    HashSet<RefPtr<SecurityOrigin> >::iterator end = origins.end();
+    HashSet<RefPtr<SecurityOrigin> >::iterator i = origins.begin();
     for (; i != end; ++i) {
         RefPtr<SecurityOrigin> origin = *i;
         

Modified: trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp (143286 => 143287)


--- trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/WebProcess/InjectedBundle/InjectedBundle.cpp	2013-02-19 02:55:26 UTC (rev 143287)
@@ -398,12 +398,12 @@
 
 PassRefPtr<ImmutableArray> InjectedBundle::originsWithApplicationCache()
 {
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash> origins;
+    HashSet<RefPtr<SecurityOrigin> > origins;
     cacheStorage().getOriginsWithCache(origins);
     Vector< RefPtr<APIObject> > originsVector;
 
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator it = origins.begin();
-    HashSet<RefPtr<SecurityOrigin>, SecurityOriginHash>::iterator end = origins.end();
+    HashSet<RefPtr<SecurityOrigin> >::iterator it = origins.begin();
+    HashSet<RefPtr<SecurityOrigin> >::iterator end = origins.end();
     for ( ; it != end; ++it)
         originsVector.append(WebString::create((*it)->databaseIdentifier()));
 

Modified: trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h (143286 => 143287)


--- trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/WebProcess/Notifications/NotificationPermissionRequestManager.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -28,6 +28,7 @@
 
 #include <WebCore/NotificationClient.h>
 #include <WebCore/NotificationPermissionCallback.h>
+#include <WebCore/SecurityOriginHash.h>
 #include <WebCore/VoidCallback.h>
 #include <wtf/HashMap.h>
 #include <wtf/RefCounted.h>

Modified: trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp (143286 => 143287)


--- trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.cpp	2013-02-19 02:55:26 UTC (rev 143287)
@@ -86,7 +86,7 @@
     m_process->send(Messages::WebResourceCacheManagerProxy::DidGetCacheOrigins(identifiers, callbackID), 0);
 }
 
-void WebResourceCacheManager::clearCacheForOrigin(SecurityOriginData originData, uint32_t cachesToClear) const
+void WebResourceCacheManager::clearCacheForOrigin(const SecurityOriginData& originData, uint32_t cachesToClear) const
 {
 #if USE(CFURLCACHE)
     ResourceCachesToClear resourceCachesToClear = static_cast<ResourceCachesToClear>(cachesToClear);

Modified: trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.h (143286 => 143287)


--- trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.h	2013-02-19 02:34:53 UTC (rev 143286)
+++ trunk/Source/WebKit2/WebProcess/ResourceCache/WebResourceCacheManager.h	2013-02-19 02:55:26 UTC (rev 143287)
@@ -51,7 +51,7 @@
     virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageDecoder&) OVERRIDE;
 
     void getCacheOrigins(uint64_t callbackID) const;
-    void clearCacheForOrigin(SecurityOriginData, uint32_t cachesToClear) const;
+    void clearCacheForOrigin(const SecurityOriginData&, uint32_t cachesToClear) const;
     void clearCacheForAllOrigins(uint32_t cachesToClear) const;
 
 #if USE(CFURLCACHE)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to