| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 } | 82 } |
| 83 | 83 |
| 84 typedef HashMap<int, DOMWrapperWorld*> WorldMap; | 84 typedef HashMap<int, DOMWrapperWorld*> WorldMap; |
| 85 static WorldMap& isolatedWorldMap() | 85 static WorldMap& isolatedWorldMap() |
| 86 { | 86 { |
| 87 ASSERT(isMainThread()); | 87 ASSERT(isMainThread()); |
| 88 DEFINE_STATIC_LOCAL(WorldMap, map, ()); | 88 DEFINE_STATIC_LOCAL(WorldMap, map, ()); |
| 89 return map; | 89 return map; |
| 90 } | 90 } |
| 91 | 91 |
| 92 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld> >& wo
rlds) | 92 void DOMWrapperWorld::allWorldsInMainThread(Vector<RefPtr<DOMWrapperWorld>>& wor
lds) |
| 93 { | 93 { |
| 94 ASSERT(isMainThread()); | 94 ASSERT(isMainThread()); |
| 95 worlds.append(&mainWorld()); | 95 worlds.append(&mainWorld()); |
| 96 WorldMap& isolatedWorlds = isolatedWorldMap(); | 96 WorldMap& isolatedWorlds = isolatedWorldMap(); |
| 97 for (WorldMap::iterator it = isolatedWorlds.begin(); it != isolatedWorlds.en
d(); ++it) | 97 for (WorldMap::iterator it = isolatedWorlds.begin(); it != isolatedWorlds.en
d(); ++it) |
| 98 worlds.append(it->value); | 98 worlds.append(it->value); |
| 99 } | 99 } |
| 100 | 100 |
| 101 DOMWrapperWorld::~DOMWrapperWorld() | 101 DOMWrapperWorld::~DOMWrapperWorld() |
| 102 { | 102 { |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 ASSERT(world->extensionGroup() == extensionGroup); | 144 ASSERT(world->extensionGroup() == extensionGroup); |
| 145 return world.release(); | 145 return world.release(); |
| 146 } | 146 } |
| 147 | 147 |
| 148 world = DOMWrapperWorld::create(isolate, worldId, extensionGroup); | 148 world = DOMWrapperWorld::create(isolate, worldId, extensionGroup); |
| 149 result.storedValue->value = world.get(); | 149 result.storedValue->value = world.get(); |
| 150 isolatedWorldCount++; | 150 isolatedWorldCount++; |
| 151 return world.release(); | 151 return world.release(); |
| 152 } | 152 } |
| 153 | 153 |
| 154 typedef HashMap<int, RefPtr<SecurityOrigin> > IsolatedWorldSecurityOriginMap; | 154 typedef HashMap<int, RefPtr<SecurityOrigin>> IsolatedWorldSecurityOriginMap; |
| 155 static IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins() | 155 static IsolatedWorldSecurityOriginMap& isolatedWorldSecurityOrigins() |
| 156 { | 156 { |
| 157 ASSERT(isMainThread()); | 157 ASSERT(isMainThread()); |
| 158 DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ()); | 158 DEFINE_STATIC_LOCAL(IsolatedWorldSecurityOriginMap, map, ()); |
| 159 return map; | 159 return map; |
| 160 } | 160 } |
| 161 | 161 |
| 162 SecurityOrigin* DOMWrapperWorld::isolatedWorldSecurityOrigin() | 162 SecurityOrigin* DOMWrapperWorld::isolatedWorldSecurityOrigin() |
| 163 { | 163 { |
| 164 ASSERT(this->isIsolatedWorld()); | 164 ASSERT(this->isIsolatedWorld()); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 m_domObjectHolders.remove(holderBase); | 235 m_domObjectHolders.remove(holderBase); |
| 236 } | 236 } |
| 237 | 237 |
| 238 void DOMWrapperWorld::weakCallbackForDOMObjectHolder(const v8::WeakCallbackData<
v8::Value, DOMObjectHolderBase>& data) | 238 void DOMWrapperWorld::weakCallbackForDOMObjectHolder(const v8::WeakCallbackData<
v8::Value, DOMObjectHolderBase>& data) |
| 239 { | 239 { |
| 240 DOMObjectHolderBase* holderBase = data.GetParameter(); | 240 DOMObjectHolderBase* holderBase = data.GetParameter(); |
| 241 holderBase->world()->unregisterDOMObjectHolder(holderBase); | 241 holderBase->world()->unregisterDOMObjectHolder(holderBase); |
| 242 } | 242 } |
| 243 | 243 |
| 244 } // namespace blink | 244 } // namespace blink |
| OLD | NEW |