Chromium Code Reviews| 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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 58 } | 58 } |
| 59 | 59 |
| 60 DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup) | 60 DOMWrapperWorld::DOMWrapperWorld(int worldId, int extensionGroup) |
| 61 : m_worldId(worldId) | 61 : m_worldId(worldId) |
| 62 , m_extensionGroup(extensionGroup) | 62 , m_extensionGroup(extensionGroup) |
| 63 { | 63 { |
| 64 if (isIsolatedWorld()) | 64 if (isIsolatedWorld()) |
| 65 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); | 65 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); |
| 66 } | 66 } |
| 67 | 67 |
| 68 DOMWrapperWorld* DOMWrapperWorld::current(ScriptExecutionContext* scriptExecutio nContext) | 68 DOMWrapperWorld* DOMWrapperWorld::current() |
| 69 { | 69 { |
| 70 if (scriptExecutionContext->isWorkerContext()) | 70 ASSERT(v8::Context::InContext()); |
| 71 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); | |
| 72 if (!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8DOMWindo w::info)) | |
|
abarth-chromium
2013/04/18 05:41:51
toInnerGlobalObject can be slow, but I don't think
| |
| 71 return 0; | 73 return 0; |
| 72 ASSERT(isMainThread()); | 74 ASSERT(isMainThread()); |
| 73 ASSERT(v8::Context::InContext()); | 75 if (DOMWrapperWorld* world = isolatedWorld(context)) |
| 74 DOMWrapperWorld* world = isolatedWorld(v8::Context::GetCurrent()); | 76 return world; |
| 75 return world ? world : mainThreadNormalWorld(); | 77 return mainThreadNormalWorld(); |
| 76 } | 78 } |
| 77 | 79 |
| 78 DOMWrapperWorld* mainThreadNormalWorld() | 80 DOMWrapperWorld* mainThreadNormalWorld() |
| 79 { | 81 { |
| 80 ASSERT(isMainThread()); | 82 ASSERT(isMainThread()); |
| 81 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperW orld::createMainWorld())); | 83 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperW orld::createMainWorld())); |
| 82 return cachedNormalWorld.get(); | 84 return cachedNormalWorld.get(); |
| 83 } | 85 } |
| 84 | 86 |
| 85 // FIXME: Remove this function. There is currently an issue with the inspector r elated to the call to dispatchDidClearWindowObjectInWorld in ScriptController::w indowShell. | 87 // FIXME: Remove this function. There is currently an issue with the inspector r elated to the call to dispatchDidClearWindowObjectInWorld in ScriptController::w indowShell. |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 } | 256 } |
| 255 | 257 |
| 256 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) | 258 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) |
| 257 { | 259 { |
| 258 DOMActivityLoggerMap& loggers = domActivityLoggers(); | 260 DOMActivityLoggerMap& loggers = domActivityLoggers(); |
| 259 DOMActivityLoggerMap::iterator it = loggers.find(worldId); | 261 DOMActivityLoggerMap::iterator it = loggers.find(worldId); |
| 260 return it == loggers.end() ? 0 : it->value.get(); | 262 return it == loggers.end() ? 0 : it->value.get(); |
| 261 } | 263 } |
| 262 | 264 |
| 263 } // namespace WebCore | 265 } // namespace WebCore |
| OLD | NEW |