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

Unified Diff: Source/bindings/dart/DartUtilities.cpp

Issue 300393002: Merge DevTools Refactor CL to Blink36 (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/1985
Patch Set: PTAL Created 6 years, 6 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/dart/DartUtilities.h ('k') | Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/dart/DartUtilities.cpp
diff --git a/Source/bindings/dart/DartUtilities.cpp b/Source/bindings/dart/DartUtilities.cpp
index 8a3d43ba6daea83bd820a7ddc635a43fe8d1ff37..bc6a943294205a25e1f749e6e40f5a8b3662b0d7 100644
--- a/Source/bindings/dart/DartUtilities.cpp
+++ b/Source/bindings/dart/DartUtilities.cpp
@@ -942,6 +942,11 @@ DOMWindow* DartUtilities::domWindowForCurrentIsolate()
return document->domWindow();
}
+V8ScriptState* DartUtilities::v8ScriptStateForCurrentIsolate()
+{
+ return V8ScriptState::forMainWorld(domWindowForCurrentIsolate()->frame());
+}
+
ExecutionContext* DartUtilities::scriptExecutionContext()
{
if (Dart_CurrentIsolate())
@@ -1033,6 +1038,47 @@ static PassRefPtr<ScriptCallStack> createScriptCallStackFromStackTrace(Dart_Stac
return ScriptCallStack::create(scriptCallStackFrames);
}
+ScriptCallFrame DartUtilities::getTopFrame(Dart_StackTrace stackTrace, Dart_Handle& exception)
+{
+ {
+ uintptr_t frameCount = 0;
+ Dart_Handle result = Dart_StackTraceLength(stackTrace, reinterpret_cast<intptr_t*>(&frameCount));
+ if (Dart_IsError(result)) {
+ exception = result;
+ goto fail;
+ }
+ if (!frameCount) {
+ exception = Dart_NewStringFromCString("Empty stack trace");
+ goto fail;
+ }
+ Dart_ActivationFrame frame = 0;
+ result = Dart_GetActivationFrame(stackTrace, 0, &frame);
+ if (Dart_IsError(result)) {
+ exception = result;
+ goto fail;
+ }
+ ASSERT(frame);
+ return toScriptCallFrame(frame, exception);
+ }
+fail:
+ return ScriptCallFrame("undefined", "undefined", "undefined", 0, 0);
+}
+
+ScriptCallFrame DartUtilities::toScriptCallFrame(Dart_ActivationFrame frame, Dart_Handle& exception)
+{
+ ASSERT(frame);
+ Dart_Handle functionName;
+ Dart_Handle scriptUrl;
+ intptr_t lineNumber = 0;
+ intptr_t columnNumber = 0;
+ Dart_Handle result = Dart_ActivationFrameInfo(frame, &functionName, &scriptUrl, &lineNumber, &columnNumber);
+ if (Dart_IsError(result)) {
+ exception = result;
+ return ScriptCallFrame("undefined", "undefined", "undefined", 0, 0);
+ }
+ return ScriptCallFrame(DartUtilities::toString(functionName), "undefined", DartUtilities::toString(scriptUrl), lineNumber, columnNumber);
+}
+
PassRefPtr<ScriptCallStack> DartUtilities::createScriptCallStack()
{
Dart_StackTrace trace = 0;
« no previous file with comments | « Source/bindings/dart/DartUtilities.h ('k') | Source/bindings/dart/custom/DartInjectedScriptHostCustom.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698