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

Side by Side Diff: sky/engine/core/html/PublicURLManager.cpp

Issue 700753006: Remove PublicURLManager. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « sky/engine/core/html/PublicURLManager.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 /*
2 * Copyright (C) 2012 Motorola Mobility Inc.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
21 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
22 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27 #include "config.h"
28 #include "core/html/PublicURLManager.h"
29
30 #include "core/fetch/MemoryCache.h"
31 #include "core/html/URLRegistry.h"
32 #include "platform/weborigin/KURL.h"
33 #include "wtf/Vector.h"
34 #include "wtf/text/StringHash.h"
35
36 namespace blink {
37
38 PassOwnPtr<PublicURLManager> PublicURLManager::create(ExecutionContext* context)
39 {
40 OwnPtr<PublicURLManager> publicURLManager(adoptPtr(new PublicURLManager(cont ext)));
41 publicURLManager->suspendIfNeeded();
42 return publicURLManager.release();
43 }
44
45 PublicURLManager::PublicURLManager(ExecutionContext* context)
46 : ActiveDOMObject(context)
47 , m_isStopped(false)
48 {
49 }
50
51 void PublicURLManager::revoke(const KURL& url)
52 {
53 for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryTo URL.end(); ++i) {
54 if (i->value.contains(url.string())) {
55 i->key->unregisterURL(url);
56 i->value.remove(url.string());
57 break;
58 }
59 }
60 }
61
62 void PublicURLManager::revoke(const String& uuid)
63 {
64 // A linear scan; revoking by UUID is assumed rare.
65 Vector<String> urlsToRemove;
66 for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryTo URL.end(); ++i) {
67 URLRegistry* registry = i->key;
68 URLMap& registeredURLs = i->value;
69 for (URLMap::iterator j = registeredURLs.begin(); j != registeredURLs.en d(); ++j) {
70 if (uuid == j->value) {
71 KURL url(ParsedURLString, j->key);
72 MemoryCache::removeURLFromCache(executionContext(), url);
73 registry->unregisterURL(url);
74 urlsToRemove.append(j->key);
75 }
76 }
77 for (unsigned j = 0; j < urlsToRemove.size(); j++)
78 registeredURLs.remove(urlsToRemove[j]);
79 urlsToRemove.clear();
80 }
81 }
82
83 void PublicURLManager::stop()
84 {
85 if (m_isStopped)
86 return;
87
88 m_isStopped = true;
89 for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryTo URL.end(); ++i) {
90 for (URLMap::iterator j = i->value.begin(); j != i->value.end(); ++j)
91 i->key->unregisterURL(KURL(ParsedURLString, j->key));
92 }
93
94 m_registryToURL.clear();
95 }
96
97 }
OLDNEW
« no previous file with comments | « sky/engine/core/html/PublicURLManager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698