| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 DOMWrapperWorld& DOMWrapperWorld::privateScriptWorld() |
| 71 { |
| 72 ASSERT(isMainThread()); |
| 73 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedPrivateScriptWorld, ()); |
| 74 DEFINE_STATIC_LOCAL(bool, isInitialized, (false)); |
| 75 if (!isInitialized) { |
| 76 isInitialized = true; |
| 77 cachedPrivateScriptWorld = DOMWrapperWorld::create(PrivateScriptIsolated
WorldId, privateScriptIsolatedWorldExtensionGroup); |
| 78 isolatedWorldCount++; |
| 79 } |
| 80 return *cachedPrivateScriptWorld; |
| 81 } |
| 82 |
| 70 typedef HashMap<int, DOMWrapperWorld*> WorldMap; | 83 typedef HashMap<int, DOMWrapperWorld*> WorldMap; |
| 71 static WorldMap& isolatedWorldMap() | 84 static WorldMap& isolatedWorldMap() |
| 72 { | 85 { |
| 73 ASSERT(isMainThread()); | 86 ASSERT(isMainThread()); |
| 74 DEFINE_STATIC_LOCAL(WorldMap, map, ()); | 87 DEFINE_STATIC_LOCAL(WorldMap, map, ()); |
| 75 return map; | 88 return map; |
| 76 } | 89 } |
| 77 | 90 |
| 78 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo
rlds) | 91 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo
rlds) |
| 79 { | 92 { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S
tring& policy) | 196 void DOMWrapperWorld::setIsolatedWorldContentSecurityPolicy(int worldId, const S
tring& policy) |
| 184 { | 197 { |
| 185 ASSERT(isIsolatedWorldId(worldId)); | 198 ASSERT(isIsolatedWorldId(worldId)); |
| 186 if (!policy.isEmpty()) | 199 if (!policy.isEmpty()) |
| 187 isolatedWorldContentSecurityPolicies().set(worldId, true); | 200 isolatedWorldContentSecurityPolicies().set(worldId, true); |
| 188 else | 201 else |
| 189 isolatedWorldContentSecurityPolicies().remove(worldId); | 202 isolatedWorldContentSecurityPolicies().remove(worldId); |
| 190 } | 203 } |
| 191 | 204 |
| 192 } // namespace WebCore | 205 } // namespace WebCore |
| OLD | NEW |