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