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

Side by Side Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 74063002: DevTools: Support asynchronous call stacks on backend. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: addressed Created 7 years 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) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * Copyright (C) 2010-2011 Google Inc. All rights reserved. 3 * Copyright (C) 2010-2011 Google Inc. All rights reserved.
4 * 4 *
5 * Redistribution and use in source and binary forms, with or without 5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions 6 * modification, are permitted provided that the following conditions
7 * are met: 7 * are met:
8 * 8 *
9 * 1. Redistributions of source code must retain the above copyright 9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer. 10 * notice, this list of conditions and the following disclaimer.
(...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 } 648 }
649 649
650 void InspectorDebuggerAgent::cancelPauseOnNextStatement() 650 void InspectorDebuggerAgent::cancelPauseOnNextStatement()
651 { 651 {
652 if (m_javaScriptPauseScheduled) 652 if (m_javaScriptPauseScheduled)
653 return; 653 return;
654 clearBreakDetails(); 654 clearBreakDetails();
655 scriptDebugServer().setPauseOnNextStatement(false); 655 scriptDebugServer().setPauseOnNextStatement(false);
656 } 656 }
657 657
658 void InspectorDebuggerAgent::requestAsyncCallFramesIfNeeded()
659 {
660 if (m_asyncCallStackTracker.isEnabled())
661 scriptDebugServer().requestAsyncCallFrames();
662 }
663
664 void InspectorDebuggerAgent::didRequestAsyncCallFrames(ScriptValue callFrames)
665 {
666 m_asyncCallStackTracker.didRequestAsyncCallFrames(callFrames);
667 }
668
669 void InspectorDebuggerAgent::didInstallTimer(ExecutionContext*, int timerId, int timeout, bool singleShot)
670 {
671 m_asyncCallStackTracker.didInstallTimer(timerId, singleShot);
672 requestAsyncCallFramesIfNeeded();
673 }
674
675 void InspectorDebuggerAgent::didRemoveTimer(ExecutionContext*, int timerId)
676 {
677 m_asyncCallStackTracker.didRemoveTimer(timerId);
678 }
679
680 bool InspectorDebuggerAgent::willFireTimer(ExecutionContext*, int timerId)
681 {
682 m_asyncCallStackTracker.willFireTimer(timerId);
683 return true;
684 }
685
658 void InspectorDebuggerAgent::didFireTimer() 686 void InspectorDebuggerAgent::didFireTimer()
659 { 687 {
688 m_asyncCallStackTracker.didAsyncCall();
660 cancelPauseOnNextStatement(); 689 cancelPauseOnNextStatement();
661 } 690 }
662 691
692 void InspectorDebuggerAgent::didRequestAnimationFrame(Document*, int callbackId)
693 {
694 m_asyncCallStackTracker.didRequestAnimationFrame(callbackId);
695 requestAsyncCallFramesIfNeeded();
696 }
697
698 void InspectorDebuggerAgent::didCancelAnimationFrame(Document*, int callbackId)
699 {
700 m_asyncCallStackTracker.didCancelAnimationFrame(callbackId);
701 }
702
703 bool InspectorDebuggerAgent::willFireAnimationFrame(Document*, int callbackId)
704 {
705 m_asyncCallStackTracker.willFireAnimationFrame(callbackId);
706 return true;
707 }
708
709 void InspectorDebuggerAgent::didFireAnimationFrame()
710 {
711 m_asyncCallStackTracker.didAsyncCall();
712 }
713
663 void InspectorDebuggerAgent::didHandleEvent() 714 void InspectorDebuggerAgent::didHandleEvent()
664 { 715 {
665 cancelPauseOnNextStatement(); 716 cancelPauseOnNextStatement();
666 } 717 }
667 718
668 void InspectorDebuggerAgent::pause(ErrorString*) 719 void InspectorDebuggerAgent::pause(ErrorString*)
669 { 720 {
670 if (m_javaScriptPauseScheduled) 721 if (m_javaScriptPauseScheduled)
671 return; 722 return;
672 clearBreakDetails(); 723 clearBreakDetails();
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
980 ASSERT(scriptState && !m_pausedScriptState); 1031 ASSERT(scriptState && !m_pausedScriptState);
981 m_pausedScriptState = scriptState; 1032 m_pausedScriptState = scriptState;
982 m_currentCallStack = callFrames; 1033 m_currentCallStack = callFrames;
983 1034
984 m_skipStepInCount = numberOfStepsBeforeStepOut; 1035 m_skipStepInCount = numberOfStepsBeforeStepOut;
985 1036
986 if (!exception.hasNoValue()) { 1037 if (!exception.hasNoValue()) {
987 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF or(scriptState); 1038 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptF or(scriptState);
988 if (!injectedScript.hasNoValue()) { 1039 if (!injectedScript.hasNoValue()) {
989 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; 1040 m_breakReason = InspectorFrontend::Debugger::Reason::Exception;
990 m_breakAuxData = injectedScript.wrapObject(exception, "backtrace")-> openAccessors(); 1041 m_breakAuxData = injectedScript.wrapObject(exception, InspectorDebug gerAgent::backtraceObjectGroup)->openAccessors();
991 // m_breakAuxData might be null after this. 1042 // m_breakAuxData might be null after this.
992 } 1043 }
993 } 1044 }
994 1045
995 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create(); 1046 RefPtr<Array<String> > hitBreakpointIds = Array<String>::create();
996 1047
997 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea kpoints.end(); ++i) { 1048 for (Vector<String>::const_iterator i = hitBreakpoints.begin(); i != hitBrea kpoints.end(); ++i) {
998 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter ator = m_serverBreakpoints.find(*i); 1049 DebugServerBreakpointToBreakpointIdAndSourceMap::iterator breakpointIter ator = m_serverBreakpoints.find(*i);
999 if (breakpointIterator != m_serverBreakpoints.end()) { 1050 if (breakpointIterator != m_serverBreakpoints.end()) {
1000 const String& localId = breakpointIterator->value.first; 1051 const String& localId = breakpointIterator->value.first;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
1038 m_breakAuxData = data; 1089 m_breakAuxData = data;
1039 scriptDebugServer().breakProgram(); 1090 scriptDebugServer().breakProgram();
1040 } 1091 }
1041 1092
1042 void InspectorDebuggerAgent::clear() 1093 void InspectorDebuggerAgent::clear()
1043 { 1094 {
1044 m_pausedScriptState = 0; 1095 m_pausedScriptState = 0;
1045 m_currentCallStack = ScriptValue(); 1096 m_currentCallStack = ScriptValue();
1046 m_scripts.clear(); 1097 m_scripts.clear();
1047 m_breakpointIdToDebugServerBreakpointIds.clear(); 1098 m_breakpointIdToDebugServerBreakpointIds.clear();
1099 m_asyncCallStackTracker.clear();
1048 m_continueToLocationBreakpointId = String(); 1100 m_continueToLocationBreakpointId = String();
1049 clearBreakDetails(); 1101 clearBreakDetails();
1050 m_javaScriptPauseScheduled = false; 1102 m_javaScriptPauseScheduled = false;
1051 ErrorString error; 1103 ErrorString error;
1052 setOverlayMessage(&error, 0); 1104 setOverlayMessage(&error, 0);
1053 } 1105 }
1054 1106
1055 bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString) 1107 bool InspectorDebuggerAgent::assertPaused(ErrorString* errorString)
1056 { 1108 {
1057 if (!m_pausedScriptState) { 1109 if (!m_pausedScriptState) {
(...skipping 18 matching lines...) Expand all
1076 1128
1077 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu mber, int columnNumber, BreakpointSource source) 1129 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu mber, int columnNumber, BreakpointSource source)
1078 { 1130 {
1079 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so urce)); 1131 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so urce));
1080 } 1132 }
1081 1133
1082 void InspectorDebuggerAgent::reset() 1134 void InspectorDebuggerAgent::reset()
1083 { 1135 {
1084 m_scripts.clear(); 1136 m_scripts.clear();
1085 m_breakpointIdToDebugServerBreakpointIds.clear(); 1137 m_breakpointIdToDebugServerBreakpointIds.clear();
1138 m_asyncCallStackTracker.clear();
1086 if (m_frontend) 1139 if (m_frontend)
1087 m_frontend->globalObjectCleared(); 1140 m_frontend->globalObjectCleared();
1088 } 1141 }
1089 1142
1090 } // namespace WebCore 1143 } // namespace WebCore
1091 1144
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698