| 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return adoptRef(new DOMWrapperWorld(worldId, extensionGroup)); | 53 return adoptRef(new DOMWrapperWorld(worldId, extensionGroup)); |
| 54 } | 54 } |
| 55 | 55 |
| 56 DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup) | 56 DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup) |
| 57 : m_worldId(worldId) | 57 : m_worldId(worldId) |
| 58 , m_extensionGroup(extensionGroup) | 58 , m_extensionGroup(extensionGroup) |
| 59 , m_domDataStore(adoptPtr(new DOMDataStore(isMainWorld()))) | 59 , m_domDataStore(adoptPtr(new DOMDataStore(isMainWorld()))) |
| 60 { | 60 { |
| 61 } | 61 } |
| 62 | 62 |
| 63 DOMWrapperWorld* DOMWrapperWorld::mainWorld() | 63 DOMWrapperWorld& DOMWrapperWorld::mainWorld() |
| 64 { | 64 { |
| 65 ASSERT(isMainThread()); | 65 ASSERT(isMainThread()); |
| 66 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create
(MainWorldId, mainWorldExtensionGroup))); | 66 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create
(MainWorldId, mainWorldExtensionGroup))); |
| 67 return cachedMainWorld; | 67 return *cachedMainWorld; |
| 68 } | 68 } |
| 69 | 69 |
| 70 typedef HashMap<int, DOMWrapperWorld*> WorldMap; | 70 typedef HashMap<int, DOMWrapperWorld*> WorldMap; |
| 71 static WorldMap& isolatedWorldMap() | 71 static WorldMap& isolatedWorldMap() |
| 72 { | 72 { |
| 73 ASSERT(isMainThread()); | 73 ASSERT(isMainThread()); |
| 74 DEFINE_STATIC_LOCAL(WorldMap, map, ()); | 74 DEFINE_STATIC_LOCAL(WorldMap, map, ()); |
| 75 return map; | 75 return map; |
| 76 } | 76 } |
| 77 | 77 |
| 78 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo
rlds) | 78 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo
rlds) |
| 79 { | 79 { |
| 80 ASSERT(isMainThread()); | 80 ASSERT(isMainThread()); |
| 81 worlds.append(mainWorld()); | 81 worlds.append(&mainWorld()); |
| 82 WorldMap& isolatedWorlds = isolatedWorldMap(); | 82 WorldMap& isolatedWorlds = isolatedWorldMap(); |
| 83 for (WorldMap::iterator it = isolatedWorlds.begin(); it != isolatedWorlds.en
d(); ++it) | 83 for (WorldMap::iterator it = isolatedWorlds.begin(); it != isolatedWorlds.en
d(); ++it) |
| 84 worlds.append(it->value); | 84 worlds.append(it->value); |
| 85 } | 85 } |
| 86 | 86 |
| 87 DOMWrapperWorld::~DOMWrapperWorld() | 87 DOMWrapperWorld::~DOMWrapperWorld() |
| 88 { | 88 { |
| 89 ASSERT(!isMainWorld()); | 89 ASSERT(!isMainWorld()); |
| 90 | 90 |
| 91 dispose(); | 91 dispose(); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 isolatedWorldContentSecurityPolicies().remove(worldId); | 195 isolatedWorldContentSecurityPolicies().remove(worldId); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void DOMWrapperWorld::clearIsolatedWorldContentSecurityPolicy(int worldId) | 198 void DOMWrapperWorld::clearIsolatedWorldContentSecurityPolicy(int worldId) |
| 199 { | 199 { |
| 200 ASSERT(isIsolatedWorldId(worldId)); | 200 ASSERT(isIsolatedWorldId(worldId)); |
| 201 isolatedWorldContentSecurityPolicies().remove(worldId); | 201 isolatedWorldContentSecurityPolicies().remove(worldId); |
| 202 } | 202 } |
| 203 | 203 |
| 204 } // namespace WebCore | 204 } // namespace WebCore |
| OLD | NEW |