| 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 170 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 181 } | 181 } | 
| 182 | 182 | 
| 183 bool InspectorDebuggerAgent::checkEnabled(ErrorString* errorString) | 183 bool InspectorDebuggerAgent::checkEnabled(ErrorString* errorString) | 
| 184 { | 184 { | 
| 185     if (enabled()) | 185     if (enabled()) | 
| 186         return true; | 186         return true; | 
| 187     *errorString = "Debugger agent is not enabled"; | 187     *errorString = "Debugger agent is not enabled"; | 
| 188     return false; | 188     return false; | 
| 189 } | 189 } | 
| 190 | 190 | 
| 191 void InspectorDebuggerAgent::enable() | 191 bool InspectorDebuggerAgent::enable() | 
| 192 { | 192 { | 
|  | 193     if (!startListeningScriptDebugServer()) | 
|  | 194         return false; | 
|  | 195 | 
| 193     m_instrumentingAgents->setInspectorDebuggerAgent(this); | 196     m_instrumentingAgents->setInspectorDebuggerAgent(this); | 
| 194 | 197 | 
| 195     startListeningScriptDebugServer(); |  | 
| 196     // FIXME(WK44513): breakpoints activated flag should be synchronized between
       all front-ends | 198     // FIXME(WK44513): breakpoints activated flag should be synchronized between
       all front-ends | 
| 197     scriptDebugServer().setBreakpointsActivated(true); | 199     scriptDebugServer().setBreakpointsActivated(true); | 
| 198 | 200 | 
| 199     m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true); | 201     m_state->setBoolean(DebuggerAgentState::debuggerEnabled, true); | 
| 200     if (m_listener) | 202     if (m_listener) | 
| 201         m_listener->debuggerWasEnabled(); | 203         m_listener->debuggerWasEnabled(); | 
|  | 204     return true; | 
| 202 } | 205 } | 
| 203 | 206 | 
| 204 void InspectorDebuggerAgent::disable() | 207 void InspectorDebuggerAgent::disable() | 
| 205 { | 208 { | 
| 206     m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::cr
      eate()); | 209     m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::cr
      eate()); | 
| 207     m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServ
      er::DontPauseOnExceptions); | 210     m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, ScriptDebugServ
      er::DontPauseOnExceptions); | 
| 208     m_state->setString(DebuggerAgentState::skipStackPattern, ""); | 211     m_state->setString(DebuggerAgentState::skipStackPattern, ""); | 
| 209     m_state->setBoolean(DebuggerAgentState::skipContentScripts, false); | 212     m_state->setBoolean(DebuggerAgentState::skipContentScripts, false); | 
| 210     m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); | 213     m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); | 
| 211     m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | 214     m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); | 
| 212     m_instrumentingAgents->setInspectorDebuggerAgent(0); | 215     m_instrumentingAgents->setInspectorDebuggerAgent(0); | 
| 213 | 216 | 
| 214     stopListeningScriptDebugServer(); | 217     stopListeningScriptDebugServer(); | 
| 215     clear(); | 218     clear(); | 
| 216 | 219 | 
| 217     if (m_listener) | 220     if (m_listener) | 
| 218         m_listener->debuggerWasDisabled(); | 221         m_listener->debuggerWasDisabled(); | 
| 219 | 222 | 
| 220     m_skipAllPauses = false; | 223     m_skipAllPauses = false; | 
| 221 } | 224 } | 
| 222 | 225 | 
| 223 bool InspectorDebuggerAgent::enabled() | 226 bool InspectorDebuggerAgent::enabled() | 
| 224 { | 227 { | 
| 225     return m_state->getBoolean(DebuggerAgentState::debuggerEnabled); | 228     return m_state->getBoolean(DebuggerAgentState::debuggerEnabled); | 
| 226 } | 229 } | 
| 227 | 230 | 
| 228 void InspectorDebuggerAgent::enable(ErrorString*) | 231 void InspectorDebuggerAgent::enable(ErrorString* errorString) | 
| 229 { | 232 { | 
| 230     if (enabled()) | 233     if (enabled()) | 
| 231         return; | 234         return; | 
| 232 | 235 | 
| 233     enable(); | 236     if (!enable()) { | 
|  | 237         *errorString = "Failed to enable debugger"; | 
|  | 238         return; | 
|  | 239     } | 
| 234 | 240 | 
| 235     ASSERT(frontend()); | 241     ASSERT(frontend()); | 
| 236 } | 242 } | 
| 237 | 243 | 
| 238 void InspectorDebuggerAgent::disable(ErrorString*) | 244 void InspectorDebuggerAgent::disable(ErrorString*) | 
| 239 { | 245 { | 
| 240     if (!enabled()) | 246     if (!enabled()) | 
| 241         return; | 247         return; | 
| 242 | 248 | 
| 243     disable(); | 249     disable(); | 
| (...skipping 1436 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1680     visitor->trace(m_v8AsyncCallTracker); | 1686     visitor->trace(m_v8AsyncCallTracker); | 
| 1681     visitor->trace(m_promiseTracker); | 1687     visitor->trace(m_promiseTracker); | 
| 1682     visitor->trace(m_asyncOperations); | 1688     visitor->trace(m_asyncOperations); | 
| 1683     visitor->trace(m_currentAsyncCallChain); | 1689     visitor->trace(m_currentAsyncCallChain); | 
| 1684     visitor->trace(m_asyncCallTrackingListeners); | 1690     visitor->trace(m_asyncCallTrackingListeners); | 
| 1685 #endif | 1691 #endif | 
| 1686     InspectorBaseAgent::trace(visitor); | 1692     InspectorBaseAgent::trace(visitor); | 
| 1687 } | 1693 } | 
| 1688 | 1694 | 
| 1689 } // namespace blink | 1695 } // namespace blink | 
| OLD | NEW | 
|---|