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

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: Avoid warning from PHP's fread() on empty reads 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
« Source/core/fileapi/FileReader.cpp ('K') | « Source/core/html/PublicURLManager.h ('k') | no next file » | 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 09157de9df7ad8f906cb24ffd2b51e96549bdbba..72d1de411a8fff4e268f216e1fb6613f1cc230ef 100644
--- a/Source/core/html/PublicURLManager.cpp
+++ b/Source/core/html/PublicURLManager.cpp
@@ -29,6 +29,7 @@
#include "core/html/URLRegistry.h"
#include "platform/weborigin/KURL.h"
+#include "wtf/Vector.h"
#include "wtf/text/StringHash.h"
namespace WebCore {
@@ -46,14 +47,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::iterator found = m_registryToURL.add(&registrable->registry(), URLSet()).iterator;
+ RegistryURLMap::iterator found = m_registryToURL.add(&registrable->registry(), URLMap()).iterator;
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 +68,25 @@ void PublicURLManager::revoke(const KURL& url)
}
}
+void PublicURLManager::revoke(const String& uuid)
+{
+ // A linear scan; revoking by UUID is assumed rare.
+ Vector<String> removableKeys;
+ for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryToURL.end(); ++i) {
+ for (URLMap::iterator j = i->value.begin(); j != i->value.end(); ++j) {
+ if (uuid == j->value) {
+ i->key->unregisterURL(KURL(ParsedURLString, j->key));
+ removableKeys.append(j->key);
+ }
+ }
+ if (removableKeys.size()) {
+ for (unsigned j = 0; j < removableKeys.size(); j++)
+ i->value.remove(removableKeys[j]);
+ removableKeys.clear();
+ }
kinuko 2014/02/12 06:11:20 It might be slightly more readable if we just main
sof 2014/02/12 06:56:47 It would have to be UUID to a set of URLs; would t
kinuko 2014/02/12 12:52:00 I guessed in general this map'd be relatively smal
sof 2014/02/13 09:59:57 Thanks, I've tried to improve readability - please
+ }
+}
+
void PublicURLManager::stop()
{
if (m_isStopped)
@@ -74,8 +94,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();
« Source/core/fileapi/FileReader.cpp ('K') | « Source/core/html/PublicURLManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698