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

Side by Side Diff: Source/bindings/core/dart/DartScriptDebugServer.cpp

Issue 575883003: Fix more inspector compile errors from merge as well as a ScriptState compile error. (Closed) Base URL: svn://svn.chromium.org/blink/branches/dart/dartium
Patch Set: Created 6 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2014 Google Inc. All rights reserved. 2 * Copyright (C) 2014 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 lastColumnNumber = DartUtilities::toInteger(Dart_ListGetAt(info, infoLength - 1), exception); 301 lastColumnNumber = DartUtilities::toInteger(Dart_ListGetAt(info, infoLength - 1), exception);
302 ASSERT(!exception); 302 ASSERT(!exception);
303 303
304 script.startLine = 0; 304 script.startLine = 0;
305 script.startColumn = 0; 305 script.startColumn = 0;
306 script.endLine = lastLineNumber + 1; 306 script.endLine = lastLineNumber + 1;
307 script.endColumn = !lastLineNumber ? lastColumnNumber : 0; 307 script.endColumn = !lastLineNumber ? lastColumnNumber : 0;
308 script.isContentScript = false; 308 script.isContentScript = false;
309 script.language = String("Dart"); 309 script.language = String("Dart");
310 script.libraryId = libraryId; 310 script.libraryId = libraryId;
311 m_listener->didParseSource(sourceID, script); 311 m_listener->didParseSource(sourceID, script, CompileResult::CompileSuccess);
312 } 312 }
313 313
314 String DartPageDebug::getScriptId(const String& url) 314 String DartPageDebug::getScriptId(const String& url)
315 { 315 {
316 HashMap<String, String>::iterator it = m_scriptUrlToIdMap.find(url); 316 HashMap<String, String>::iterator it = m_scriptUrlToIdMap.find(url);
317 if (it == m_scriptUrlToIdMap.end()) { 317 if (it == m_scriptUrlToIdMap.end()) {
318 String id = String::format("{\"dartScript\":%d,\"page\":%d}", m_nextScri ptId, m_pageId); 318 String id = String::format("{\"dartScript\":%d,\"page\":%d}", m_nextScri ptId, m_pageId);
319 m_nextScriptId++; 319 m_nextScriptId++;
320 m_scriptUrlToIdMap.set(url, id); 320 m_scriptUrlToIdMap.set(url, id);
321 m_idToScriptUrlMap.set(id, url); 321 m_idToScriptUrlMap.set(id, url);
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 int DartScriptDebugServer::frameCount() 682 int DartScriptDebugServer::frameCount()
683 { 683 {
684 ASSERT(isPaused()); 684 ASSERT(isPaused());
685 intptr_t length = 0; 685 intptr_t length = 0;
686 Dart_StackTraceLength(m_executionState, &length); 686 Dart_StackTraceLength(m_executionState, &length);
687 return length; 687 return length;
688 } 688 }
689 689
690 StackTrace DartScriptDebugServer::currentCallFrames() 690 StackTrace DartScriptDebugServer::currentCallFrames()
691 { 691 {
692 return StackTrace(m_executionState); 692 return StackTrace(m_executionState, DartUtilities::currentScriptState());
693 } 693 }
694 694
695 StackTrace DartScriptDebugServer::currentCallFramesForAsyncStack() 695 StackTrace DartScriptDebugServer::currentCallFramesForAsyncStack()
696 { 696 {
697 // FIXMEDART: implement propertly. These are the regular not Async call fram es. 697 // FIXMEDART: implement propertly. These are the regular not Async call fram es.
698 return StackTrace(m_executionState); 698 return StackTrace(m_executionState, DartUtilities::currentScriptState());
699 }
700
701 ScriptCallFrame DartScriptDebugServer::callFrameNoScopes(int index)
702 {
703 if (!isPaused())
704 return ScriptCallFrame();
705 DartIsolateScope scope(m_pausedIsolate);
706 DartApiScope apiScope;
707 return getScriptCallFrameHelper(index);
699 } 708 }
700 709
701 bool DartScriptDebugServer::isPaused() 710 bool DartScriptDebugServer::isPaused()
702 { 711 {
703 return !!m_executionState; 712 return !!m_executionState;
704 } 713 }
705 714
706 void DartScriptDebugServer::clearCompiledScripts() 715 void DartScriptDebugServer::clearCompiledScripts()
707 { 716 {
708 // FIXMEDART: is this meaningful for Dart? 717 // FIXMEDART: is this meaningful for Dart?
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
1068 ASSERT(!Dart_IsError(result)); 1077 ASSERT(!Dart_IsError(result));
1069 result = Dart_ActivationFrameGetLocation(frame, 0, 0, &location); 1078 result = Dart_ActivationFrameGetLocation(frame, 0, 0, &location);
1070 ASSERT(!Dart_IsError(result)); 1079 ASSERT(!Dart_IsError(result));
1071 handleProgramBreak(isolate, trace, ILLEGAL_BREAKPOINT_ID, exception, locatio n); 1080 handleProgramBreak(isolate, trace, ILLEGAL_BREAKPOINT_ID, exception, locatio n);
1072 } 1081 }
1073 1082
1074 void DartScriptDebugServer::runScript(ScriptState* scriptState, const String& sc riptId, ScriptValue* result, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace) 1083 void DartScriptDebugServer::runScript(ScriptState* scriptState, const String& sc riptId, ScriptValue* result, bool* wasThrown, String* exceptionDetailsText, int* lineNumber, int* columnNumber, RefPtrWillBeRawPtr<ScriptCallStack>* stackTrace)
1075 { 1084 {
1076 } 1085 }
1077 1086
1078 1087 ScriptCallFrame DartScriptDebugServer::getScriptCallFrameHelper(int frameIndex)
1079 ScriptCallFrame DartScriptDebugServer::topCallFrameNoScopes()
1080 { 1088 {
1081 if (!isPaused())
1082 return ScriptCallFrame();
1083 DartIsolateScope scope(m_pausedIsolate);
1084 DartApiScope apiScope;
1085
1086 // FIXME: move this to a shared helper method.
1087 Dart_ActivationFrame frame = 0; 1089 Dart_ActivationFrame frame = 0;
1088 Dart_Handle result = Dart_GetActivationFrame(0, 0, &frame); 1090 Dart_Handle result = Dart_GetActivationFrame(0, frameIndex, &frame);
1089 ASSERT(!Dart_IsError(result)); 1091 ASSERT(!Dart_IsError(result));
1090 if (Dart_IsError(result)) return ScriptCallFrame(); 1092 if (Dart_IsError(result)) return ScriptCallFrame();
1091 Dart_Handle functionName = 0; 1093 Dart_Handle functionName = 0;
1092 Dart_Handle function = 0; 1094 Dart_Handle function = 0;
1093 Dart_CodeLocation location; 1095 Dart_CodeLocation location;
1094 Dart_ActivationFrameGetLocation(frame, &functionName, &function, &location); 1096 Dart_ActivationFrameGetLocation(frame, &functionName, &function, &location);
1095 const String& url = DartUtilities::toString(location.script_url); 1097 const String& url = DartUtilities::toString(location.script_url);
1096 intptr_t line = 0; 1098 intptr_t line = 0;
1097 intptr_t column = 0; 1099 intptr_t column = 0;
1098 Dart_ActivationFrameInfo(frame, 0, 0, &line, &column); 1100 Dart_ActivationFrameInfo(frame, 0, 0, &line, &column);
1099 1101
1100 Dart_Handle exception = 0; 1102 Dart_Handle exception = 0;
1101 String functionString = DartUtilities::dartToString(functionName, exception) ; 1103 String functionString = DartUtilities::dartToString(functionName, exception) ;
1102 ASSERT(!exception); 1104 ASSERT(!exception);
1103 if (exception) 1105 if (exception)
1104 functionString = "Unknown function"; 1106 functionString = "Unknown function";
1105 return ScriptCallFrame(functionString, getScriptId(url, Dart_CurrentIsolate( )), url, line - 1, column - 1, false); 1107 return ScriptCallFrame(functionString, getScriptId(url, Dart_CurrentIsolate( )), url, line - 1, column - 1, false);
1106 } 1108 }
1107 1109
1110 ScriptCallFrame DartScriptDebugServer::topCallFrameNoScopes()
1111 {
1112 if (!isPaused())
1113 return ScriptCallFrame();
1114 DartIsolateScope scope(m_pausedIsolate);
1115 DartApiScope apiScope;
1116 return getScriptCallFrameHelper(0);
1117 }
1118
1108 UnifiedScriptDebugServer::UnifiedScriptDebugServer(DartScriptDebugServer* dartSc riptDebugServer, PageScriptDebugServer* scriptDebugServer) 1119 UnifiedScriptDebugServer::UnifiedScriptDebugServer(DartScriptDebugServer* dartSc riptDebugServer, PageScriptDebugServer* scriptDebugServer)
1109 { 1120 {
1110 m_v8 = scriptDebugServer; 1121 m_v8 = scriptDebugServer;
1111 m_dart = dartScriptDebugServer; 1122 m_dart = dartScriptDebugServer;
1112 m_v8->setPeer(m_dart); 1123 m_v8->setPeer(m_dart);
1113 m_dart->setPeer(m_v8); 1124 m_dart->setPeer(m_v8);
1114 } 1125 }
1115 1126
1116 UnifiedScriptDebugServer& UnifiedScriptDebugServer::shared() 1127 UnifiedScriptDebugServer& UnifiedScriptDebugServer::shared()
1117 { 1128 {
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 1262
1252 StackTrace UnifiedScriptDebugServer::currentCallFramesForAsyncStack() 1263 StackTrace UnifiedScriptDebugServer::currentCallFramesForAsyncStack()
1253 { 1264 {
1254 // FIXMEDART: we need to figure out how to interleave stack traces where pos sible. 1265 // FIXMEDART: we need to figure out how to interleave stack traces where pos sible.
1255 StackTrace v8StackTrace = m_v8->currentCallFramesForAsyncStack(); 1266 StackTrace v8StackTrace = m_v8->currentCallFramesForAsyncStack();
1256 if (!v8StackTrace.isNull()) 1267 if (!v8StackTrace.isNull())
1257 return v8StackTrace; 1268 return v8StackTrace;
1258 return m_dart->currentCallFramesForAsyncStack(); 1269 return m_dart->currentCallFramesForAsyncStack();
1259 } 1270 }
1260 1271
1272 ScriptCallFrame UnifiedScriptDebugServer::callFrameNoScopes(int index)
1273 {
1274 if (m_v8->isPaused())
1275 return m_v8->callFrameNoScopes(index);
1276
1277 return m_dart->callFrameNoScopes(index);
1278 }
1261 1279
1262 bool UnifiedScriptDebugServer::isPaused() 1280 bool UnifiedScriptDebugServer::isPaused()
1263 { 1281 {
1264 return m_v8->isPaused() || m_dart->isPaused(); 1282 return m_v8->isPaused() || m_dart->isPaused();
1265 } 1283 }
1266 1284
1267 bool UnifiedScriptDebugServer::runningNestedMessageLoop() 1285 bool UnifiedScriptDebugServer::runningNestedMessageLoop()
1268 { 1286 {
1269 return m_dart->runningNestedMessageLoop() || m_v8->runningNestedMessageLoop( ); 1287 return m_dart->runningNestedMessageLoop() || m_v8->runningNestedMessageLoop( );
1270 } 1288 }
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
1336 MessageQueue<ScriptDebugServer::Task>& tasks = debugTaskQueue(); 1354 MessageQueue<ScriptDebugServer::Task>& tasks = debugTaskQueue();
1337 tasks.append(task); 1355 tasks.append(task);
1338 // The first VM interrupt method triggered will drain the task queue. 1356 // The first VM interrupt method triggered will drain the task queue.
1339 // FIXMEDART: refactor the V8 code to have an interruptAndRunAllTasks 1357 // FIXMEDART: refactor the V8 code to have an interruptAndRunAllTasks
1340 // method. 1358 // method.
1341 PageScriptDebugServer::interruptAndRun(adoptPtr(new DrainQueueTask(&tasks))) ; 1359 PageScriptDebugServer::interruptAndRun(adoptPtr(new DrainQueueTask(&tasks))) ;
1342 DartScriptDebugServer::interruptAndRunAllTasks(); 1360 DartScriptDebugServer::interruptAndRunAllTasks();
1343 } 1361 }
1344 1362
1345 } 1363 }
OLDNEW
« no previous file with comments | « Source/bindings/core/dart/DartScriptDebugServer.h ('k') | Source/bindings/core/dart/DartScriptState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698