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 20 matching lines...) Expand all Loading... | |
31 #include "core/inspector/InspectorDebuggerAgent.h" | 31 #include "core/inspector/InspectorDebuggerAgent.h" |
32 | 32 |
33 #include "bindings/core/v8/ScriptDebugServer.h" | 33 #include "bindings/core/v8/ScriptDebugServer.h" |
34 #include "bindings/core/v8/ScriptRegexp.h" | 34 #include "bindings/core/v8/ScriptRegexp.h" |
35 #include "bindings/core/v8/ScriptSourceCode.h" | 35 #include "bindings/core/v8/ScriptSourceCode.h" |
36 #include "bindings/core/v8/ScriptValue.h" | 36 #include "bindings/core/v8/ScriptValue.h" |
37 #include "core/dom/Document.h" | 37 #include "core/dom/Document.h" |
38 #include "core/dom/ExecutionContextTask.h" | 38 #include "core/dom/ExecutionContextTask.h" |
39 #include "core/fetch/Resource.h" | 39 #include "core/fetch/Resource.h" |
40 #include "core/inspector/ContentSearchUtils.h" | 40 #include "core/inspector/ContentSearchUtils.h" |
41 #include "core/inspector/EditedResourcesContentManager.h" | |
41 #include "core/inspector/InjectedScriptManager.h" | 42 #include "core/inspector/InjectedScriptManager.h" |
42 #include "core/inspector/InspectorPageAgent.h" | 43 #include "core/inspector/InspectorPageAgent.h" |
43 #include "core/inspector/InspectorState.h" | 44 #include "core/inspector/InspectorState.h" |
44 #include "core/inspector/InstrumentingAgents.h" | 45 #include "core/inspector/InstrumentingAgents.h" |
45 #include "core/inspector/JavaScriptCallFrame.h" | 46 #include "core/inspector/JavaScriptCallFrame.h" |
46 #include "core/inspector/ScriptArguments.h" | 47 #include "core/inspector/ScriptArguments.h" |
47 #include "core/inspector/ScriptAsyncCallStack.h" | 48 #include "core/inspector/ScriptAsyncCallStack.h" |
48 #include "core/inspector/ScriptCallFrame.h" | 49 #include "core/inspector/ScriptCallFrame.h" |
49 #include "core/inspector/ScriptCallStack.h" | 50 #include "core/inspector/ScriptCallStack.h" |
50 #include "platform/JSONValues.h" | 51 #include "platform/JSONValues.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
104 return ":monitor"; | 105 return ":monitor"; |
105 } | 106 } |
106 return String(); | 107 return String(); |
107 } | 108 } |
108 | 109 |
109 static String generateBreakpointId(const String& scriptId, int lineNumber, int c olumnNumber, InspectorDebuggerAgent::BreakpointSource source) | 110 static String generateBreakpointId(const String& scriptId, int lineNumber, int c olumnNumber, InspectorDebuggerAgent::BreakpointSource source) |
110 { | 111 { |
111 return scriptId + ':' + String::number(lineNumber) + ':' + String::number(co lumnNumber) + breakpointIdSuffix(source); | 112 return scriptId + ':' + String::number(lineNumber) + ':' + String::number(co lumnNumber) + breakpointIdSuffix(source); |
112 } | 113 } |
113 | 114 |
114 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc riptManager) | 115 InspectorDebuggerAgent::InspectorDebuggerAgent(InjectedScriptManager* injectedSc riptManager, EditedResourcesContentManager* editedResourcesContentManager) |
vsevik
2014/08/08 11:40:59
Please check whether we actually need this for deb
eustas
2014/08/08 14:03:07
Acknowledged.
| |
115 : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger") | 116 : InspectorBaseAgent<InspectorDebuggerAgent>("Debugger") |
116 , m_injectedScriptManager(injectedScriptManager) | 117 , m_injectedScriptManager(injectedScriptManager) |
118 , m_editedResourcesContentManager(editedResourcesContentManager) | |
117 , m_frontend(0) | 119 , m_frontend(0) |
118 , m_pausedScriptState(nullptr) | 120 , m_pausedScriptState(nullptr) |
119 , m_javaScriptPauseScheduled(false) | 121 , m_javaScriptPauseScheduled(false) |
120 , m_debuggerStepScheduled(false) | 122 , m_debuggerStepScheduled(false) |
121 , m_steppingFromFramework(false) | 123 , m_steppingFromFramework(false) |
122 , m_pausingOnNativeEvent(false) | 124 , m_pausingOnNativeEvent(false) |
123 , m_listener(nullptr) | 125 , m_listener(nullptr) |
124 , m_skippedStepInCount(0) | 126 , m_skippedStepInCount(0) |
125 , m_skipAllPauses(false) | 127 , m_skipAllPauses(false) |
126 { | 128 { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 | 635 |
634 newCallFrames = currentCallFrames(); | 636 newCallFrames = currentCallFrames(); |
635 asyncStackTrace = currentAsyncStackTrace(); | 637 asyncStackTrace = currentAsyncStackTrace(); |
636 | 638 |
637 ScriptsMap::iterator it = m_scripts.find(scriptId); | 639 ScriptsMap::iterator it = m_scripts.find(scriptId); |
638 if (it == m_scripts.end()) | 640 if (it == m_scripts.end()) |
639 return; | 641 return; |
640 String url = it->value.url; | 642 String url = it->value.url; |
641 if (url.isEmpty()) | 643 if (url.isEmpty()) |
642 return; | 644 return; |
643 if (InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPageAgen t()) | 645 m_editedResourcesContentManager->add(url, newContent); |
644 pageAgent->addEditedResourceContent(url, newContent); | |
645 } | 646 } |
646 | 647 |
647 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String & callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res ult, RefPtr<StackTrace>& asyncStackTrace) | 648 void InspectorDebuggerAgent::restartFrame(ErrorString* errorString, const String & callFrameId, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& res ult, RefPtr<StackTrace>& asyncStackTrace) |
648 { | 649 { |
649 if (!isPaused() || m_currentCallStack.isEmpty()) { | 650 if (!isPaused() || m_currentCallStack.isEmpty()) { |
650 *errorString = "Attempt to access callframe when debugger is not on paus e"; | 651 *errorString = "Attempt to access callframe when debugger is not on paus e"; |
651 return; | 652 return; |
652 } | 653 } |
653 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(callFrameId); | 654 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(callFrameId); |
654 if (injectedScript.isEmpty()) { | 655 if (injectedScript.isEmpty()) { |
(...skipping 10 matching lines...) Expand all Loading... | |
665 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s criptId, String* scriptSource) | 666 void InspectorDebuggerAgent::getScriptSource(ErrorString* error, const String& s criptId, String* scriptSource) |
666 { | 667 { |
667 ScriptsMap::iterator it = m_scripts.find(scriptId); | 668 ScriptsMap::iterator it = m_scripts.find(scriptId); |
668 if (it == m_scripts.end()) { | 669 if (it == m_scripts.end()) { |
669 *error = "No script for id: " + scriptId; | 670 *error = "No script for id: " + scriptId; |
670 return; | 671 return; |
671 } | 672 } |
672 | 673 |
673 String url = it->value.url; | 674 String url = it->value.url; |
674 if (!url.isEmpty()) { | 675 if (!url.isEmpty()) { |
675 if (InspectorPageAgent* pageAgent = m_instrumentingAgents->inspectorPage Agent()) { | 676 bool success = m_editedResourcesContentManager->get(url, scriptSource); |
676 bool success = pageAgent->getEditedResourceContent(url, scriptSource ); | 677 if (success) |
677 if (success) | 678 return; |
678 return; | |
679 } | |
680 } | 679 } |
681 *scriptSource = it->value.source; | 680 *scriptSource = it->value.source; |
682 } | 681 } |
683 | 682 |
684 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>& details) | 683 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<FunctionDetails>& details) |
685 { | 684 { |
686 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(functionId); | 685 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(functionId); |
687 if (injectedScript.isEmpty()) { | 686 if (injectedScript.isEmpty()) { |
688 *errorString = "Function object id is obsolete"; | 687 *errorString = "Function object id is obsolete"; |
689 return; | 688 return; |
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1440 m_scripts.clear(); | 1439 m_scripts.clear(); |
1441 m_breakpointIdToDebugServerBreakpointIds.clear(); | 1440 m_breakpointIdToDebugServerBreakpointIds.clear(); |
1442 m_asyncCallStackTracker.clear(); | 1441 m_asyncCallStackTracker.clear(); |
1443 if (m_frontend) | 1442 if (m_frontend) |
1444 m_frontend->globalObjectCleared(); | 1443 m_frontend->globalObjectCleared(); |
1445 } | 1444 } |
1446 | 1445 |
1447 void InspectorDebuggerAgent::trace(Visitor* visitor) | 1446 void InspectorDebuggerAgent::trace(Visitor* visitor) |
1448 { | 1447 { |
1449 visitor->trace(m_injectedScriptManager); | 1448 visitor->trace(m_injectedScriptManager); |
1449 visitor->trace(m_editedResourcesContentManager); | |
1450 visitor->trace(m_listener); | 1450 visitor->trace(m_listener); |
1451 InspectorBaseAgent::trace(visitor); | 1451 InspectorBaseAgent::trace(visitor); |
1452 } | 1452 } |
1453 | 1453 |
1454 } // namespace blink | 1454 } // namespace blink |
1455 | 1455 |
OLD | NEW |