Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1040)

Unified Diff: Source/core/inspector/InspectorDebuggerAgent.cpp

Issue 427803002: DevTools: nits: introduce a handy asBool(bool*) and use across agents. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/InspectorDebuggerAgent.cpp
diff --git a/Source/core/inspector/InspectorDebuggerAgent.cpp b/Source/core/inspector/InspectorDebuggerAgent.cpp
index 5ef689ff65d29d71b9e0f9595974fc1101a7db9c..556870ebc5d7934a422dfd869bb853ec42a34da5 100644
--- a/Source/core/inspector/InspectorDebuggerAgent.cpp
+++ b/Source/core/inspector/InspectorDebuggerAgent.cpp
@@ -252,9 +252,8 @@ void InspectorDebuggerAgent::setBreakpointsActive(ErrorString*, bool active)
void InspectorDebuggerAgent::setSkipAllPauses(ErrorString*, bool skipped, const bool* untilReload)
{
m_skipAllPauses = skipped;
- bool untilReloadValue = untilReload && *untilReload;
m_state->setBoolean(DebuggerAgentState::skipAllPauses, m_skipAllPauses);
- m_state->setBoolean(DebuggerAgentState::skipAllPausesExpiresOnReload, untilReloadValue);
+ m_state->setBoolean(DebuggerAgentState::skipAllPausesExpiresOnReload, asBool(untilReload));
}
void InspectorDebuggerAgent::pageDidCommitLoad()
@@ -320,7 +319,7 @@ void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int li
return;
}
- bool isAntiBreakpointValue = isAntiBreakpoint && *isAntiBreakpoint;
+ bool isAntiBreakpointValue = asBool(isAntiBreakpoint);
String url = optionalURL ? *optionalURL : *optionalURLRegex;
int columnNumber;
@@ -426,7 +425,6 @@ void InspectorDebuggerAgent::removeBreakpoint(const String& breakpointId)
void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const RefPtr<JSONObject>& location, const bool* interstateLocationOpt)
{
- bool interstateLocation = interstateLocationOpt ? *interstateLocationOpt : false;
if (!m_continueToLocationBreakpointId.isEmpty()) {
scriptDebugServer().removeBreakpoint(m_continueToLocationBreakpointId);
m_continueToLocationBreakpointId = "";
@@ -440,7 +438,7 @@ void InspectorDebuggerAgent::continueToLocation(ErrorString* errorString, const
return;
ScriptBreakpoint breakpoint(lineNumber, columnNumber, "");
- m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber, interstateLocation);
+ m_continueToLocationBreakpointId = scriptDebugServer().setBreakpoint(scriptId, breakpoint, &lineNumber, &columnNumber, asBool(interstateLocationOpt));
resume(errorString);
}
@@ -609,20 +607,16 @@ PassRefPtr<TypeBuilder::Debugger::Location> InspectorDebuggerAgent::resolveBreak
void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptId, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<Array<blink::TypeBuilder::Page::SearchMatch> >& results)
{
- bool isRegex = optionalIsRegex ? *optionalIsRegex : false;
- bool caseSensitive = optionalCaseSensitive ? *optionalCaseSensitive : false;
-
ScriptsMap::iterator it = m_scripts.find(scriptId);
if (it != m_scripts.end())
- results = ContentSearchUtils::searchInTextByLines(it->value.source, query, caseSensitive, isRegex);
+ results = ContentSearchUtils::searchInTextByLines(it->value.source, query, asBool(optionalCaseSensitive), asBool(optionalIsRegex));
else
*error = "No script for id: " + scriptId;
}
void InspectorDebuggerAgent::setScriptSource(ErrorString* error, RefPtr<TypeBuilder::Debugger::SetScriptSourceError>& errorData, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<Array<CallFrame> >& newCallFrames, RefPtr<JSONObject>& result, RefPtr<StackTrace>& asyncStackTrace)
{
- bool previewOnly = preview && *preview;
- if (!scriptDebugServer().setScriptSource(scriptId, newContent, previewOnly, error, errorData, &m_currentCallStack, &result))
+ if (!scriptDebugServer().setScriptSource(scriptId, newContent, asBool(preview), error, errorData, &m_currentCallStack, &result))
return;
newCallFrames = currentCallFrames();
@@ -976,7 +970,7 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
}
ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState();
- if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptions)
scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions);
muteConsole();
@@ -992,12 +986,12 @@ void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const
asyncCallStacks[i] = (*it)->callFrames();
}
- injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCallStacks, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, generatePreview ? *generatePreview : false, &result, wasThrown, &exceptionDetails);
+ injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, asyncCallStacks, callFrameId, expression, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), asBool(generatePreview), &result, wasThrown, &exceptionDetails);
// V8 doesn't generate afterCompile event when it's in debugger therefore there is no content of evaluated scripts on frontend
// therefore contents of the stack does not provide necessary information
if (exceptionDetails)
exceptionDetails->setStackTrace(TypeBuilder::Array<TypeBuilder::Console::CallFrame>::create());
- if (doNotPauseOnExceptionsAndMuteConsole ? *doNotPauseOnExceptionsAndMuteConsole : false) {
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
unmuteConsole();
if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExceptionsState)
scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsState);
@@ -1042,7 +1036,7 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
}
ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = scriptDebugServer().pauseOnExceptionsState();
- if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteConsole) {
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
if (previousPauseOnExceptionsState != ScriptDebugServer::DontPauseOnExceptions)
scriptDebugServer().setPauseOnExceptionsState(ScriptDebugServer::DontPauseOnExceptions);
muteConsole();
@@ -1068,7 +1062,7 @@ void InspectorDebuggerAgent::runScript(ErrorString* errorString, const ScriptId&
exceptionDetails->setStackTrace(stackTraceValue->buildInspectorArray());
}
- if (doNotPauseOnExceptionsAndMuteConsole && *doNotPauseOnExceptionsAndMuteConsole) {
+ if (asBool(doNotPauseOnExceptionsAndMuteConsole)) {
unmuteConsole();
if (scriptDebugServer().pauseOnExceptionsState() != previousPauseOnExceptionsState)
scriptDebugServer().setPauseOnExceptionsState(previousPauseOnExceptionsState);

Powered by Google App Engine
This is Rietveld 408576698