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

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 002f1dad07c08ff153d565ea7828919c51b3f509..0d99cc9d0ef4b5aafa6e4178006f18caed4f58cc 100644
--- a/Source/bindings/v8/V8ScriptRunner.cpp
+++ b/Source/bindings/v8/V8ScriptRunner.cpp
@@ -110,15 +110,46 @@ 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;
+}
+
+static String functionInfo(const v8::Handle<v8::Function> function)
+{
+ String resourceName = "undefined";
+ int lineNumber = 1;
+ v8::ScriptOrigin origin = function->GetScriptOrigin();
+ if (!origin.ResourceName().IsEmpty()) {
+ resourceName = toWebCoreString(origin.ResourceName());
+ lineNumber = function->GetScriptLineNumber() + 1;
}
+
+ StringBuilder builder;
+ builder.append(resourceName);
+ builder.append(':');
+ builder.appendNumber(lineNumber);
+ return builder.toString();
+}
+
+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");
haraken 2013/05/24 04:22:32 Previously this was: TRACE_EVENT1("v8", "v8.cal
+ 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