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

Unified Diff: Source/bindings/v8/V8ScriptRunner.cpp

Issue 15294004: Implement V8ScriptRunner::compileAndRunInternalScript() (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 7 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
« no previous file with comments | « Source/bindings/v8/V8ScriptRunner.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/v8/V8ScriptRunner.cpp
diff --git a/Source/bindings/v8/V8ScriptRunner.cpp b/Source/bindings/v8/V8ScriptRunner.cpp
index c4ddf18073efa8e4b7a8f09c38325c19449bc3a1..dde773e7bb184467e4d48aca2765bdd9d2d907c5 100644
--- a/Source/bindings/v8/V8ScriptRunner.cpp
+++ b/Source/bindings/v8/V8ScriptRunner.cpp
@@ -26,6 +26,7 @@
#include "config.h"
#include "bindings/v8/V8ScriptRunner.h"
+#include "bindings/v8/ScopedPersistent.h"
abarth-chromium 2013/05/20 04:23:36 This include probably isn't needed anymore.
#include "bindings/v8/V8Binding.h"
#include "bindings/v8/V8GCController.h"
#include "bindings/v8/V8RecursionScope.h"
@@ -62,4 +63,25 @@ v8::Local<v8::Value> V8ScriptRunner::runCompiledScript(v8::Handle<v8::Script> sc
return result;
}
+v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8::String> source, v8::Isolate* isolate)
+{
+ v8::Local<v8::Context> context = v8::Context::New(isolate);
+ if (context.IsEmpty())
+ return result;
+ v8::Local<v8::Value> result;
abarth-chromium 2013/05/20 04:23:21 I think you'll need to move this line up a bit in
+ {
+ v8::Context::Scope scope(context.get());
+ v8::TryCatch tryCatch;
+ v8::Handle<v8::Script> script = v8::Script::Compile(source);
+ if (script.IsEmpty() || tryCatch.HasCaught())
+ return result;
+
+ V8RecursionScope::MicrotaskSuppression recursionScope;
+ result = script->Run();
+ if (tryCatch.HasCaught())
+ return result;
+ }
+ return result;
+}
+
} // namespace WebCore
« no previous file with comments | « Source/bindings/v8/V8ScriptRunner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698