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

Unified Diff: Source/bindings/v8/custom/V8InjectedScriptHostCustom.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: Ready for review Created 7 years, 3 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/V8InjectedScriptHostCustom.cpp
diff --git a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
index 933985e8e317ab47e7c87590f2e61d7adcc7b083..d00b62eaef3b188560774602c91ce0b65f1b0ac5 100644
--- a/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
+++ b/Source/bindings/v8/custom/V8InjectedScriptHostCustom.cpp
@@ -37,13 +37,17 @@
#include "V8Node.h"
#include "V8NodeList.h"
#include "V8Storage.h"
+#include "bindings/dart/DartController.h"
#include "bindings/dart/DartHandleProxy.h"
+#include "bindings/dart/DartScriptState.h"
+#include "bindings/dart/V8Converter.h"
#include "bindings/v8/BindingSecurity.h"
#include "bindings/v8/ScriptDebugServer.h"
#include "bindings/v8/ScriptValue.h"
#include "bindings/v8/V8AbstractEventListener.h"
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8HiddenPropertyName.h"
+#include "bindings/v8/V8RecursionScope.h"
#include "bindings/v8/V8ScriptRunner.h"
#include "bindings/v8/custom/V8Float32ArrayCustom.h"
#include "bindings/v8/custom/V8Float64ArrayCustom.h"
@@ -355,6 +359,28 @@ void V8InjectedScriptHost::evaluateMethodCustom(const v8::FunctionCallbackInfo<v
}
ASSERT(!v8::Context::GetCurrent().IsEmpty());
+
vsm 2013/09/30 22:08:03 Can this code be refactored to be a call back into
Jacob 2013/10/01 00:07:05 Moved it to a new file called DartInjectedScriptHo
+ ScriptState* currentScriptState = 0;
+ v8::Local<v8::Value> scriptStateWrapper = args.Holder()->GetHiddenValue(V8HiddenPropertyName::scriptState());
+ if (!scriptStateWrapper.IsEmpty() && scriptStateWrapper->IsExternal())
+ currentScriptState = static_cast<ScriptState*>(v8::External::Cast(*scriptStateWrapper)->Value());
+ else
+ currentScriptState = ScriptState::current();
+
+ ScriptExecutionContext* scriptExecutionContext = currentScriptState->scriptExecutionContext();
+ ASSERT(scriptExecutionContext);
+
+ if (!currentScriptState->isJavaScript()) {
+ DartScriptState* dartScriptState = static_cast<DartScriptState*>(currentScriptState);
+ DartIsolateScope scope(dartScriptState->isolate());
+ DartApiScope apiScope;
+
+ Dart_Handle target = Dart_GetLibraryFromId(dartScriptState->libraryId());
+ v8SetReturnValue(args, DartHandleProxy::evaluate(target, V8Converter::stringToDart(expression), Dart_Null()));
+ return;
+ }
+
+ ASSERT(!v8::Context::GetCurrent().IsEmpty());
v8::TryCatch tryCatch;
v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScript(expression, args.GetIsolate());
if (tryCatch.HasCaught()) {

Powered by Google App Engine
This is Rietveld 408576698