| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | 21 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | 22 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "bindings/core/v8/DOMWrapperWorld.h" | 31 #include "platform/bindings/DOMWrapperWorld.h" |
| 32 | 32 |
| 33 #include <memory> | 33 #include <memory> |
| 34 | 34 |
| 35 #include "bindings/core/v8/DOMDataStore.h" | 35 #include "platform/bindings/DOMDataStore.h" |
| 36 #include "bindings/core/v8/ScriptFunction.h" | |
| 37 #include "platform/wtf/HashTraits.h" | 36 #include "platform/wtf/HashTraits.h" |
| 38 #include "platform/wtf/PtrUtil.h" | 37 #include "platform/wtf/PtrUtil.h" |
| 39 #include "platform/wtf/StdLibExtras.h" | 38 #include "platform/wtf/StdLibExtras.h" |
| 40 | 39 |
| 41 namespace blink { | 40 namespace blink { |
| 42 | 41 |
| 43 unsigned DOMWrapperWorld::number_of_non_main_worlds_in_main_thread_ = 0; | 42 unsigned DOMWrapperWorld::number_of_non_main_worlds_in_main_thread_ = 0; |
| 44 | 43 |
| 45 // This does not contain the main world because the WorldMap needs | 44 // This does not contain the main world because the WorldMap needs |
| 46 // non-default hashmap traits (WTF::UnsignedWithZeroKeyHashTraits) to contain | 45 // non-default hashmap traits (WTF::UnsignedWithZeroKeyHashTraits) to contain |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 } | 188 } |
| 190 | 189 |
| 191 typedef HashMap<int, String> IsolatedWorldHumanReadableNameMap; | 190 typedef HashMap<int, String> IsolatedWorldHumanReadableNameMap; |
| 192 static IsolatedWorldHumanReadableNameMap& IsolatedWorldHumanReadableNames() { | 191 static IsolatedWorldHumanReadableNameMap& IsolatedWorldHumanReadableNames() { |
| 193 DCHECK(IsMainThread()); | 192 DCHECK(IsMainThread()); |
| 194 DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ()); | 193 DEFINE_STATIC_LOCAL(IsolatedWorldHumanReadableNameMap, map, ()); |
| 195 return map; | 194 return map; |
| 196 } | 195 } |
| 197 | 196 |
| 198 String DOMWrapperWorld::IsolatedWorldHumanReadableName() { | 197 String DOMWrapperWorld::IsolatedWorldHumanReadableName() { |
| 199 ASSERT(this->IsIsolatedWorld()); | 198 DCHECK(this->IsIsolatedWorld()); |
| 200 return IsolatedWorldHumanReadableNames().at(GetWorldId()); | 199 return IsolatedWorldHumanReadableNames().at(GetWorldId()); |
| 201 } | 200 } |
| 202 | 201 |
| 203 void DOMWrapperWorld::SetIsolatedWorldHumanReadableName( | 202 void DOMWrapperWorld::SetIsolatedWorldHumanReadableName( |
| 204 int world_id, | 203 int world_id, |
| 205 const String& human_readable_name) { | 204 const String& human_readable_name) { |
| 206 #if DCHECK_IS_ON() | 205 #if DCHECK_IS_ON() |
| 207 DCHECK(IsIsolatedWorldId(world_id)); | 206 DCHECK(IsIsolatedWorldId(world_id)); |
| 208 #endif | 207 #endif |
| 209 IsolatedWorldHumanReadableNames().Set(world_id, human_readable_name); | 208 IsolatedWorldHumanReadableNames().Set(world_id, human_readable_name); |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 DCHECK(script_wrappable); | 288 DCHECK(script_wrappable); |
| 290 DCHECK(IsMainThread()); | 289 DCHECK(IsMainThread()); |
| 291 | 290 |
| 292 script_wrappable->UnsetWrapperIfAny(); | 291 script_wrappable->UnsetWrapperIfAny(); |
| 293 | 292 |
| 294 for (auto& world : GetWorldMap().Values()) | 293 for (auto& world : GetWorldMap().Values()) |
| 295 world->DomDataStore().UnsetWrapperIfAny(script_wrappable); | 294 world->DomDataStore().UnsetWrapperIfAny(script_wrappable); |
| 296 } | 295 } |
| 297 | 296 |
| 298 } // namespace blink | 297 } // namespace blink |
| OLD | NEW |