| 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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 , m_extensionGroup(extensionGroup) | 64 , m_extensionGroup(extensionGroup) |
| 65 { | 65 { |
| 66 if (isIsolatedWorld()) | 66 if (isIsolatedWorld()) |
| 67 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); | 67 m_domDataStore = adoptPtr(new DOMDataStore(IsolatedWorld)); |
| 68 } | 68 } |
| 69 | 69 |
| 70 DOMWrapperWorld* DOMWrapperWorld::current() | 70 DOMWrapperWorld* DOMWrapperWorld::current() |
| 71 { | 71 { |
| 72 ASSERT(v8::Context::InContext()); | 72 ASSERT(v8::Context::InContext()); |
| 73 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); | 73 v8::Handle<v8::Context> context = v8::Context::GetCurrent(); |
| 74 if (!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8Window::
info)) | 74 if (!V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8Window::
wrapperTypeInfo)) |
| 75 return 0; | 75 return 0; |
| 76 ASSERT(isMainThread()); | 76 ASSERT(isMainThread()); |
| 77 if (DOMWrapperWorld* world = isolatedWorld(context)) | 77 if (DOMWrapperWorld* world = isolatedWorld(context)) |
| 78 return world; | 78 return world; |
| 79 return mainThreadNormalWorld(); | 79 return mainThreadNormalWorld(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 DOMWrapperWorld* mainThreadNormalWorld() | 82 DOMWrapperWorld* mainThreadNormalWorld() |
| 83 { | 83 { |
| 84 ASSERT(isMainThread()); | 84 ASSERT(isMainThread()); |
| 85 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperW
orld::createMainWorld())); | 85 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperW
orld::createMainWorld())); |
| 86 return cachedNormalWorld.get(); | 86 return cachedNormalWorld.get(); |
| 87 } | 87 } |
| 88 | 88 |
| 89 // FIXME: Remove this function. There is currently an issue with the inspector r
elated to the call to dispatchDidClearWindowObjectInWorld in ScriptController::w
indowShell. | 89 // FIXME: Remove this function. There is currently an issue with the inspector r
elated to the call to dispatchDidClearWindowObjectInWorld in ScriptController::w
indowShell. |
| 90 DOMWrapperWorld* existingWindowShellWorkaroundWorld() | 90 DOMWrapperWorld* existingWindowShellWorkaroundWorld() |
| 91 { | 91 { |
| 92 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, world, (adoptRef(new DOMWrapper
World(MainWorldId - 1, DOMWrapperWorld::mainWorldExtensionGroup - 1)))); | 92 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, world, (adoptRef(new DOMWrapper
World(MainWorldId - 1, DOMWrapperWorld::mainWorldExtensionGroup - 1)))); |
| 93 return world.get(); | 93 return world.get(); |
| 94 } | 94 } |
| 95 | 95 |
| 96 bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context
) | 96 bool DOMWrapperWorld::contextHasCorrectPrototype(v8::Handle<v8::Context> context
) |
| 97 { | 97 { |
| 98 ASSERT(isMainThread()); | 98 ASSERT(isMainThread()); |
| 99 if (initializingWindow) | 99 if (initializingWindow) |
| 100 return true; | 100 return true; |
| 101 return V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8Window
::info); | 101 return V8DOMWrapper::isWrapperOfType(toInnerGlobalObject(context), &V8Window
::wrapperTypeInfo); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void DOMWrapperWorld::setIsolatedWorldField(v8::Handle<v8::Context> context) | 104 void DOMWrapperWorld::setIsolatedWorldField(v8::Handle<v8::Context> context) |
| 105 { | 105 { |
| 106 context->SetAlignedPointerInEmbedderData(v8ContextIsolatedWorld, isMainWorld
() ? 0 : this); | 106 context->SetAlignedPointerInEmbedderData(v8ContextIsolatedWorld, isMainWorld
() ? 0 : this); |
| 107 } | 107 } |
| 108 | 108 |
| 109 typedef HashMap<int, DOMWrapperWorld*> WorldMap; | 109 typedef HashMap<int, DOMWrapperWorld*> WorldMap; |
| 110 static WorldMap& isolatedWorldMap() | 110 static WorldMap& isolatedWorldMap() |
| 111 { | 111 { |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 } | 244 } |
| 245 | 245 |
| 246 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) | 246 V8DOMActivityLogger* DOMWrapperWorld::activityLogger(int worldId) |
| 247 { | 247 { |
| 248 DOMActivityLoggerMap& loggers = domActivityLoggers(); | 248 DOMActivityLoggerMap& loggers = domActivityLoggers(); |
| 249 DOMActivityLoggerMap::iterator it = loggers.find(worldId); | 249 DOMActivityLoggerMap::iterator it = loggers.find(worldId); |
| 250 return it == loggers.end() ? 0 : it->value.get(); | 250 return it == loggers.end() ? 0 : it->value.get(); |
| 251 } | 251 } |
| 252 | 252 |
| 253 } // namespace WebCore | 253 } // namespace WebCore |
| OLD | NEW |