Chromium Code Reviews| 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()) { |