| 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "DOMWrapperWorld.h" | 32 #include "DOMWrapperWorld.h" |
| 33 | 33 |
| 34 #include "DOMDataStore.h" | 34 #include "DOMDataStore.h" |
| 35 #include "ScriptExecutionContext.h" |
| 35 #include "V8Binding.h" | 36 #include "V8Binding.h" |
| 36 #include "V8DOMActivityLogger.h" | 37 #include "V8DOMActivityLogger.h" |
| 37 #include "V8DOMWindow.h" | 38 #include "V8DOMWindow.h" |
| 38 #include "V8DOMWrapper.h" | 39 #include "V8DOMWrapper.h" |
| 39 #include "WrapperTypeInfo.h" | 40 #include "WrapperTypeInfo.h" |
| 40 #include <wtf/HashTraits.h> | 41 #include <wtf/HashTraits.h> |
| 41 #include <wtf/MainThread.h> | 42 #include <wtf/MainThread.h> |
| 42 #include <wtf/StdLibExtras.h> | 43 #include <wtf/StdLibExtras.h> |
| 43 | 44 |
| 44 namespace WebCore { | 45 namespace WebCore { |
| (...skipping 12 matching lines...) Expand all Loading... |
| 57 } | 58 } |
| 58 | 59 |
| 59 DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup) | 60 DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup) |
| 60 : m_worldId(worldId) | 61 : m_worldId(worldId) |
| 61 , m_extensionGroup(extensionGroup) | 62 , m_extensionGroup(extensionGroup) |
| 62 { | 63 { |
| 63 if (isIsolatedWorld()) | 64 if (isIsolatedWorld()) |
| 64 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); | 65 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); |
| 65 } | 66 } |
| 66 | 67 |
| 68 DOMWrapperWorld* DOMWrapperWorld::current(ScriptExecutionContext* scriptExecutio
nContext) |
| 69 { |
| 70 if (scriptExecutionContext->isWorkerContext()) |
| 71 return 0; |
| 72 ASSERT(isMainThread()); |
| 73 ASSERT(v8::Context::InContext()); |
| 74 DOMWrapperWorld* world = isolatedWorld(v8::Context::GetCurrent()); |
| 75 return world ? world : mainThreadNormalWorld(); |
| 76 } |
| 77 |
| 67 DOMWrapperWorld* mainThreadNormalWorld() | 78 DOMWrapperWorld* mainThreadNormalWorld() |
| 68 { | 79 { |
| 69 ASSERT(isMainThread()); | 80 ASSERT(isMainThread()); |
| 70 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperW
orld::createMainWorld())); | 81 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperW
orld::createMainWorld())); |
| 71 return cachedNormalWorld.get(); | 82 return cachedNormalWorld.get(); |
| 72 } | 83 } |
| 73 | 84 |
| 74 // FIXME: Remove this function. There is currently an issue with the inspector r
elated to the call to dispatchDidClearWindowObjectInWorld in ScriptController::w
indowShell. | 85 // FIXME: Remove this function. There is currently an issue with the inspector r
elated to the call to dispatchDidClearWindowObjectInWorld in ScriptController::w
indowShell. |
| 75 DOMWrapperWorld* existingWindowShellWorkaroundWorld() | 86 DOMWrapperWorld* existingWindowShellWorkaroundWorld() |
| 76 { | 87 { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 } | 254 } |
| 244 | 255 |
| 245 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) | 256 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) |
| 246 { | 257 { |
| 247 DOMActivityLoggerMap& loggers = domActivityLoggers(); | 258 DOMActivityLoggerMap& loggers = domActivityLoggers(); |
| 248 DOMActivityLoggerMap::iterator it = loggers.find(worldId); | 259 DOMActivityLoggerMap::iterator it = loggers.find(worldId); |
| 249 return it == loggers.end() ? 0 : it->value.get(); | 260 return it == loggers.end() ? 0 : it->value.get(); |
| 250 } | 261 } |
| 251 | 262 |
| 252 } // namespace WebCore | 263 } // namespace WebCore |
| OLD | NEW |