OLD | NEW |
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. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 break; | 70 break; |
71 } | 71 } |
72 } | 72 } |
73 } | 73 } |
74 | 74 |
75 void PublicURLManager::Revoke(const String& uuid) { | 75 void PublicURLManager::Revoke(const String& uuid) { |
76 // A linear scan; revoking by UUID is assumed rare. | 76 // A linear scan; revoking by UUID is assumed rare. |
77 Vector<String> urls_to_remove; | 77 Vector<String> urls_to_remove; |
78 for (auto& registry_url : registry_to_url_) { | 78 for (auto& registry_url : registry_to_url_) { |
79 URLRegistry* registry = registry_url.key; | 79 URLRegistry* registry = registry_url.key; |
80 URLMap& registered_ur_ls = registry_url.value; | 80 URLMap& registered_urls = registry_url.value; |
81 for (auto& registered_url : registered_ur_ls) { | 81 for (auto& registered_url : registered_urls) { |
82 if (uuid == registered_url.value) { | 82 if (uuid == registered_url.value) { |
83 KURL url(kParsedURLString, registered_url.key); | 83 KURL url(kParsedURLString, registered_url.key); |
84 GetExecutionContext()->RemoveURLFromMemoryCache(url); | 84 GetExecutionContext()->RemoveURLFromMemoryCache(url); |
85 registry->UnregisterURL(url); | 85 registry->UnregisterURL(url); |
86 urls_to_remove.push_back(registered_url.key); | 86 urls_to_remove.push_back(registered_url.key); |
87 } | 87 } |
88 } | 88 } |
89 for (const auto& url : urls_to_remove) | 89 for (const auto& url : urls_to_remove) |
90 registered_ur_ls.erase(url); | 90 registered_urls.erase(url); |
91 urls_to_remove.Clear(); | 91 urls_to_remove.Clear(); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
95 void PublicURLManager::ContextDestroyed(ExecutionContext*) { | 95 void PublicURLManager::ContextDestroyed(ExecutionContext*) { |
96 if (is_stopped_) | 96 if (is_stopped_) |
97 return; | 97 return; |
98 | 98 |
99 is_stopped_ = true; | 99 is_stopped_ = true; |
100 for (auto& registry_url : registry_to_url_) { | 100 for (auto& registry_url : registry_to_url_) { |
101 for (auto& url : registry_url.value) | 101 for (auto& url : registry_url.value) |
102 registry_url.key->UnregisterURL(KURL(kParsedURLString, url.key)); | 102 registry_url.key->UnregisterURL(KURL(kParsedURLString, url.key)); |
103 } | 103 } |
104 | 104 |
105 registry_to_url_.Clear(); | 105 registry_to_url_.Clear(); |
106 } | 106 } |
107 | 107 |
108 DEFINE_TRACE(PublicURLManager) { | 108 DEFINE_TRACE(PublicURLManager) { |
109 ContextLifecycleObserver::Trace(visitor); | 109 ContextLifecycleObserver::Trace(visitor); |
110 } | 110 } |
111 | 111 |
112 } // namespace blink | 112 } // namespace blink |
OLD | NEW |