| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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::current(v8::Isolate* isolate) | 63 DOMWrapperWorld* DOMWrapperWorld::current(v8::Isolate* isolate) |
| 64 { | 64 { |
| 65 ASSERT(isolate->InContext()); |
| 65 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); | 66 v8::Handle<v8::Context> context = isolate->GetCurrentContext(); |
| 66 if (context.IsEmpty() || !toDOMWindow(context)) | 67 if (!toDOMWindow(context)) |
| 67 return 0; | 68 return 0; |
| 68 return world(context); | 69 ASSERT(isMainThread()); |
| 70 if (DOMWrapperWorld* world = isolatedWorld(context)) |
| 71 return world; |
| 72 return mainWorld(); |
| 69 } | 73 } |
| 70 | 74 |
| 71 DOMWrapperWorld* DOMWrapperWorld::mainWorld() | 75 DOMWrapperWorld* DOMWrapperWorld::mainWorld() |
| 72 { | 76 { |
| 73 ASSERT(isMainThread()); | 77 ASSERT(isMainThread()); |
| 74 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create
(MainWorldId, mainWorldExtensionGroup))); | 78 DEFINE_STATIC_REF(DOMWrapperWorld, cachedMainWorld, (DOMWrapperWorld::create
(MainWorldId, mainWorldExtensionGroup))); |
| 75 return cachedMainWorld; | 79 return cachedMainWorld; |
| 76 } | 80 } |
| 77 | 81 |
| 78 typedef HashMap<int, DOMWrapperWorld*> WorldMap; | 82 typedef HashMap<int, DOMWrapperWorld*> WorldMap; |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 DOMActivityLoggerMap::iterator it = loggers.find(worldId); | 225 DOMActivityLoggerMap::iterator it = loggers.find(worldId); |
| 222 return it == loggers.end() ? 0 : it->value.get(); | 226 return it == loggers.end() ? 0 : it->value.get(); |
| 223 } | 227 } |
| 224 | 228 |
| 225 bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context
) | 229 bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context
) |
| 226 { | 230 { |
| 227 return V8WindowShell::contextHasCorrectPrototype(context); | 231 return V8WindowShell::contextHasCorrectPrototype(context); |
| 228 } | 232 } |
| 229 | 233 |
| 230 } // namespace WebCore | 234 } // namespace WebCore |
| OLD | NEW |