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

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

Issue 15975002: Implement V8ScriptRunner::callFunction() 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 83202428070a1a2ad3f00745b9c45f0f3af14e98..b7651714cc39972b45acdf249d17100cf62046de 100644
--- a/Source/bindings/v8/V8ScriptRunner.cpp
+++ b/Source/bindings/v8/V8ScriptRunner.cpp
@@ -110,15 +110,29 @@ v8::Local<v8::Value> V8ScriptRunner::compileAndRunInternalScript(v8::Handle<v8::
context = v8::Context::New(isolate);
if (context.IsEmpty())
return result;
- {
- v8::Context::Scope scope(context);
- v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, fileName, scriptStartPosition, scriptData, isolate);
- if (script.IsEmpty())
- return result;
- V8RecursionScope::MicrotaskSuppression recursionScope;
- result = script->Run();
- }
+ v8::Context::Scope scope(context);
+ v8::Handle<v8::Script> script = V8ScriptRunner::compileScript(source, fileName, scriptStartPosition, scriptData, isolate);
+ if (script.IsEmpty())
+ return result;
+
+ V8RecursionScope::MicrotaskSuppression recursionScope;
+ result = script->Run();
+ return result;
+}
+
+v8::Local<v8::Value> V8ScriptRunner::callFunction(v8::Handle<v8::Function> function, ScriptExecutionContext* context, v8::Handle<v8::Object> receiver, int argc, v8::Handle<v8::Value> args[])
+{
+ TRACE_EVENT0("v8", "v8.callFunction");
+ V8GCController::checkMemoryUsage();
+
+ if (V8RecursionScope::recursionLevel() >= kMaxRecursionDepth)
+ return handleMaxRecursionDepthExceeded();
+
+ V8RecursionScope recursionScope(context);
+ v8::Local<v8::Value> result = function->Call(receiver, argc, args);
+
+ crashIfV8IsDead();
return result;
}
« 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