Diff
Modified: trunk/Source/WebCore/ChangeLog (139609 => 139610)
--- trunk/Source/WebCore/ChangeLog 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/ChangeLog 2013-01-14 13:08:17 UTC (rev 139610)
@@ -1,3 +1,35 @@
+2013-01-14 Kentaro Hara <[email protected]>
+
+ [V8] Add m_isolate to ScriptController, WorkerScriptController and V8DOMWindowShell
+ https://bugs.webkit.org/show_bug.cgi?id=106771
+
+ Reviewed by Adam Barth.
+
+ This is one of the steps to pass an Isolate everywhere.
+
+ No tests. No change in behavior.
+
+ * bindings/v8/ScriptController.cpp:
+ (WebCore::ScriptController::ScriptController):
+ (WebCore::ScriptController::windowShell):
+ * bindings/v8/ScriptController.h:
+ (ScriptController):
+ * bindings/v8/V8DOMWindowShell.cpp:
+ (WebCore::V8DOMWindowShell::create):
+ (WebCore::V8DOMWindowShell::V8DOMWindowShell):
+ (WebCore::V8DOMWindowShell::initializeIfNeeded):
+ (WebCore::V8DOMWindowShell::installDOMWindow):
+ * bindings/v8/V8DOMWindowShell.h:
+ (V8DOMWindowShell):
+ * bindings/v8/V8Initializer.cpp:
+ (WebCore::V8Initializer::initializeMainThreadIfNeeded):
+ (WebCore::V8Initializer::initializeWorker):
+ * bindings/v8/V8Initializer.h:
+ (V8Initializer):
+ * bindings/v8/WorkerScriptController.cpp:
+ (WebCore::WorkerScriptController::WorkerScriptController):
+ (WebCore::WorkerScriptController::initializeContextIfNeeded):
+
2013-01-14 Alexander Pavlov <[email protected]>
Web Inspector: [Styles] Color names parsed inside "background-image" values
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.cpp (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.cpp 2013-01-14 13:08:17 UTC (rev 139610)
@@ -102,7 +102,8 @@
ScriptController::ScriptController(Frame* frame)
: m_frame(frame)
, m_sourceURL(0)
- , m_windowShell(V8DOMWindowShell::create(frame, mainThreadNormalWorld()))
+ , m_isolate(v8::Isolate::GetCurrent())
+ , m_windowShell(V8DOMWindowShell::create(frame, mainThreadNormalWorld(), m_isolate))
, m_paused(false)
#if ENABLE(NETSCAPE_PLUGIN_API)
, m_wrappedWindowScriptNPObject(0)
@@ -357,7 +358,7 @@
if (iter != m_isolatedWorlds.end())
shell = iter->value.get();
else {
- OwnPtr<V8DOMWindowShell> isolatedWorldShell = V8DOMWindowShell::create(m_frame, world);
+ OwnPtr<V8DOMWindowShell> isolatedWorldShell = V8DOMWindowShell::create(m_frame, world, m_isolate);
shell = isolatedWorldShell.get();
m_isolatedWorlds.set(world->worldId(), isolatedWorldShell.release());
}
Modified: trunk/Source/WebCore/bindings/v8/ScriptController.h (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/ScriptController.h 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/ScriptController.h 2013-01-14 13:08:17 UTC (rev 139610)
@@ -199,6 +199,7 @@
Frame* m_frame;
const String* m_sourceURL;
+ v8::Isolate* m_isolate;
OwnPtr<V8DOMWindowShell> m_windowShell;
IsolatedWorldMap m_isolatedWorlds;
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.cpp 2013-01-14 13:08:17 UTC (rev 139610)
@@ -81,14 +81,15 @@
targetContext->SetEmbedderData(0, v8::String::NewSymbol(buffer));
}
-PassOwnPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame, PassRefPtr<DOMWrapperWorld> world)
+PassOwnPtr<V8DOMWindowShell> V8DOMWindowShell::create(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Isolate* isolate)
{
- return adoptPtr(new V8DOMWindowShell(frame, world));
+ return adoptPtr(new V8DOMWindowShell(frame, world, isolate));
}
-V8DOMWindowShell::V8DOMWindowShell(Frame* frame, PassRefPtr<DOMWrapperWorld> world)
+V8DOMWindowShell::V8DOMWindowShell(Frame* frame, PassRefPtr<DOMWrapperWorld> world, v8::Isolate* isolate)
: m_frame(frame)
, m_world(world)
+ , m_isolate(isolate)
{
}
@@ -201,7 +202,7 @@
v8::HandleScope handleScope;
- V8Initializer::initializeMainThreadIfNeeded();
+ V8Initializer::initializeMainThreadIfNeeded(m_isolate);
createContext();
if (m_context.isEmpty())
@@ -334,7 +335,7 @@
v8::Handle<v8::Object> innerGlobalObject = toInnerGlobalObject(m_context.get());
V8DOMWrapper::setNativeInfo(innerGlobalObject, &V8DOMWindow::info, window);
innerGlobalObject->SetPrototype(windowWrapper);
- V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper);
+ V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<DOMWindow>(window), &V8DOMWindow::info, windowWrapper, m_isolate);
return true;
}
Modified: trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/V8DOMWindowShell.h 2013-01-14 13:08:17 UTC (rev 139610)
@@ -53,7 +53,7 @@
// persist between navigations.
class V8DOMWindowShell {
public:
- static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorld>);
+ static PassOwnPtr<V8DOMWindowShell> create(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
v8::Persistent<v8::Context> context() const { return m_context.get(); }
@@ -81,7 +81,7 @@
void destroyIsolatedShell();
private:
- V8DOMWindowShell(Frame*, PassRefPtr<DOMWrapperWorld>);
+ V8DOMWindowShell(Frame*, PassRefPtr<DOMWrapperWorld>, v8::Isolate*);
void disposeContext();
@@ -101,6 +101,7 @@
Frame* m_frame;
RefPtr<DOMWrapperWorld> m_world;
+ v8::Isolate* m_isolate;
OwnPtr<V8PerContextData> m_perContextData;
Modified: trunk/Source/WebCore/bindings/v8/V8Initializer.cpp (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/V8Initializer.cpp 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/V8Initializer.cpp 2013-01-14 13:08:17 UTC (rev 139610)
@@ -40,7 +40,6 @@
#include "V8History.h"
#include "V8Location.h"
#include "V8PerContextData.h"
-#include <v8.h>
#include <wtf/RefPtr.h>
#include <wtf/text/WTFString.h>
@@ -104,7 +103,7 @@
targetWindow->printErrorMessage(targetWindow->crossDomainAccessErrorMessage(activeDOMWindow(BindingState::instance())));
}
-void V8Initializer::initializeMainThreadIfNeeded()
+void V8Initializer::initializeMainThreadIfNeeded(v8::Isolate* isolate)
{
ASSERT(isMainThread());
@@ -122,7 +121,7 @@
#if ENABLE(_javascript__DEBUGGER)
ScriptProfiler::initialize();
#endif
- V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
+ V8PerIsolateData::ensureInitialized(isolate);
// FIXME: Remove the following 2 lines when V8 default has changed.
const char es5ReadonlyFlag[] = "--es5_readonly";
@@ -157,7 +156,7 @@
static const int kWorkerMaxStackSize = 500 * 1024;
-void V8Initializer::initializeWorker()
+void V8Initializer::initializeWorker(v8::Isolate* isolate)
{
v8::V8::AddMessageListener(messageHandlerInWorker);
v8::V8::IgnoreOutOfMemoryException();
@@ -175,7 +174,7 @@
resourceConstraints.set_stack_limit(&here - kWorkerMaxStackSize / sizeof(uint32_t*));
v8::SetResourceConstraints(&resourceConstraints);
- V8PerIsolateData::ensureInitialized(v8::Isolate::GetCurrent());
+ V8PerIsolateData::ensureInitialized(isolate);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/V8Initializer.h (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/V8Initializer.h 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/V8Initializer.h 2013-01-14 13:08:17 UTC (rev 139610)
@@ -26,12 +26,14 @@
#ifndef V8Initializer_h
#define V8Initializer_h
+#include <v8.h>
+
namespace WebCore {
class V8Initializer {
public:
- static void initializeMainThreadIfNeeded();
- static void initializeWorker();
+ static void initializeMainThreadIfNeeded(v8::Isolate*);
+ static void initializeWorker(v8::Isolate*);
};
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp (139609 => 139610)
--- trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp 2013-01-14 13:01:20 UTC (rev 139609)
+++ trunk/Source/WebCore/bindings/v8/WorkerScriptController.cpp 2013-01-14 13:08:17 UTC (rev 139610)
@@ -66,7 +66,7 @@
m_domDataStore = adoptPtr(new DOMDataStore(DOMDataStore::Worker));
data->setDOMDataStore(m_domDataStore.get());
- V8Initializer::initializeWorker();
+ V8Initializer::initializeWorker(m_isolate);
}
WorkerScriptController::~WorkerScriptController()
@@ -127,7 +127,7 @@
return false;
}
- V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<WorkerContext>(m_workerContext), contextType, jsWorkerContext);
+ V8DOMWrapper::associateObjectWithWrapper(PassRefPtr<WorkerContext>(m_workerContext), contextType, jsWorkerContext, m_isolate);
// Insert the object instance as the prototype of the shadow object.
v8::Handle<v8::Object> globalObject = v8::Handle<v8::Object>::Cast(m_context->Global()->GetPrototype());