| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 } | 91 } |
| 92 InspectorDebuggerAgent::enable(errorString); | 92 InspectorDebuggerAgent::enable(errorString); |
| 93 } | 93 } |
| 94 | 94 |
| 95 void PageDebuggerAgent::restore() | 95 void PageDebuggerAgent::restore() |
| 96 { | 96 { |
| 97 if (canExecuteScripts()) | 97 if (canExecuteScripts()) |
| 98 InspectorDebuggerAgent::restore(); | 98 InspectorDebuggerAgent::restore(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 void PageDebuggerAgent::enable() | |
| 102 { | |
| 103 ASSERT(canExecuteScripts()); | |
| 104 InspectorDebuggerAgent::enable(); | |
| 105 m_instrumentingAgents->setPageDebuggerAgent(this); | |
| 106 } | |
| 107 | |
| 108 void PageDebuggerAgent::disable() | |
| 109 { | |
| 110 InspectorDebuggerAgent::disable(); | |
| 111 m_instrumentingAgents->setPageDebuggerAgent(0); | |
| 112 m_compiledScriptURLs.clear(); | |
| 113 } | |
| 114 | |
| 115 void PageDebuggerAgent::startListeningV8Debugger() | 101 void PageDebuggerAgent::startListeningV8Debugger() |
| 116 { | 102 { |
| 103 ASSERT(canExecuteScripts()); |
| 117 m_mainThreadDebugger->addListener(this, m_pageAgent->inspectedFrame()); | 104 m_mainThreadDebugger->addListener(this, m_pageAgent->inspectedFrame()); |
| 105 m_instrumentingAgents->setPageDebuggerAgent(this); |
| 106 InspectorDebuggerAgent::startListeningV8Debugger(); |
| 118 } | 107 } |
| 119 | 108 |
| 120 void PageDebuggerAgent::stopListeningV8Debugger() | 109 void PageDebuggerAgent::stopListeningV8Debugger() |
| 121 { | 110 { |
| 122 m_mainThreadDebugger->removeListener(this, m_pageAgent->inspectedFrame()); | 111 m_mainThreadDebugger->removeListener(this, m_pageAgent->inspectedFrame()); |
| 112 m_instrumentingAgents->setPageDebuggerAgent(nullptr); |
| 113 m_compiledScriptURLs.clear(); |
| 114 InspectorDebuggerAgent::stopListeningV8Debugger(); |
| 123 } | 115 } |
| 124 | 116 |
| 125 void PageDebuggerAgent::muteConsole() | 117 void PageDebuggerAgent::muteConsole() |
| 126 { | 118 { |
| 127 FrameConsole::mute(); | 119 FrameConsole::mute(); |
| 128 } | 120 } |
| 129 | 121 |
| 130 void PageDebuggerAgent::unmuteConsole() | 122 void PageDebuggerAgent::unmuteConsole() |
| 131 { | 123 { |
| 132 FrameConsole::unmute(); | 124 FrameConsole::unmute(); |
| 133 } | 125 } |
| 134 | 126 |
| 135 void PageDebuggerAgent::overlayResumed() | 127 void PageDebuggerAgent::overlayResumed() |
| 136 { | 128 { |
| 137 ErrorString error; | 129 ErrorString error; |
| 138 resume(&error); | 130 resume(&error); |
| 139 } | 131 } |
| 140 | 132 |
| 141 void PageDebuggerAgent::overlaySteppedOver() | 133 void PageDebuggerAgent::overlaySteppedOver() |
| 142 { | 134 { |
| 143 ErrorString error; | 135 ErrorString error; |
| 144 stepOver(&error); | 136 stepOver(&error); |
| 145 } | 137 } |
| 146 | 138 |
| 147 InjectedScript PageDebuggerAgent::injectedScriptForEval(ErrorString* errorString
, const int* executionContextId) | 139 InjectedScript PageDebuggerAgent::defaultInjectedScript() |
| 148 { | 140 { |
| 149 if (!executionContextId) { | 141 ScriptState* scriptState = ScriptState::forMainWorld(m_pageAgent->inspectedF
rame()); |
| 150 ScriptState* scriptState = ScriptState::forMainWorld(m_pageAgent->inspec
tedFrame()); | 142 return injectedScriptManager()->injectedScriptFor(scriptState); |
| 151 InjectedScript result = injectedScriptManager()->injectedScriptFor(scrip
tState); | |
| 152 if (result.isEmpty()) | |
| 153 *errorString = "Internal error: main world execution context not fou
nd."; | |
| 154 return result; | |
| 155 } | |
| 156 InjectedScript injectedScript = injectedScriptManager()->injectedScriptForId
(*executionContextId); | |
| 157 if (injectedScript.isEmpty()) | |
| 158 *errorString = "Execution context with given id not found."; | |
| 159 return injectedScript; | |
| 160 } | 143 } |
| 161 | 144 |
| 162 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame) | 145 void PageDebuggerAgent::didStartProvisionalLoad(LocalFrame* frame) |
| 163 { | 146 { |
| 164 if (frame == m_pageAgent->inspectedFrame()) { | 147 if (frame == m_pageAgent->inspectedFrame()) { |
| 165 ErrorString error; | 148 ErrorString error; |
| 166 resume(&error); | 149 resume(&error); |
| 167 } | 150 } |
| 168 } | 151 } |
| 169 | 152 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 RefPtrWillBeRawPtr<LocalFrame> protect(frame); | 200 RefPtrWillBeRawPtr<LocalFrame> protect(frame); |
| 218 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId,
objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); | 201 InspectorDebuggerAgent::runScript(errorString, scriptId, executionContextId,
objectGroup, doNotPauseOnExceptionsAndMuteConsole, result, exceptionDetails); |
| 219 | 202 |
| 220 if (frame) | 203 if (frame) |
| 221 InspectorInstrumentation::didEvaluateScript(cookie); | 204 InspectorInstrumentation::didEvaluateScript(cookie); |
| 222 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); | 205 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "Update
Counters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data(
)); |
| 223 | 206 |
| 224 } | 207 } |
| 225 | 208 |
| 226 } // namespace blink | 209 } // namespace blink |
| OLD | NEW |