| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 if (m_isStopped) | 53 if (m_isStopped) |
| 54 return; | 54 return; |
| 55 | 55 |
| 56 RegistryURLMap::ValueType* found = m_registryToURL.add(®istrable->registr
y(), URLMap()).storedValue; | 56 RegistryURLMap::ValueType* found = m_registryToURL.add(®istrable->registr
y(), URLMap()).storedValue; |
| 57 found->key->registerURL(origin, url, registrable); | 57 found->key->registerURL(origin, url, registrable); |
| 58 found->value.add(url.string(), uuid); | 58 found->value.add(url.string(), uuid); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void PublicURLManager::revoke(const KURL& url) | 61 void PublicURLManager::revoke(const KURL& url) |
| 62 { | 62 { |
| 63 for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryTo
URL.end(); ++i) { | 63 for (auto& registryUrl : m_registryToURL) { |
| 64 if (i->value.contains(url.string())) { | 64 if (registryUrl.value.contains(url.string())) { |
| 65 i->key->unregisterURL(url); | 65 registryUrl.key->unregisterURL(url); |
| 66 i->value.remove(url.string()); | 66 registryUrl.value.remove(url.string()); |
| 67 break; | 67 break; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 } | 70 } |
| 71 | 71 |
| 72 void PublicURLManager::revoke(const String& uuid) | 72 void PublicURLManager::revoke(const String& uuid) |
| 73 { | 73 { |
| 74 // A linear scan; revoking by UUID is assumed rare. | 74 // A linear scan; revoking by UUID is assumed rare. |
| 75 Vector<String> urlsToRemove; | 75 Vector<String> urlsToRemove; |
| 76 for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryTo
URL.end(); ++i) { | 76 for (auto& registryUrl : m_registryToURL) { |
| 77 URLRegistry* registry = i->key; | 77 URLRegistry* registry = registryUrl.key; |
| 78 URLMap& registeredURLs = i->value; | 78 URLMap& registeredURLs = registryUrl.value; |
| 79 for (URLMap::iterator j = registeredURLs.begin(); j != registeredURLs.en
d(); ++j) { | 79 for (auto& registeredUrl : registeredURLs) { |
| 80 if (uuid == j->value) { | 80 if (uuid == registeredUrl.value) { |
| 81 KURL url(ParsedURLString, j->key); | 81 KURL url(ParsedURLString, registeredUrl.key); |
| 82 MemoryCache::removeURLFromCache(executionContext(), url); | 82 MemoryCache::removeURLFromCache(executionContext(), url); |
| 83 registry->unregisterURL(url); | 83 registry->unregisterURL(url); |
| 84 urlsToRemove.append(j->key); | 84 urlsToRemove.append(registeredUrl.key); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 for (unsigned j = 0; j < urlsToRemove.size(); j++) | 87 for (unsigned j = 0; j < urlsToRemove.size(); j++) |
| 88 registeredURLs.remove(urlsToRemove[j]); | 88 registeredURLs.remove(urlsToRemove[j]); |
| 89 urlsToRemove.clear(); | 89 urlsToRemove.clear(); |
| 90 } | 90 } |
| 91 } | 91 } |
| 92 | 92 |
| 93 void PublicURLManager::stop() | 93 void PublicURLManager::stop() |
| 94 { | 94 { |
| 95 if (m_isStopped) | 95 if (m_isStopped) |
| 96 return; | 96 return; |
| 97 | 97 |
| 98 m_isStopped = true; | 98 m_isStopped = true; |
| 99 for (RegistryURLMap::iterator i = m_registryToURL.begin(); i != m_registryTo
URL.end(); ++i) { | 99 for (auto& registryUrl : m_registryToURL) { |
| 100 for (URLMap::iterator j = i->value.begin(); j != i->value.end(); ++j) | 100 for (auto& url : registryUrl.value) |
| 101 i->key->unregisterURL(KURL(ParsedURLString, j->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 } | 107 } |
| OLD | NEW |