Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(481)

Unified Diff: Source/core/html/PublicURLManager.cpp

Issue 157363003: Implement Blob.close(). (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebased Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/html/PublicURLManager.h ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/PublicURLManager.cpp
diff --git a/Source/core/html/PublicURLManager.cpp b/Source/core/html/PublicURLManager.cpp
index ce41a3f8978e590e9a8263c74fe741d489a0ede3..f084b7cae8ad74ae9fa696e99d02d0e98f7de42f 100644
--- a/Source/core/html/PublicURLManager.cpp
+++ b/Source/core/html/PublicURLManager.cpp
@@ -27,8 +27,10 @@
#include "config.h"
#include "core/html/PublicURLManager.h"
+#include "core/fetch/MemoryCache.h"
#include "core/html/URLRegistry.h"
#include "platform/weborigin/KURL.h"
+#include "wtf/Vector.h"
#include "wtf/text/StringHash.h"
namespace WebCore {
@@ -46,14 +48,14 @@ PublicURLManager::PublicURLManager(ExecutionContext* context)
{
}
-void PublicURLManager::registerURL(SecurityOrigin* origin, const KURL& url, URLRegistrable* registrable)
+void PublicURLManager::registerURL(SecurityOrigin* origin, const KURL& url, URLRegistrable* registrable, const String& uuid)
{
if (m_isStopped)
return;
- RegistryURLMap::ValueType* found = m_registryToURL.add(&registrable->registry(), URLSet()).storedValue;
+ RegistryURLMap::ValueType* found = m_registryToURL.add(&registrable->registry(), URLMap()).storedValue;
found->key->registerURL(origin, url, registrable);
- found->value.add(url.string());
+ found->value.add(url.string(), uuid);
}
void PublicURLManager::revoke(const KURL& url)
@@ -67,6 +69,27 @@ void PublicURLManager::revoke(const KURL& url)
}
}
+void PublicURLManager::revoke(const String& uuid)
+{
+ // A linear scan; revoking by UUID is assumed rare.
+ Vector<String> urlsToRemove;
+ for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryToURL.end(); ++i) {
+ URLRegistry* registry = i->key;
+ URLMap& registeredURLs = i->value;
+ for (URLMap::iterator j = registeredURLs.begin(); j != registeredURLs.end(); ++j) {
+ if (uuid == j->value) {
+ KURL url(ParsedURLString, j->key);
+ MemoryCache::removeURLFromCache(executionContext(), url);
+ registry->unregisterURL(url);
+ urlsToRemove.append(j->key);
+ }
+ }
+ for (unsigned j = 0; j < urlsToRemove.size(); j++)
+ registeredURLs.remove(urlsToRemove[j]);
+ urlsToRemove.clear();
+ }
+}
+
void PublicURLManager::stop()
{
if (m_isStopped)
@@ -74,8 +97,8 @@ void PublicURLManager::stop()
m_isStopped = true;
for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryToURL.end(); ++i) {
- for (URLSet::iterator j = i->value.begin(); j != i->value.end(); ++j)
- i->key->unregisterURL(KURL(ParsedURLString, *j));
+ for (URLMap::iterator j = i->value.begin(); j != i->value.end(); ++j)
+ i->key->unregisterURL(KURL(ParsedURLString, j->key));
}
m_registryToURL.clear();
« no previous file with comments | « Source/core/html/PublicURLManager.h ('k') | Source/platform/RuntimeEnabledFeatures.in » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698