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

Side by Side Diff: third_party/WebKit/Source/core/html/PublicURLManager.cpp

Issue 2268973002: Rename SecurityOriginCache to URLSecurityOriginMap (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2012 Motorola Mobility Inc. 2 * Copyright (C) 2012 Motorola Mobility Inc.
3 * Copyright (C) 2013 Google Inc. All Rights Reserved. 3 * Copyright (C) 2013 Google Inc. All Rights Reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright 11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the 12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution. 13 * documentation and/or other materials provided with the distribution.
14 * 14 *
15 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY 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 16 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 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 18 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 19 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
20 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 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 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 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 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. 24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */ 25 */
26 26
27 #include "core/html/PublicURLManager.h" 27 #include "core/html/PublicURLManager.h"
28 28
29 #include "core/fetch/MemoryCache.h"
30 #include "core/html/URLRegistry.h" 29 #include "core/html/URLRegistry.h"
30 #include "platform/blob/BlobURL.h"
31 #include "platform/weborigin/KURL.h" 31 #include "platform/weborigin/KURL.h"
32 #include "wtf/Vector.h" 32 #include "wtf/Vector.h"
33 #include "wtf/text/StringHash.h" 33 #include "wtf/text/StringHash.h"
34 34
35 namespace blink { 35 namespace blink {
36 36
37 class SecurityOrigin;
38
37 PublicURLManager* PublicURLManager::create(ExecutionContext* context) 39 PublicURLManager* PublicURLManager::create(ExecutionContext* context)
38 { 40 {
39 PublicURLManager* publicURLManager = new PublicURLManager(context); 41 PublicURLManager* publicURLManager = new PublicURLManager(context);
40 publicURLManager->suspendIfNeeded(); 42 publicURLManager->suspendIfNeeded();
41 return publicURLManager; 43 return publicURLManager;
42 } 44 }
43 45
44 PublicURLManager::PublicURLManager(ExecutionContext* context) 46 PublicURLManager::PublicURLManager(ExecutionContext* context)
45 : ActiveDOMObject(context) 47 : ActiveDOMObject(context)
46 , m_isStopped(false) 48 , m_isStopped(false)
47 { 49 {
48 } 50 }
49 51
50 void PublicURLManager::registerURL(SecurityOrigin* origin, const KURL& url, URLR egistrable* registrable, const String& uuid) 52 String PublicURLManager::registerURL(ExecutionContext* context, URLRegistrable* registrable, const String& uuid)
51 { 53 {
52 if (m_isStopped) 54 SecurityOrigin* origin = context->getSecurityOrigin();
53 return; 55 const KURL& url = BlobURL::createPublicURL(origin);
56 if (url.isEmpty())
57 return String();
54 58
55 RegistryURLMap::ValueType* found = m_registryToURL.add(&registrable->registr y(), URLMap()).storedValue; 59 const String& urlString = url.getString();
56 found->key->registerURL(origin, url, registrable); 60
57 found->value.add(url.getString(), uuid); 61 if (!m_isStopped) {
62 RegistryURLMap::ValueType* found = m_registryToURL.add(&registrable->reg istry(), URLMap()).storedValue;
63 found->key->registerURL(origin, url, registrable);
64 found->value.add(urlString, uuid);
65 }
66
67 return urlString;
58 } 68 }
59 69
60 void PublicURLManager::revoke(const KURL& url) 70 void PublicURLManager::revoke(const KURL& url)
61 { 71 {
62 for (auto& registryUrl : m_registryToURL) { 72 for (auto& registryUrl : m_registryToURL) {
63 if (registryUrl.value.contains(url.getString())) { 73 if (registryUrl.value.contains(url.getString())) {
64 registryUrl.key->unregisterURL(url); 74 registryUrl.key->unregisterURL(url);
65 registryUrl.value.remove(url.getString()); 75 registryUrl.value.remove(url.getString());
66 break; 76 break;
67 } 77 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 112
103 m_registryToURL.clear(); 113 m_registryToURL.clear();
104 } 114 }
105 115
106 DEFINE_TRACE(PublicURLManager) 116 DEFINE_TRACE(PublicURLManager)
107 { 117 {
108 ActiveDOMObject::trace(visitor); 118 ActiveDOMObject::trace(visitor);
109 } 119 }
110 120
111 } // namespace blink 121 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698