| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |