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

Side by Side Diff: Source/core/inspector/InspectorRuntimeAgent.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: addressed Created 6 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 28 matching lines...) Expand all
39 #include "platform/JSONValues.h" 39 #include "platform/JSONValues.h"
40 40
41 using blink::TypeBuilder::Runtime::ExecutionContextDescription; 41 using blink::TypeBuilder::Runtime::ExecutionContextDescription;
42 42
43 namespace blink { 43 namespace blink {
44 44
45 namespace InspectorRuntimeAgentState { 45 namespace InspectorRuntimeAgentState {
46 static const char runtimeEnabled[] = "runtimeEnabled"; 46 static const char runtimeEnabled[] = "runtimeEnabled";
47 }; 47 };
48 48
49 static bool asBool(const bool* const b)
50 {
51 return b ? *b : false;
52 }
53
54 InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScri ptManager, ScriptDebugServer* scriptDebugServer) 49 InspectorRuntimeAgent::InspectorRuntimeAgent(InjectedScriptManager* injectedScri ptManager, ScriptDebugServer* scriptDebugServer)
55 : InspectorBaseAgent<InspectorRuntimeAgent>("Runtime") 50 : InspectorBaseAgent<InspectorRuntimeAgent>("Runtime")
56 , m_enabled(false) 51 , m_enabled(false)
57 , m_frontend(0) 52 , m_frontend(0)
58 , m_injectedScriptManager(injectedScriptManager) 53 , m_injectedScriptManager(injectedScriptManager)
59 , m_scriptDebugServer(scriptDebugServer) 54 , m_scriptDebugServer(scriptDebugServer)
60 { 55 {
61 } 56 }
62 57
63 InspectorRuntimeAgent::~InspectorRuntimeAgent() 58 InspectorRuntimeAgent::~InspectorRuntimeAgent()
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 { 122 {
128 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId); 123 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId);
129 if (injectedScript.isEmpty()) { 124 if (injectedScript.isEmpty()) {
130 *errorString = "Inspected frame has gone"; 125 *errorString = "Inspected frame has gone";
131 return; 126 return;
132 } 127 }
133 128
134 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s etPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExce ptions); 129 ScriptDebugServer::PauseOnExceptionsState previousPauseOnExceptionsState = s etPauseOnExceptionsState(m_scriptDebugServer, ScriptDebugServer::DontPauseOnExce ptions);
135 muteConsole(); 130 muteConsole();
136 131
137 bool accessorPropertiesOnlyValue = accessorPropertiesOnly && *accessorProper tiesOnly; 132 injectedScript.getProperties(errorString, objectId, asBool(ownProperties), a sBool(accessorPropertiesOnly), &result);
138 injectedScript.getProperties(errorString, objectId, ownProperties && *ownPro perties, accessorPropertiesOnlyValue, &result);
139 133
140 if (!accessorPropertiesOnlyValue) 134 if (!asBool(accessorPropertiesOnly))
141 injectedScript.getInternalProperties(errorString, objectId, &internalPro perties); 135 injectedScript.getInternalProperties(errorString, objectId, &internalPro perties);
142 136
143 unmuteConsole(); 137 unmuteConsole();
144 setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsStat e); 138 setPauseOnExceptionsState(m_scriptDebugServer, previousPauseOnExceptionsStat e);
145 } 139 }
146 140
147 void InspectorRuntimeAgent::releaseObject(ErrorString*, const String& objectId) 141 void InspectorRuntimeAgent::releaseObject(ErrorString*, const String& objectId)
148 { 142 {
149 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId); 143 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForOb jectId(objectId);
150 if (!injectedScript.isEmpty()) 144 if (!injectedScript.isEmpty())
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 m_frontend->executionContextCreated(ExecutionContextDescription::create() 207 m_frontend->executionContextCreated(ExecutionContextDescription::create()
214 .setId(executionContextId) 208 .setId(executionContextId)
215 .setIsPageContext(isPageContext) 209 .setIsPageContext(isPageContext)
216 .setName(name) 210 .setName(name)
217 .setFrameId(frameId) 211 .setFrameId(frameId)
218 .release()); 212 .release());
219 } 213 }
220 214
221 } // namespace blink 215 } // namespace blink
222 216
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/inspector/InspectorTimelineAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698