Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(256)

Unified Diff: Source/bindings/v8/custom/V8InjectedScriptManager.cpp

Issue 24989007: Model each Dart library as its own ScriptState when devtools are enabled. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/bindings/v8/custom/V8InjectedScriptManager.cpp
diff --git a/Source/bindings/v8/custom/V8InjectedScriptManager.cpp b/Source/bindings/v8/custom/V8InjectedScriptManager.cpp
index 199b84cd120eeefbb4dd63614032b5c7dce8a3f0..cc880e48eba6def5ea85cea92be19e8d223002b8 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptManager.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptManager.cpp
@@ -37,6 +37,7 @@
#include "bindings/v8/ScriptDebugServer.h"
#include "bindings/v8/ScriptObject.h"
#include "bindings/v8/V8Binding.h"
+#include "bindings/v8/V8HiddenPropertyName.h"
#include "bindings/v8/V8ObjectConstructor.h"
#include "bindings/v8/V8ScriptRunner.h"
#include "core/inspector/InjectedScriptHost.h"
@@ -82,6 +83,13 @@ ScriptObject InjectedScriptManager::createInjectedScript(const String& scriptSou
if (scriptHostWrapper.IsEmpty())
return ScriptObject();
+ // Store the inspectedScriptState on the scriptHostWrapper if it is
+ // different from the ScriptState associated with the context.
+ // This is needed to support Dart as Dart does not create a separate V8
+ // context for every Dart library.
+ if (inspectedScriptState != ScriptState::forContext(inspectedContext))
+ scriptHostWrapper->SetHiddenValue(V8HiddenPropertyName::scriptState(), v8::External::New(inspectedScriptState));
+
// Inject javascript into the context. The compiled script is supposed to evaluate into
// a single anonymous function(it's anonymous to avoid cluttering the global object with
// inspector's stuff) the function is called a few lines below with InjectedScriptHost wrapper,
@@ -94,6 +102,7 @@ ScriptObject InjectedScriptManager::createInjectedScript(const String& scriptSou
v8::Local<v8::Object> windowGlobal = inspectedContext->Global();
v8::Handle<v8::Value> args[] = { scriptHostWrapper, windowGlobal, v8::Number::New(id) };
v8::Local<v8::Value> injectedScriptValue = V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(value), windowGlobal, WTF_ARRAY_LENGTH(args), args, inspectedContext->GetIsolate());
+
return ScriptObject(inspectedScriptState, v8::Handle<v8::Object>::Cast(injectedScriptValue));
}
« no previous file with comments | « Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp ('k') | Source/core/inspector/InjectedScriptSource.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698