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

Side by Side Diff: Source/core/inspector/InspectorHeapProfilerAgent.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) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 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 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 ASSERT(size > 0); 145 ASSERT(size > 0);
146 m_heapProfilerAgent->pushHeapStatsUpdate(chunk, size); 146 m_heapProfilerAgent->pushHeapStatsUpdate(chunk, size);
147 } 147 }
148 private: 148 private:
149 InspectorHeapProfilerAgent* m_heapProfilerAgent; 149 InspectorHeapProfilerAgent* m_heapProfilerAgent;
150 }; 150 };
151 151
152 void InspectorHeapProfilerAgent::startTrackingHeapObjects(ErrorString*, const bo ol* trackAllocations) 152 void InspectorHeapProfilerAgent::startTrackingHeapObjects(ErrorString*, const bo ol* trackAllocations)
153 { 153 {
154 m_state->setBoolean(HeapProfilerAgentState::heapObjectsTrackingEnabled, true ); 154 m_state->setBoolean(HeapProfilerAgentState::heapObjectsTrackingEnabled, true );
155 bool allocationTrackingEnabled = trackAllocations && *trackAllocations; 155 bool allocationTrackingEnabled = asBool(trackAllocations);
156 m_state->setBoolean(HeapProfilerAgentState::allocationTrackingEnabled, alloc ationTrackingEnabled); 156 m_state->setBoolean(HeapProfilerAgentState::allocationTrackingEnabled, alloc ationTrackingEnabled);
157 startTrackingHeapObjectsInternal(allocationTrackingEnabled); 157 startTrackingHeapObjectsInternal(allocationTrackingEnabled);
158 } 158 }
159 159
160 void InspectorHeapProfilerAgent::requestHeapStatsUpdate() 160 void InspectorHeapProfilerAgent::requestHeapStatsUpdate()
161 { 161 {
162 if (!m_frontend) 162 if (!m_frontend)
163 return; 163 return;
164 HeapStatsStream stream(this); 164 HeapStatsStream stream(this);
165 SnapshotObjectId lastSeenObjectId = ScriptProfiler::requestHeapStatsUpdate(& stream); 165 SnapshotObjectId lastSeenObjectId = ScriptProfiler::requestHeapStatsUpdate(& stream);
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
244 m_frontend->flush(); 244 m_frontend->flush();
245 } 245 }
246 } 246 }
247 virtual bool isCanceled() OVERRIDE { return false; } 247 virtual bool isCanceled() OVERRIDE { return false; }
248 private: 248 private:
249 InspectorFrontend::HeapProfiler* m_frontend; 249 InspectorFrontend::HeapProfiler* m_frontend;
250 int m_totalWork; 250 int m_totalWork;
251 }; 251 };
252 252
253 String title = "Snapshot " + String::number(m_nextUserInitiatedHeapSnapshotN umber++); 253 String title = "Snapshot " + String::number(m_nextUserInitiatedHeapSnapshotN umber++);
254 HeapSnapshotProgress progress(reportProgress && *reportProgress ? m_frontend : 0); 254 HeapSnapshotProgress progress(asBool(reportProgress) ? m_frontend : 0);
255 RefPtr<ScriptHeapSnapshot> snapshot = ScriptProfiler::takeHeapSnapshot(title , &progress); 255 RefPtr<ScriptHeapSnapshot> snapshot = ScriptProfiler::takeHeapSnapshot(title , &progress);
256 if (!snapshot) { 256 if (!snapshot) {
257 *errorString = "Failed to take heap snapshot"; 257 *errorString = "Failed to take heap snapshot";
258 return; 258 return;
259 } 259 }
260 260
261 class OutputStream : public ScriptHeapSnapshot::OutputStream { 261 class OutputStream : public ScriptHeapSnapshot::OutputStream {
262 public: 262 public:
263 explicit OutputStream(InspectorFrontend::HeapProfiler* frontend) 263 explicit OutputStream(InspectorFrontend::HeapProfiler* frontend)
264 : m_frontend(frontend) { } 264 : m_frontend(frontend) { }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 320
321 void InspectorHeapProfilerAgent::trace(Visitor* visitor) 321 void InspectorHeapProfilerAgent::trace(Visitor* visitor)
322 { 322 {
323 visitor->trace(m_injectedScriptManager); 323 visitor->trace(m_injectedScriptManager);
324 visitor->trace(m_heapStatsUpdateTask); 324 visitor->trace(m_heapStatsUpdateTask);
325 InspectorBaseAgent::trace(visitor); 325 InspectorBaseAgent::trace(visitor);
326 } 326 }
327 327
328 } // namespace blink 328 } // namespace blink
329 329
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorDebuggerAgent.cpp ('k') | Source/core/inspector/InspectorInputAgent.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698