Chromium Code Reviews| Index: third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| diff --git a/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp b/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| index 41835026bf785d8fafe595fbd17fdc07833be36f..8d0ca63c59912c061a08dd9e5c8d207686e56ae6 100644 |
| --- a/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| +++ b/third_party/WebKit/Source/core/inspector/v8/V8DebuggerAgentImpl.cpp |
| @@ -15,7 +15,6 @@ |
| #include "core/inspector/ContentSearchUtils.h" |
| #include "core/inspector/InjectedScript.h" |
| #include "core/inspector/InjectedScriptManager.h" |
| -#include "core/inspector/InspectorState.h" |
| #include "core/inspector/InstrumentingAgents.h" |
| #include "core/inspector/JSONParser.h" |
| #include "core/inspector/RemoteObjectId.h" |
| @@ -222,10 +221,10 @@ void V8DebuggerAgentImpl::disable(ErrorString*) |
| return; |
| m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, JSONObject::create()); |
| - m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImpl::DontPauseOnExceptions); |
| + m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, (long)V8DebuggerImpl::DontPauseOnExceptions); |
|
pfeldman
2016/01/25 20:19:06
static_cast
dgozman
2016/01/26 01:16:54
Done.
|
| m_state->setString(DebuggerAgentState::skipStackPattern, ""); |
| m_state->setBoolean(DebuggerAgentState::skipContentScripts, false); |
| - m_state->setLong(DebuggerAgentState::asyncCallStackDepth, 0); |
| + m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, (long)0); |
|
pfeldman
2016/01/25 20:19:06
static_cast
dgozman
2016/01/26 01:16:54
Done.
|
| m_state->setBoolean(DebuggerAgentState::promiseTrackerEnabled, false); |
| m_state->setBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, false); |
| @@ -281,7 +280,7 @@ void V8DebuggerAgentImpl::internalSetAsyncCallStackDepth(int depth) |
| m_v8AsyncCallTracker->asyncCallTrackingStateChanged(m_maxAsyncCallStackDepth); |
| } |
| -void V8DebuggerAgentImpl::setInspectorState(InspectorState* state) |
| +void V8DebuggerAgentImpl::setInspectorState(PassRefPtr<JSONObject> state) |
| { |
| m_state = state; |
| } |
| @@ -299,15 +298,26 @@ void V8DebuggerAgentImpl::restore() |
| ASSERT(!m_enabled); |
| m_frontend->globalObjectCleared(); |
| enable(); |
| - long pauseState = m_state->getLong(DebuggerAgentState::pauseOnExceptionsState, V8DebuggerImpl::DontPauseOnExceptions); |
| + long pauseState = V8DebuggerImpl::DontPauseOnExceptions; |
| + m_state->getNumber(DebuggerAgentState::pauseOnExceptionsState, &pauseState); |
| String error; |
| setPauseOnExceptionsImpl(&error, pauseState); |
| - m_cachedSkipStackRegExp = compileSkipCallFramePattern(m_state->getString(DebuggerAgentState::skipStackPattern)); |
| + String skipStackPattern; |
|
pfeldman
2016/01/25 20:19:06
Can we do anything about this getting twice as big
dgozman
2016/01/26 01:16:54
Reduced with booleanProperty.
|
| + m_state->getString(DebuggerAgentState::skipStackPattern, &skipStackPattern); |
| + m_cachedSkipStackRegExp = compileSkipCallFramePattern(skipStackPattern); |
| increaseCachedSkipStackGeneration(); |
| - m_skipContentScripts = m_state->getBoolean(DebuggerAgentState::skipContentScripts); |
| - m_skipAllPauses = m_state->getBoolean(DebuggerAgentState::skipAllPauses); |
| - internalSetAsyncCallStackDepth(m_state->getLong(DebuggerAgentState::asyncCallStackDepth)); |
| - m_promiseTracker->setEnabled(m_state->getBoolean(DebuggerAgentState::promiseTrackerEnabled), m_state->getBoolean(DebuggerAgentState::promiseTrackerCaptureStacks)); |
| + m_skipContentScripts = false; |
| + m_state->getBoolean(DebuggerAgentState::skipContentScripts, &m_skipContentScripts); |
| + m_skipAllPauses = false; |
| + m_state->getBoolean(DebuggerAgentState::skipAllPauses, &m_skipAllPauses); |
| + long asyncCallStackDepth = 0; |
| + m_state->getNumber(DebuggerAgentState::asyncCallStackDepth, &asyncCallStackDepth); |
| + internalSetAsyncCallStackDepth(asyncCallStackDepth); |
| + bool promiseTrackerEnabled = false; |
| + m_state->getBoolean(DebuggerAgentState::promiseTrackerEnabled, &promiseTrackerEnabled); |
| + bool promiseTrackerCaptureStacks = false; |
| + m_state->getBoolean(DebuggerAgentState::promiseTrackerCaptureStacks, &promiseTrackerCaptureStacks); |
| + m_promiseTracker->setEnabled(promiseTrackerEnabled, promiseTrackerCaptureStacks); |
| } |
| void V8DebuggerAgentImpl::setBreakpointsActive(ErrorString* errorString, bool active) |
| @@ -370,6 +380,10 @@ void V8DebuggerAgentImpl::setBreakpointByUrl(ErrorString* errorString, int lineN |
| String breakpointId = (isRegex ? "/" + url + "/" : url) + ':' + String::number(lineNumber) + ':' + String::number(columnNumber); |
| RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
| + if (!breakpointsCookie) { |
| + breakpointsCookie = JSONObject::create(); |
| + m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie); |
| + } |
| if (breakpointsCookie->find(breakpointId) != breakpointsCookie->end()) { |
| *errorString = "Breakpoint at specified location already exists."; |
| return; |
| @@ -431,8 +445,8 @@ void V8DebuggerAgentImpl::removeBreakpoint(ErrorString* errorString, const Strin |
| if (!checkEnabled(errorString)) |
| return; |
| RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
| - breakpointsCookie->remove(breakpointId); |
| - m_state->setObject(DebuggerAgentState::javaScriptBreakpoints, breakpointsCookie); |
| + if (breakpointsCookie) |
| + breakpointsCookie->remove(breakpointId); |
| removeBreakpoint(breakpointId); |
| } |
| @@ -909,7 +923,7 @@ void V8DebuggerAgentImpl::setPauseOnExceptionsImpl(ErrorString* errorString, int |
| if (debugger().pauseOnExceptionsState() != pauseState) |
| *errorString = "Internal error. Could not change pause on exceptions state"; |
| else |
| - m_state->setLong(DebuggerAgentState::pauseOnExceptionsState, pauseState); |
| + m_state->setNumber(DebuggerAgentState::pauseOnExceptionsState, pauseState); |
| } |
| bool V8DebuggerAgentImpl::callStackForId(ErrorString* errorString, const RemoteCallFrameId& callFrameId, v8::Local<v8::Object>* callStack, bool* isAsync) |
| @@ -1105,7 +1119,7 @@ void V8DebuggerAgentImpl::setAsyncCallStackDepth(ErrorString* errorString, int d |
| { |
| if (!checkEnabled(errorString)) |
| return; |
| - m_state->setLong(DebuggerAgentState::asyncCallStackDepth, depth); |
| + m_state->setNumber(DebuggerAgentState::asyncCallStackDepth, depth); |
| internalSetAsyncCallStackDepth(depth); |
| } |
| @@ -1525,6 +1539,9 @@ void V8DebuggerAgentImpl::didParseSource(const V8DebuggerParsedScript& parsedScr |
| return; |
| RefPtr<JSONObject> breakpointsCookie = m_state->getObject(DebuggerAgentState::javaScriptBreakpoints); |
| + if (!breakpointsCookie) |
| + return; |
| + |
| for (auto& cookie : *breakpointsCookie) { |
| RefPtr<JSONObject> breakpointObject = cookie.value->asObject(); |
| bool isRegex; |