| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 found->value.add(urlString, uuid); | 58 found->value.add(urlString, uuid); |
| 59 } | 59 } |
| 60 | 60 |
| 61 return urlString; | 61 return urlString; |
| 62 } | 62 } |
| 63 | 63 |
| 64 void PublicURLManager::revoke(const KURL& url) { | 64 void PublicURLManager::revoke(const KURL& url) { |
| 65 for (auto& registryUrl : m_registryToURL) { | 65 for (auto& registryUrl : m_registryToURL) { |
| 66 if (registryUrl.value.contains(url.getString())) { | 66 if (registryUrl.value.contains(url.getString())) { |
| 67 registryUrl.key->unregisterURL(url); | 67 registryUrl.key->unregisterURL(url); |
| 68 registryUrl.value.remove(url.getString()); | 68 registryUrl.value.erase(url.getString()); |
| 69 break; | 69 break; |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 } | 72 } |
| 73 | 73 |
| 74 void PublicURLManager::revoke(const String& uuid) { | 74 void PublicURLManager::revoke(const String& uuid) { |
| 75 // A linear scan; revoking by UUID is assumed rare. | 75 // A linear scan; revoking by UUID is assumed rare. |
| 76 Vector<String> urlsToRemove; | 76 Vector<String> urlsToRemove; |
| 77 for (auto& registryUrl : m_registryToURL) { | 77 for (auto& registryUrl : m_registryToURL) { |
| 78 URLRegistry* registry = registryUrl.key; | 78 URLRegistry* registry = registryUrl.key; |
| 79 URLMap& registeredURLs = registryUrl.value; | 79 URLMap& registeredURLs = registryUrl.value; |
| 80 for (auto& registeredUrl : registeredURLs) { | 80 for (auto& registeredUrl : registeredURLs) { |
| 81 if (uuid == registeredUrl.value) { | 81 if (uuid == registeredUrl.value) { |
| 82 KURL url(ParsedURLString, registeredUrl.key); | 82 KURL url(ParsedURLString, registeredUrl.key); |
| 83 getExecutionContext()->removeURLFromMemoryCache(url); | 83 getExecutionContext()->removeURLFromMemoryCache(url); |
| 84 registry->unregisterURL(url); | 84 registry->unregisterURL(url); |
| 85 urlsToRemove.push_back(registeredUrl.key); | 85 urlsToRemove.push_back(registeredUrl.key); |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 for (const auto& url : urlsToRemove) | 88 for (const auto& url : urlsToRemove) |
| 89 registeredURLs.remove(url); | 89 registeredURLs.erase(url); |
| 90 urlsToRemove.clear(); | 90 urlsToRemove.clear(); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void PublicURLManager::contextDestroyed(ExecutionContext*) { | 94 void PublicURLManager::contextDestroyed(ExecutionContext*) { |
| 95 if (m_isStopped) | 95 if (m_isStopped) |
| 96 return; | 96 return; |
| 97 | 97 |
| 98 m_isStopped = true; | 98 m_isStopped = true; |
| 99 for (auto& registryUrl : m_registryToURL) { | 99 for (auto& registryUrl : m_registryToURL) { |
| 100 for (auto& url : registryUrl.value) | 100 for (auto& url : registryUrl.value) |
| 101 registryUrl.key->unregisterURL(KURL(ParsedURLString, url.key)); | 101 registryUrl.key->unregisterURL(KURL(ParsedURLString, url.key)); |
| 102 } | 102 } |
| 103 | 103 |
| 104 m_registryToURL.clear(); | 104 m_registryToURL.clear(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 DEFINE_TRACE(PublicURLManager) { | 107 DEFINE_TRACE(PublicURLManager) { |
| 108 ContextLifecycleObserver::trace(visitor); | 108 ContextLifecycleObserver::trace(visitor); |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace blink | 111 } // namespace blink |
| OLD | NEW |