Changeset 125884 in webkit
- Timestamp:
- Aug 17, 2012 5:22:37 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r125883 r125884 1 2012-08-17 Dan Carney <dcarney@google.com> 2 3 Refactor away IsolatedWorld 4 https://bugs.webkit.org/show_bug.cgi?id=93971 5 6 Reviewed by Kentaro Hara. 7 8 Remove IsolatedWorld class as it was 1:1 with DOMWrapperWorld. 9 This update fixes a bad assertion which caused the previous 10 version to be rolled back. 11 12 No tests. No change in functionality. 13 14 * UseV8.cmake: 15 * WebCore.gypi: 16 * bindings/v8/DOMWrapperWorld.cpp: 17 (WebCore): 18 (WebCore::mainThreadNormalWorld): 19 * bindings/v8/DOMWrapperWorld.h: 20 (WebCore): 21 (DOMWrapperWorld): 22 (WebCore::DOMWrapperWorld::create): 23 (WebCore::DOMWrapperWorld::~DOMWrapperWorld): 24 (WebCore::DOMWrapperWorld::count): 25 (WebCore::DOMWrapperWorld::worldId): 26 (WebCore::DOMWrapperWorld::domDataStore): 27 (WebCore::DOMWrapperWorld::DOMWrapperWorld): 28 * bindings/v8/IsolatedWorld.cpp: Removed. 29 * bindings/v8/IsolatedWorld.h: Removed. 30 * bindings/v8/V8DOMWrapper.h: 31 (WebCore::V8DOMWrapper::getCachedWrapper): 32 * bindings/v8/V8IsolatedContext.cpp: 33 (WebCore::V8IsolatedContext::V8IsolatedContext): 34 (WebCore::V8IsolatedContext::destroy): 35 * bindings/v8/V8IsolatedContext.h: 36 (WebCore::V8IsolatedContext::getEntered): 37 (WebCore::V8IsolatedContext::world): 38 (V8IsolatedContext): 39 * bindings/v8/V8PerIsolateData.h: 40 (WebCore::V8PerIsolateData::registerDOMDataStore): 41 (WebCore::V8PerIsolateData::unregisterDOMDataStore): 42 1 43 2012-08-17 Kangil Han <kangil.han@samsung.com> 2 44 -
trunk/Source/WebCore/UseV8.cmake
r125865 r125884 26 26 bindings/v8/IDBBindingUtilities.cpp 27 27 bindings/v8/IDBCustomBindings.cpp 28 bindings/v8/IsolatedWorld.cpp29 28 bindings/v8/Dictionary.cpp 30 29 bindings/v8/PageScriptDebugServer.cpp -
trunk/Source/WebCore/WebCore.gypi
r125866 r125884 2183 2183 'bindings/v8/IDBCustomBindings.cpp', 2184 2184 'bindings/v8/IntrusiveDOMWrapperMap.h', 2185 'bindings/v8/IsolatedWorld.cpp',2186 'bindings/v8/IsolatedWorld.h',2187 2185 'bindings/v8/JavaScriptCallFrame.cpp', 2188 2186 'bindings/v8/JavaScriptCallFrame.h', -
trunk/Source/WebCore/bindings/v8/DOMWrapperWorld.cpp
r125831 r125884 37 37 namespace WebCore { 38 38 39 DOMWrapperWorld::DOMWrapperWorld() 40 { 41 // This class is pretty boring, huh? 42 } 39 int DOMWrapperWorld::isolatedWorldCount = 0; 43 40 44 41 DOMWrapperWorld* mainThreadNormalWorld() 45 42 { 46 43 ASSERT(isMainThread()); 47 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperWorld::create( )));44 DEFINE_STATIC_LOCAL(RefPtr<DOMWrapperWorld>, cachedNormalWorld, (DOMWrapperWorld::create(DOMWrapperWorld::mainWorldId))); 48 45 return cachedNormalWorld.get(); 49 46 } -
trunk/Source/WebCore/bindings/v8/DOMWrapperWorld.h
r125831 r125884 32 32 #define DOMWrapperWorld_h 33 33 34 #include "DOMDataStore.h" 34 35 #include <wtf/PassRefPtr.h> 35 36 #include <wtf/RefCounted.h> … … 39 40 40 41 // This class represent a collection of DOM wrappers for a specific world. 41 // The base class is pretty boring because the wrappers are actually stored42 // statically in V8DOMMap and garbage collected by V8 itself.43 42 class DOMWrapperWorld : public RefCounted<DOMWrapperWorld> { 44 43 public: 45 static PassRefPtr<DOMWrapperWorld> create() { return adoptRef(new DOMWrapperWorld()); } 46 virtual ~DOMWrapperWorld() {} 44 static const int mainWorldId = -1; 45 static PassRefPtr<DOMWrapperWorld> create(int worldId = mainWorldId) { return adoptRef(new DOMWrapperWorld(worldId)); } 46 ~DOMWrapperWorld() 47 { 48 if (m_worldId != mainWorldId) 49 isolatedWorldCount--; 50 } 51 static int count() { return isolatedWorldCount; } 47 52 48 protected: 49 DOMWrapperWorld(); 53 int worldId() const { return m_worldId; } 54 DOMDataStore* domDataStore() const { return m_domDataStore.getStore(); } 55 56 private: 57 DOMWrapperWorld(int worldId) 58 : m_worldId(worldId) 59 { 60 if (m_worldId != mainWorldId) 61 isolatedWorldCount++; 62 } 63 64 // The backing store for the isolated world's DOM wrappers. This class 65 // doesn't have visibility into the wrappers. This handle simply helps 66 // manage their lifetime. 67 DOMDataStoreHandle m_domDataStore; 68 69 const int m_worldId; 70 static int isolatedWorldCount; 50 71 }; 51 72 -
trunk/Source/WebCore/bindings/v8/V8DOMWrapper.h
r125831 r125884 34 34 #include "DOMDataStore.h" 35 35 #include "Event.h" 36 #include "IsolatedWorld.h"37 36 #include "Node.h" 38 37 #include "NodeFilter.h" … … 131 130 { 132 131 ASSERT(isMainThread()); 133 if (LIKELY(! IsolatedWorld::count())) {132 if (LIKELY(!DOMWrapperWorld::count())) { 134 133 v8::Persistent<v8::Object>* wrapper = node->wrapper(); 135 134 if (LIKELY(!!wrapper)) -
trunk/Source/WebCore/bindings/v8/V8IsolatedContext.cpp
r125831 r125884 67 67 68 68 V8IsolatedContext::V8IsolatedContext(V8Proxy* proxy, int extensionGroup, int worldId) 69 : m_world( IsolatedWorld::create(worldId)),69 : m_world(DOMWrapperWorld::create(worldId)), 70 70 m_frame(proxy->frame()) 71 71 { … … 76 76 77 77 // FIXME: We should be creating a new V8DOMWindowShell here instead of riping out the context. 78 m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup, m_world-> id()));78 m_context = SharedPersistent<v8::Context>::create(proxy->windowShell()->createNewContext(v8::Handle<v8::Object>(), extensionGroup, m_world->worldId())); 79 79 if (m_context->get().IsEmpty()) 80 80 return; … … 102 102 m_context->get()->UseDefaultSecurityToken(); 103 103 104 m_frame->loader()->client()->didCreateScriptContext(context(), extensionGroup, m_world-> id());104 m_frame->loader()->client()->didCreateScriptContext(context(), extensionGroup, m_world->worldId()); 105 105 } 106 106 … … 108 108 { 109 109 m_perContextData.clear(); 110 m_frame->loader()->client()->willReleaseScriptContext(context(), m_world-> id());110 m_frame->loader()->client()->willReleaseScriptContext(context(), m_world->worldId()); 111 111 m_context->get().MakeWeak(this, &contextWeakReferenceCallback); 112 112 m_frame = 0; -
trunk/Source/WebCore/bindings/v8/V8IsolatedContext.h
r125831 r125884 32 32 #define V8IsolatedContext_h 33 33 34 #include " IsolatedWorld.h"34 #include "DOMWrapperWorld.h" 35 35 #include "ScriptSourceCode.h" // for WebCore::ScriptSourceCode 36 36 #include "SharedPersistent.h" … … 83 83 // Until then, we optimize the common case of not having any isolated 84 84 // worlds at all. 85 if (! IsolatedWorld::count())85 if (!DOMWrapperWorld::count()) 86 86 return 0; 87 87 if (!v8::Context::InContext()) … … 93 93 PassRefPtr<SharedPersistent<v8::Context> > sharedContext() { return m_context; } 94 94 95 IsolatedWorld* world() const { return m_world.get(); }95 DOMWrapperWorld* world() const { return m_world.get(); } 96 96 97 97 SecurityOrigin* securityOrigin() const { return m_securityOrigin.get(); } … … 116 116 RefPtr<SharedPersistent<v8::Context> > m_context; 117 117 118 RefPtr< IsolatedWorld> m_world;118 RefPtr<DOMWrapperWorld> m_world; 119 119 120 120 RefPtr<SecurityOrigin> m_securityOrigin; -
trunk/Source/WebCore/bindings/v8/V8PerIsolateData.h
r125216 r125884 91 91 void registerDOMDataStore(DOMDataStore* domDataStore) 92 92 { 93 ASSERT(m_domDataList.find(domDataStore) == notFound); 93 94 m_domDataList.append(domDataStore); 94 95 } … … 96 97 void unregisterDOMDataStore(DOMDataStore* domDataStore) 97 98 { 98 ASSERT(m_domDataList.find(domDataStore) );99 ASSERT(m_domDataList.find(domDataStore) != notFound); 99 100 m_domDataList.remove(m_domDataList.find(domDataStore)); 100 101 }
Note: See TracChangeset
for help on using the changeset viewer.