OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2013 Google Inc. All rights reserved. | 3 * Copyright (C) 2013 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 , m_injectedScriptManager(injectedScriptManager) | 116 , m_injectedScriptManager(injectedScriptManager) |
117 , m_frontend(0) | 117 , m_frontend(0) |
118 , m_pausedScriptState(nullptr) | 118 , m_pausedScriptState(nullptr) |
119 , m_javaScriptPauseScheduled(false) | 119 , m_javaScriptPauseScheduled(false) |
120 , m_debuggerStepScheduled(false) | 120 , m_debuggerStepScheduled(false) |
121 , m_steppingFromFramework(false) | 121 , m_steppingFromFramework(false) |
122 , m_pausingOnNativeEvent(false) | 122 , m_pausingOnNativeEvent(false) |
123 , m_listener(nullptr) | 123 , m_listener(nullptr) |
124 , m_skippedStepInCount(0) | 124 , m_skippedStepInCount(0) |
125 , m_skipAllPauses(false) | 125 , m_skipAllPauses(false) |
| 126 , m_asyncCallStackTracker(adoptPtrWillBeNoop(new AsyncCallStackTracker())) |
126 { | 127 { |
127 } | 128 } |
128 | 129 |
129 InspectorDebuggerAgent::~InspectorDebuggerAgent() | 130 InspectorDebuggerAgent::~InspectorDebuggerAgent() |
130 { | 131 { |
131 #if !ENABLE(OILPAN) | 132 #if !ENABLE(OILPAN) |
132 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); | 133 ASSERT(!m_instrumentingAgents->inspectorDebuggerAgent()); |
133 #endif | 134 #endif |
134 } | 135 } |
135 | 136 |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 enable(); | 214 enable(); |
214 long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptions
State); | 215 long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptions
State); |
215 String error; | 216 String error; |
216 setPauseOnExceptionsImpl(&error, pauseState); | 217 setPauseOnExceptionsImpl(&error, pauseState); |
217 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString
(DebuggerAgentState::skipStackPattern)); | 218 m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString
(DebuggerAgentState::skipStackPattern)); |
218 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses)
; | 219 m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses)
; |
219 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa
usesExpiresOnReload)) { | 220 if (m_skipAllPauses && m_state->getBoolean(DebuggerAgentState::skipAllPa
usesExpiresOnReload)) { |
220 m_skipAllPauses = false; | 221 m_skipAllPauses = false; |
221 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); | 222 m_state->setBoolean(DebuggerAgentState::skipAllPauses, false); |
222 } | 223 } |
223 m_asyncCallStackTracker.setAsyncCallStackDepth(m_state->getLong(Debugger
AgentState::asyncCallStackDepth)); | 224 asyncCallStackTracker().setAsyncCallStackDepth(m_state->getLong(Debugger
AgentState::asyncCallStackDepth)); |
224 } | 225 } |
225 } | 226 } |
226 | 227 |
227 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) | 228 void InspectorDebuggerAgent::setFrontend(InspectorFrontend* frontend) |
228 { | 229 { |
229 m_frontend = frontend->debugger(); | 230 m_frontend = frontend->debugger(); |
230 } | 231 } |
231 | 232 |
232 void InspectorDebuggerAgent::clearFrontend() | 233 void InspectorDebuggerAgent::clearFrontend() |
233 { | 234 { |
(...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 { | 706 { |
706 if (m_javaScriptPauseScheduled || isPaused()) | 707 if (m_javaScriptPauseScheduled || isPaused()) |
707 return; | 708 return; |
708 clearBreakDetails(); | 709 clearBreakDetails(); |
709 m_pausingOnNativeEvent = false; | 710 m_pausingOnNativeEvent = false; |
710 scriptDebugServer().setPauseOnNextStatement(false); | 711 scriptDebugServer().setPauseOnNextStatement(false); |
711 } | 712 } |
712 | 713 |
713 void InspectorDebuggerAgent::didInstallTimer(ExecutionContext* context, int time
rId, int timeout, bool singleShot) | 714 void InspectorDebuggerAgent::didInstallTimer(ExecutionContext* context, int time
rId, int timeout, bool singleShot) |
714 { | 715 { |
715 if (m_asyncCallStackTracker.isEnabled()) | 716 if (asyncCallStackTracker().isEnabled()) |
716 m_asyncCallStackTracker.didInstallTimer(context, timerId, singleShot, sc
riptDebugServer().currentCallFramesForAsyncStack()); | 717 asyncCallStackTracker().didInstallTimer(context, timerId, singleShot, sc
riptDebugServer().currentCallFramesForAsyncStack()); |
717 } | 718 } |
718 | 719 |
719 void InspectorDebuggerAgent::didRemoveTimer(ExecutionContext* context, int timer
Id) | 720 void InspectorDebuggerAgent::didRemoveTimer(ExecutionContext* context, int timer
Id) |
720 { | 721 { |
721 if (m_asyncCallStackTracker.isEnabled()) | 722 if (asyncCallStackTracker().isEnabled()) |
722 m_asyncCallStackTracker.didRemoveTimer(context, timerId); | 723 asyncCallStackTracker().didRemoveTimer(context, timerId); |
723 } | 724 } |
724 | 725 |
725 bool InspectorDebuggerAgent::willFireTimer(ExecutionContext* context, int timerI
d) | 726 bool InspectorDebuggerAgent::willFireTimer(ExecutionContext* context, int timerI
d) |
726 { | 727 { |
727 if (m_asyncCallStackTracker.isEnabled()) | 728 if (asyncCallStackTracker().isEnabled()) |
728 m_asyncCallStackTracker.willFireTimer(context, timerId); | 729 asyncCallStackTracker().willFireTimer(context, timerId); |
729 return true; | 730 return true; |
730 } | 731 } |
731 | 732 |
732 void InspectorDebuggerAgent::didFireTimer() | 733 void InspectorDebuggerAgent::didFireTimer() |
733 { | 734 { |
734 if (m_asyncCallStackTracker.isEnabled()) | 735 if (asyncCallStackTracker().isEnabled()) |
735 m_asyncCallStackTracker.didFireAsyncCall(); | 736 asyncCallStackTracker().didFireAsyncCall(); |
736 cancelPauseOnNextStatement(); | 737 cancelPauseOnNextStatement(); |
737 } | 738 } |
738 | 739 |
739 void InspectorDebuggerAgent::didRequestAnimationFrame(Document* document, int ca
llbackId) | 740 void InspectorDebuggerAgent::didRequestAnimationFrame(Document* document, int ca
llbackId) |
740 { | 741 { |
741 if (m_asyncCallStackTracker.isEnabled()) | 742 if (asyncCallStackTracker().isEnabled()) |
742 m_asyncCallStackTracker.didRequestAnimationFrame(document, callbackId, s
criptDebugServer().currentCallFramesForAsyncStack()); | 743 asyncCallStackTracker().didRequestAnimationFrame(document, callbackId, s
criptDebugServer().currentCallFramesForAsyncStack()); |
743 } | 744 } |
744 | 745 |
745 void InspectorDebuggerAgent::didCancelAnimationFrame(Document* document, int cal
lbackId) | 746 void InspectorDebuggerAgent::didCancelAnimationFrame(Document* document, int cal
lbackId) |
746 { | 747 { |
747 if (m_asyncCallStackTracker.isEnabled()) | 748 if (asyncCallStackTracker().isEnabled()) |
748 m_asyncCallStackTracker.didCancelAnimationFrame(document, callbackId); | 749 asyncCallStackTracker().didCancelAnimationFrame(document, callbackId); |
749 } | 750 } |
750 | 751 |
751 bool InspectorDebuggerAgent::willFireAnimationFrame(Document* document, int call
backId) | 752 bool InspectorDebuggerAgent::willFireAnimationFrame(Document* document, int call
backId) |
752 { | 753 { |
753 if (m_asyncCallStackTracker.isEnabled()) | 754 if (asyncCallStackTracker().isEnabled()) |
754 m_asyncCallStackTracker.willFireAnimationFrame(document, callbackId); | 755 asyncCallStackTracker().willFireAnimationFrame(document, callbackId); |
755 return true; | 756 return true; |
756 } | 757 } |
757 | 758 |
758 void InspectorDebuggerAgent::didFireAnimationFrame() | 759 void InspectorDebuggerAgent::didFireAnimationFrame() |
759 { | 760 { |
760 if (m_asyncCallStackTracker.isEnabled()) | 761 if (asyncCallStackTracker().isEnabled()) |
761 m_asyncCallStackTracker.didFireAsyncCall(); | 762 asyncCallStackTracker().didFireAsyncCall(); |
762 } | 763 } |
763 | 764 |
764 void InspectorDebuggerAgent::didEnqueueEvent(EventTarget* eventTarget, Event* ev
ent) | 765 void InspectorDebuggerAgent::didEnqueueEvent(EventTarget* eventTarget, Event* ev
ent) |
765 { | 766 { |
766 if (m_asyncCallStackTracker.isEnabled()) | 767 if (asyncCallStackTracker().isEnabled()) |
767 m_asyncCallStackTracker.didEnqueueEvent(eventTarget, event, scriptDebugS
erver().currentCallFramesForAsyncStack()); | 768 asyncCallStackTracker().didEnqueueEvent(eventTarget, event, scriptDebugS
erver().currentCallFramesForAsyncStack()); |
768 } | 769 } |
769 | 770 |
770 void InspectorDebuggerAgent::didRemoveEvent(EventTarget* eventTarget, Event* eve
nt) | 771 void InspectorDebuggerAgent::didRemoveEvent(EventTarget* eventTarget, Event* eve
nt) |
771 { | 772 { |
772 if (m_asyncCallStackTracker.isEnabled()) | 773 if (asyncCallStackTracker().isEnabled()) |
773 m_asyncCallStackTracker.didRemoveEvent(eventTarget, event); | 774 asyncCallStackTracker().didRemoveEvent(eventTarget, event); |
774 } | 775 } |
775 | 776 |
776 void InspectorDebuggerAgent::willHandleEvent(EventTarget* eventTarget, Event* ev
ent, EventListener* listener, bool useCapture) | 777 void InspectorDebuggerAgent::willHandleEvent(EventTarget* eventTarget, Event* ev
ent, EventListener* listener, bool useCapture) |
777 { | 778 { |
778 if (m_asyncCallStackTracker.isEnabled()) | 779 if (asyncCallStackTracker().isEnabled()) |
779 m_asyncCallStackTracker.willHandleEvent(eventTarget, event, listener, us
eCapture); | 780 asyncCallStackTracker().willHandleEvent(eventTarget, event, listener, us
eCapture); |
780 } | 781 } |
781 | 782 |
782 void InspectorDebuggerAgent::didHandleEvent() | 783 void InspectorDebuggerAgent::didHandleEvent() |
783 { | 784 { |
784 if (m_asyncCallStackTracker.isEnabled()) | 785 if (asyncCallStackTracker().isEnabled()) |
785 m_asyncCallStackTracker.didFireAsyncCall(); | 786 asyncCallStackTracker().didFireAsyncCall(); |
786 cancelPauseOnNextStatement(); | 787 cancelPauseOnNextStatement(); |
787 } | 788 } |
788 | 789 |
789 void InspectorDebuggerAgent::willLoadXHR(XMLHttpRequest* xhr, ThreadableLoaderCl
ient*, const AtomicString&, const KURL&, bool async, FormData*, const HTTPHeader
Map&, bool) | 790 void InspectorDebuggerAgent::willLoadXHR(XMLHttpRequest* xhr, ThreadableLoaderCl
ient*, const AtomicString&, const KURL&, bool async, FormData*, const HTTPHeader
Map&, bool) |
790 { | 791 { |
791 if (m_asyncCallStackTracker.isEnabled() && async) | 792 if (asyncCallStackTracker().isEnabled() && async) |
792 m_asyncCallStackTracker.willLoadXHR(xhr, scriptDebugServer().currentCall
FramesForAsyncStack()); | 793 asyncCallStackTracker().willLoadXHR(xhr, scriptDebugServer().currentCall
FramesForAsyncStack()); |
793 } | 794 } |
794 | 795 |
795 void InspectorDebuggerAgent::didDispatchXHRLoadendEvent(XMLHttpRequest* xhr) | 796 void InspectorDebuggerAgent::didDispatchXHRLoadendEvent(XMLHttpRequest* xhr) |
796 { | 797 { |
797 if (m_asyncCallStackTracker.isEnabled()) | 798 if (asyncCallStackTracker().isEnabled()) |
798 m_asyncCallStackTracker.didLoadXHR(xhr); | 799 asyncCallStackTracker().didLoadXHR(xhr); |
799 } | 800 } |
800 | 801 |
801 void InspectorDebuggerAgent::didEnqueueMutationRecord(ExecutionContext* context,
MutationObserver* observer) | 802 void InspectorDebuggerAgent::didEnqueueMutationRecord(ExecutionContext* context,
MutationObserver* observer) |
802 { | 803 { |
803 if (m_asyncCallStackTracker.isEnabled() && !m_asyncCallStackTracker.hasEnque
uedMutationRecord(context, observer)) | 804 if (asyncCallStackTracker().isEnabled() && !asyncCallStackTracker().hasEnque
uedMutationRecord(context, observer)) |
804 m_asyncCallStackTracker.didEnqueueMutationRecord(context, observer, scri
ptDebugServer().currentCallFramesForAsyncStack()); | 805 asyncCallStackTracker().didEnqueueMutationRecord(context, observer, scri
ptDebugServer().currentCallFramesForAsyncStack()); |
805 } | 806 } |
806 | 807 |
807 void InspectorDebuggerAgent::didClearAllMutationRecords(ExecutionContext* contex
t, MutationObserver* observer) | 808 void InspectorDebuggerAgent::didClearAllMutationRecords(ExecutionContext* contex
t, MutationObserver* observer) |
808 { | 809 { |
809 if (m_asyncCallStackTracker.isEnabled()) | 810 if (asyncCallStackTracker().isEnabled()) |
810 m_asyncCallStackTracker.didClearAllMutationRecords(context, observer); | 811 asyncCallStackTracker().didClearAllMutationRecords(context, observer); |
811 } | 812 } |
812 | 813 |
813 void InspectorDebuggerAgent::willDeliverMutationRecords(ExecutionContext* contex
t, MutationObserver* observer) | 814 void InspectorDebuggerAgent::willDeliverMutationRecords(ExecutionContext* contex
t, MutationObserver* observer) |
814 { | 815 { |
815 if (m_asyncCallStackTracker.isEnabled()) | 816 if (asyncCallStackTracker().isEnabled()) |
816 m_asyncCallStackTracker.willDeliverMutationRecords(context, observer); | 817 asyncCallStackTracker().willDeliverMutationRecords(context, observer); |
817 } | 818 } |
818 | 819 |
819 void InspectorDebuggerAgent::didDeliverMutationRecords() | 820 void InspectorDebuggerAgent::didDeliverMutationRecords() |
820 { | 821 { |
821 if (m_asyncCallStackTracker.isEnabled()) | 822 if (asyncCallStackTracker().isEnabled()) |
822 m_asyncCallStackTracker.didFireAsyncCall(); | 823 asyncCallStackTracker().didFireAsyncCall(); |
823 } | 824 } |
824 | 825 |
825 void InspectorDebuggerAgent::didPostExecutionContextTask(ExecutionContext* conte
xt, ExecutionContextTask* task) | 826 void InspectorDebuggerAgent::didPostExecutionContextTask(ExecutionContext* conte
xt, ExecutionContextTask* task) |
826 { | 827 { |
827 if (m_asyncCallStackTracker.isEnabled() && !task->taskNameForInstrumentation
().isEmpty()) | 828 if (asyncCallStackTracker().isEnabled() && !task->taskNameForInstrumentation
().isEmpty()) |
828 m_asyncCallStackTracker.didPostExecutionContextTask(context, task, scrip
tDebugServer().currentCallFramesForAsyncStack()); | 829 asyncCallStackTracker().didPostExecutionContextTask(context, task, scrip
tDebugServer().currentCallFramesForAsyncStack()); |
829 } | 830 } |
830 | 831 |
831 void InspectorDebuggerAgent::didKillAllExecutionContextTasks(ExecutionContext* c
ontext) | 832 void InspectorDebuggerAgent::didKillAllExecutionContextTasks(ExecutionContext* c
ontext) |
832 { | 833 { |
833 if (m_asyncCallStackTracker.isEnabled()) | 834 if (asyncCallStackTracker().isEnabled()) |
834 m_asyncCallStackTracker.didKillAllExecutionContextTasks(context); | 835 asyncCallStackTracker().didKillAllExecutionContextTasks(context); |
835 } | 836 } |
836 | 837 |
837 void InspectorDebuggerAgent::willPerformExecutionContextTask(ExecutionContext* c
ontext, ExecutionContextTask* task) | 838 void InspectorDebuggerAgent::willPerformExecutionContextTask(ExecutionContext* c
ontext, ExecutionContextTask* task) |
838 { | 839 { |
839 if (m_asyncCallStackTracker.isEnabled()) | 840 if (asyncCallStackTracker().isEnabled()) |
840 m_asyncCallStackTracker.willPerformExecutionContextTask(context, task); | 841 asyncCallStackTracker().willPerformExecutionContextTask(context, task); |
841 } | 842 } |
842 | 843 |
843 void InspectorDebuggerAgent::didPerformExecutionContextTask() | 844 void InspectorDebuggerAgent::didPerformExecutionContextTask() |
844 { | 845 { |
845 if (m_asyncCallStackTracker.isEnabled()) | 846 if (asyncCallStackTracker().isEnabled()) |
846 m_asyncCallStackTracker.didFireAsyncCall(); | 847 asyncCallStackTracker().didFireAsyncCall(); |
847 } | 848 } |
848 | 849 |
849 int InspectorDebuggerAgent::traceAsyncOperationStarting(ExecutionContext* contex
t, const String& operationName, int prevOperationId) | 850 int InspectorDebuggerAgent::traceAsyncOperationStarting(ExecutionContext* contex
t, const String& operationName, int prevOperationId) |
850 { | 851 { |
851 if (!m_asyncCallStackTracker.isEnabled()) | 852 if (!asyncCallStackTracker().isEnabled()) |
852 return 0; | 853 return 0; |
853 if (prevOperationId) | 854 if (prevOperationId) |
854 m_asyncCallStackTracker.traceAsyncOperationCompleted(context, prevOperat
ionId); | 855 asyncCallStackTracker().traceAsyncOperationCompleted(context, prevOperat
ionId); |
855 return m_asyncCallStackTracker.traceAsyncOperationStarting(context, operatio
nName, scriptDebugServer().currentCallFramesForAsyncStack()); | 856 return asyncCallStackTracker().traceAsyncOperationStarting(context, operatio
nName, scriptDebugServer().currentCallFramesForAsyncStack()); |
856 } | 857 } |
857 | 858 |
858 void InspectorDebuggerAgent::traceAsyncOperationCompleted(ExecutionContext* cont
ext, int operationId) | 859 void InspectorDebuggerAgent::traceAsyncOperationCompleted(ExecutionContext* cont
ext, int operationId) |
859 { | 860 { |
860 if (m_asyncCallStackTracker.isEnabled()) | 861 if (asyncCallStackTracker().isEnabled()) |
861 m_asyncCallStackTracker.traceAsyncOperationCompleted(context, operationI
d); | 862 asyncCallStackTracker().traceAsyncOperationCompleted(context, operationI
d); |
862 } | 863 } |
863 | 864 |
864 void InspectorDebuggerAgent::traceAsyncOperationCompletedCallbackStarting(Execut
ionContext* context, int operationId) | 865 void InspectorDebuggerAgent::traceAsyncOperationCompletedCallbackStarting(Execut
ionContext* context, int operationId) |
865 { | 866 { |
866 if (!m_asyncCallStackTracker.isEnabled()) | 867 if (!asyncCallStackTracker().isEnabled()) |
867 return; | 868 return; |
868 m_asyncCallStackTracker.traceAsyncCallbackStarting(context, operationId); | 869 asyncCallStackTracker().traceAsyncCallbackStarting(context, operationId); |
869 m_asyncCallStackTracker.traceAsyncOperationCompleted(context, operationId); | 870 asyncCallStackTracker().traceAsyncOperationCompleted(context, operationId); |
870 } | 871 } |
871 | 872 |
872 void InspectorDebuggerAgent::traceAsyncCallbackStarting(ExecutionContext* contex
t, int operationId) | 873 void InspectorDebuggerAgent::traceAsyncCallbackStarting(ExecutionContext* contex
t, int operationId) |
873 { | 874 { |
874 if (m_asyncCallStackTracker.isEnabled()) | 875 if (asyncCallStackTracker().isEnabled()) |
875 m_asyncCallStackTracker.traceAsyncCallbackStarting(context, operationId)
; | 876 asyncCallStackTracker().traceAsyncCallbackStarting(context, operationId)
; |
876 } | 877 } |
877 | 878 |
878 void InspectorDebuggerAgent::traceAsyncCallbackCompleted() | 879 void InspectorDebuggerAgent::traceAsyncCallbackCompleted() |
879 { | 880 { |
880 if (m_asyncCallStackTracker.isEnabled()) | 881 if (asyncCallStackTracker().isEnabled()) |
881 m_asyncCallStackTracker.didFireAsyncCall(); | 882 asyncCallStackTracker().didFireAsyncCall(); |
882 } | 883 } |
883 | 884 |
884 void InspectorDebuggerAgent::didReceiveV8AsyncTaskEvent(ExecutionContext* contex
t, const String& eventType, const String& eventName, int id) | 885 void InspectorDebuggerAgent::didReceiveV8AsyncTaskEvent(ExecutionContext* contex
t, const String& eventType, const String& eventName, int id) |
885 { | 886 { |
886 if (!m_asyncCallStackTracker.isEnabled()) | 887 if (!asyncCallStackTracker().isEnabled()) |
887 return; | 888 return; |
888 if (eventType == v8AsyncTaskEventEnqueue) | 889 if (eventType == v8AsyncTaskEventEnqueue) |
889 m_asyncCallStackTracker.didEnqueueV8AsyncTask(context, eventName, id, sc
riptDebugServer().currentCallFramesForAsyncStack()); | 890 asyncCallStackTracker().didEnqueueV8AsyncTask(context, eventName, id, sc
riptDebugServer().currentCallFramesForAsyncStack()); |
890 else if (eventType == v8AsyncTaskEventWillHandle) | 891 else if (eventType == v8AsyncTaskEventWillHandle) |
891 m_asyncCallStackTracker.willHandleV8AsyncTask(context, eventName, id); | 892 asyncCallStackTracker().willHandleV8AsyncTask(context, eventName, id); |
892 else if (eventType == v8AsyncTaskEventDidHandle) | 893 else if (eventType == v8AsyncTaskEventDidHandle) |
893 m_asyncCallStackTracker.didFireAsyncCall(); | 894 asyncCallStackTracker().didFireAsyncCall(); |
894 else | 895 else |
895 ASSERT_NOT_REACHED(); | 896 ASSERT_NOT_REACHED(); |
896 } | 897 } |
897 | 898 |
898 void InspectorDebuggerAgent::pause(ErrorString*) | 899 void InspectorDebuggerAgent::pause(ErrorString*) |
899 { | 900 { |
900 if (m_javaScriptPauseScheduled || isPaused()) | 901 if (m_javaScriptPauseScheduled || isPaused()) |
901 return; | 902 return; |
902 clearBreakDetails(); | 903 clearBreakDetails(); |
903 m_javaScriptPauseScheduled = true; | 904 m_javaScriptPauseScheduled = true; |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 } | 985 } |
985 | 986 |
986 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); | 987 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s
criptDebugServer().pauseOnExceptionsState(); |
987 if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { | 988 if (asBool(doNotPauseOnExceptionsAndMuteConsole)) { |
988 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) | 989 if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExce
ptions) |
989 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); | 990 scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::Don
tPauseOnExceptions); |
990 muteConsole(); | 991 muteConsole(); |
991 } | 992 } |
992 | 993 |
993 Vector<ScriptValue> asyncCallStacks; | 994 Vector<ScriptValue> asyncCallStacks; |
994 const AsyncCallStackTracker::AsyncCallChain* asyncChain = m_asyncCallStackTr
acker.isEnabled() ? m_asyncCallStackTracker.currentAsyncCallChain() : 0; | 995 const AsyncCallStackTracker::AsyncCallChain* asyncChain = asyncCallStackTrac
ker().isEnabled() ? asyncCallStackTracker().currentAsyncCallChain() : 0; |
995 if (asyncChain) { | 996 if (asyncChain) { |
996 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); | 997 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = asyncCha
in->callStacks(); |
997 asyncCallStacks.resize(callStacks.size()); | 998 asyncCallStacks.resize(callStacks.size()); |
998 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); | 999 AsyncCallStackTracker::AsyncCallStackVector::const_iterator it = callSta
cks.begin(); |
999 for (size_t i = 0; it != callStacks.end(); ++it, ++i) | 1000 for (size_t i = 0; it != callStacks.end(); ++it, ++i) |
1000 asyncCallStacks[i] = (*it)->callFrames(); | 1001 asyncCallStacks[i] = (*it)->callFrames(); |
1001 } | 1002 } |
1002 | 1003 |
1003 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", asBool(includ
eCommandLineAPI), asBool(returnByValue), asBool(generatePreview), &result, wasTh
rown, &exceptionDetails); | 1004 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCal
lStacks, callFrameId, expression, objectGroup ? *objectGroup : "", asBool(includ
eCommandLineAPI), asBool(returnByValue), asBool(generatePreview), &result, wasTh
rown, &exceptionDetails); |
1004 // V8 doesn't generate afterCompile event when it's in debugger therefore th
ere is no content of evaluated scripts on frontend | 1005 // V8 doesn't generate afterCompile event when it's in debugger therefore th
ere is no content of evaluated scripts on frontend |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1126 return; | 1127 return; |
1127 } | 1128 } |
1128 } | 1129 } |
1129 m_state->setString(DebuggerAgentState::skipStackPattern, patternValue); | 1130 m_state->setString(DebuggerAgentState::skipStackPattern, patternValue); |
1130 m_cachedSkipStackRegExp = compiled.release(); | 1131 m_cachedSkipStackRegExp = compiled.release(); |
1131 } | 1132 } |
1132 | 1133 |
1133 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) | 1134 void InspectorDebuggerAgent::setAsyncCallStackDepth(ErrorString*, int depth) |
1134 { | 1135 { |
1135 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); | 1136 m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); |
1136 m_asyncCallStackTracker.setAsyncCallStackDepth(depth); | 1137 asyncCallStackTracker().setAsyncCallStackDepth(depth); |
1137 } | 1138 } |
1138 | 1139 |
1139 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) | 1140 void InspectorDebuggerAgent::scriptExecutionBlockedByCSP(const String& directive
Text) |
1140 { | 1141 { |
1141 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { | 1142 if (scriptDebugServer().pauseOnExceptionsState() != ScriptDebugServer::DontP
auseOnExceptions) { |
1142 RefPtr<JSONObject> directive = JSONObject::create(); | 1143 RefPtr<JSONObject> directive = JSONObject::create(); |
1143 directive->setString("directiveText", directiveText); | 1144 directive->setString("directiveText", directiveText); |
1144 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); | 1145 breakProgram(InspectorFrontend::Debugger::Reason::CSPViolation, directiv
e.release()); |
1145 } | 1146 } |
1146 } | 1147 } |
1147 | 1148 |
1148 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() | 1149 PassRefPtr<Array<CallFrame> > InspectorDebuggerAgent::currentCallFrames() |
1149 { | 1150 { |
1150 if (!m_pausedScriptState || m_currentCallStack.isEmpty()) | 1151 if (!m_pausedScriptState || m_currentCallStack.isEmpty()) |
1151 return Array<CallFrame>::create(); | 1152 return Array<CallFrame>::create(); |
1152 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); | 1153 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(m
_pausedScriptState.get()); |
1153 if (injectedScript.isEmpty()) { | 1154 if (injectedScript.isEmpty()) { |
1154 ASSERT_NOT_REACHED(); | 1155 ASSERT_NOT_REACHED(); |
1155 return Array<CallFrame>::create(); | 1156 return Array<CallFrame>::create(); |
1156 } | 1157 } |
1157 return injectedScript.wrapCallFrames(m_currentCallStack, 0); | 1158 return injectedScript.wrapCallFrames(m_currentCallStack, 0); |
1158 } | 1159 } |
1159 | 1160 |
1160 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() | 1161 PassRefPtr<StackTrace> InspectorDebuggerAgent::currentAsyncStackTrace() |
1161 { | 1162 { |
1162 if (!m_pausedScriptState || !m_asyncCallStackTracker.isEnabled()) | 1163 if (!m_pausedScriptState || !asyncCallStackTracker().isEnabled()) |
1163 return nullptr; | 1164 return nullptr; |
1164 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); | 1165 const AsyncCallStackTracker::AsyncCallChain* chain = asyncCallStackTracker()
.currentAsyncCallChain(); |
1165 if (!chain) | 1166 if (!chain) |
1166 return nullptr; | 1167 return nullptr; |
1167 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); | 1168 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); |
1168 if (callStacks.isEmpty()) | 1169 if (callStacks.isEmpty()) |
1169 return nullptr; | 1170 return nullptr; |
1170 RefPtr<StackTrace> result; | 1171 RefPtr<StackTrace> result; |
1171 int asyncOrdinal = callStacks.size(); | 1172 int asyncOrdinal = callStacks.size(); |
1172 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it, --asyncOrdinal) { | 1173 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it, --asyncOrdinal) { |
1173 ScriptValue callFrames = (*it)->callFrames(); | 1174 ScriptValue callFrames = (*it)->callFrames(); |
1174 ScriptState* scriptState = callFrames.scriptState(); | 1175 ScriptState* scriptState = callFrames.scriptState(); |
(...skipping 23 matching lines...) Expand all Loading... |
1198 // FIXME(WK62725): Debugger line/column are 0-based, while console ones
are 1-based. | 1199 // FIXME(WK62725): Debugger line/column are 0-based, while console ones
are 1-based. |
1199 int line = callFrame->line() + 1; | 1200 int line = callFrame->line() + 1; |
1200 int column = callFrame->column() + 1; | 1201 int column = callFrame->column() + 1; |
1201 frames.append(ScriptCallFrame(callFrame->functionName(), scriptId, callF
rame->scriptName(), line, column)); | 1202 frames.append(ScriptCallFrame(callFrame->functionName(), scriptId, callF
rame->scriptName(), line, column)); |
1202 } | 1203 } |
1203 return ScriptCallStack::create(frames); | 1204 return ScriptCallStack::create(frames); |
1204 } | 1205 } |
1205 | 1206 |
1206 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyn
cStackTraceForConsole() | 1207 PassRefPtrWillBeRawPtr<ScriptAsyncCallStack> InspectorDebuggerAgent::currentAsyn
cStackTraceForConsole() |
1207 { | 1208 { |
1208 if (!m_asyncCallStackTracker.isEnabled()) | 1209 if (!asyncCallStackTracker().isEnabled()) |
1209 return nullptr; | 1210 return nullptr; |
1210 const AsyncCallStackTracker::AsyncCallChain* chain = m_asyncCallStackTracker
.currentAsyncCallChain(); | 1211 const AsyncCallStackTracker::AsyncCallChain* chain = asyncCallStackTracker()
.currentAsyncCallChain(); |
1211 if (!chain) | 1212 if (!chain) |
1212 return nullptr; | 1213 return nullptr; |
1213 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); | 1214 const AsyncCallStackTracker::AsyncCallStackVector& callStacks = chain->callS
tacks(); |
1214 if (callStacks.isEmpty()) | 1215 if (callStacks.isEmpty()) |
1215 return nullptr; | 1216 return nullptr; |
1216 RefPtrWillBeRawPtr<ScriptAsyncCallStack> result = nullptr; | 1217 RefPtrWillBeRawPtr<ScriptAsyncCallStack> result = nullptr; |
1217 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { | 1218 for (AsyncCallStackTracker::AsyncCallStackVector::const_reverse_iterator it
= callStacks.rbegin(); it != callStacks.rend(); ++it) { |
1218 RefPtrWillBeRawPtr<JavaScriptCallFrame> callFrame = ScriptDebugServer::t
oJavaScriptCallFrameUnsafe((*it)->callFrames()); | 1219 RefPtrWillBeRawPtr<JavaScriptCallFrame> callFrame = ScriptDebugServer::t
oJavaScriptCallFrameUnsafe((*it)->callFrames()); |
1219 if (!callFrame) | 1220 if (!callFrame) |
1220 break; | 1221 break; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1390 m_pausingOnNativeEvent = false; | 1391 m_pausingOnNativeEvent = false; |
1391 scriptDebugServer().breakProgram(); | 1392 scriptDebugServer().breakProgram(); |
1392 } | 1393 } |
1393 | 1394 |
1394 void InspectorDebuggerAgent::clear() | 1395 void InspectorDebuggerAgent::clear() |
1395 { | 1396 { |
1396 m_pausedScriptState = nullptr; | 1397 m_pausedScriptState = nullptr; |
1397 m_currentCallStack = ScriptValue(); | 1398 m_currentCallStack = ScriptValue(); |
1398 m_scripts.clear(); | 1399 m_scripts.clear(); |
1399 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1400 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1400 m_asyncCallStackTracker.clear(); | 1401 asyncCallStackTracker().clear(); |
1401 m_continueToLocationBreakpointId = String(); | 1402 m_continueToLocationBreakpointId = String(); |
1402 clearBreakDetails(); | 1403 clearBreakDetails(); |
1403 m_javaScriptPauseScheduled = false; | 1404 m_javaScriptPauseScheduled = false; |
1404 m_debuggerStepScheduled = false; | 1405 m_debuggerStepScheduled = false; |
1405 m_steppingFromFramework = false; | 1406 m_steppingFromFramework = false; |
1406 m_pausingOnNativeEvent = false; | 1407 m_pausingOnNativeEvent = false; |
1407 ErrorString error; | 1408 ErrorString error; |
1408 setOverlayMessage(&error, 0); | 1409 setOverlayMessage(&error, 0); |
1409 } | 1410 } |
1410 | 1411 |
(...skipping 21 matching lines...) Expand all Loading... |
1432 | 1433 |
1433 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber, BreakpointSource source) | 1434 void InspectorDebuggerAgent::removeBreakpoint(const String& scriptId, int lineNu
mber, int columnNumber, BreakpointSource source) |
1434 { | 1435 { |
1435 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); | 1436 removeBreakpoint(generateBreakpointId(scriptId, lineNumber, columnNumber, so
urce)); |
1436 } | 1437 } |
1437 | 1438 |
1438 void InspectorDebuggerAgent::reset() | 1439 void InspectorDebuggerAgent::reset() |
1439 { | 1440 { |
1440 m_scripts.clear(); | 1441 m_scripts.clear(); |
1441 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1442 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1442 m_asyncCallStackTracker.clear(); | 1443 asyncCallStackTracker().clear(); |
1443 if (m_frontend) | 1444 if (m_frontend) |
1444 m_frontend->globalObjectCleared(); | 1445 m_frontend->globalObjectCleared(); |
1445 } | 1446 } |
1446 | 1447 |
1447 void InspectorDebuggerAgent::trace(Visitor* visitor) | 1448 void InspectorDebuggerAgent::trace(Visitor* visitor) |
1448 { | 1449 { |
1449 visitor->trace(m_injectedScriptManager); | 1450 visitor->trace(m_injectedScriptManager); |
1450 visitor->trace(m_listener); | 1451 visitor->trace(m_listener); |
| 1452 visitor->trace(m_asyncCallStackTracker); |
1451 InspectorBaseAgent::trace(visitor); | 1453 InspectorBaseAgent::trace(visitor); |
1452 } | 1454 } |
1453 | 1455 |
1454 } // namespace blink | 1456 } // namespace blink |
1455 | 1457 |
OLD | NEW |