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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 m_state->setBoolean(HeapProfilerAgentState::heapProfilerEnabled, false); | 210 m_state->setBoolean(HeapProfilerAgentState::heapProfilerEnabled, false); |
211 } | 211 } |
212 | 212 |
213 void InspectorHeapProfilerAgent::getHeapSnapshot(ErrorString* errorString, int r
awUid) | 213 void InspectorHeapProfilerAgent::getHeapSnapshot(ErrorString* errorString, int r
awUid) |
214 { | 214 { |
215 class OutputStream : public ScriptHeapSnapshot::OutputStream { | 215 class OutputStream : public ScriptHeapSnapshot::OutputStream { |
216 public: | 216 public: |
217 OutputStream(InspectorFrontend::HeapProfiler* frontend, unsigned uid) | 217 OutputStream(InspectorFrontend::HeapProfiler* frontend, unsigned uid) |
218 : m_frontend(frontend), m_uid(uid) { } | 218 : m_frontend(frontend), m_uid(uid) { } |
219 void Write(const String& chunk) { m_frontend->addHeapSnapshotChunk(m_uid
, chunk); } | 219 void Write(const String& chunk) { m_frontend->addHeapSnapshotChunk(m_uid
, chunk); } |
220 void Close() { m_frontend->finishHeapSnapshot(m_uid); } | 220 void Close() { } |
221 private: | 221 private: |
222 InspectorFrontend::HeapProfiler* m_frontend; | 222 InspectorFrontend::HeapProfiler* m_frontend; |
223 int m_uid; | 223 int m_uid; |
224 }; | 224 }; |
225 | 225 |
226 unsigned uid = static_cast<unsigned>(rawUid); | 226 unsigned uid = static_cast<unsigned>(rawUid); |
227 IdToHeapSnapshotMap::iterator it = m_snapshots.find(uid); | 227 IdToHeapSnapshotMap::iterator it = m_snapshots.find(uid); |
228 if (it == m_snapshots.end()) { | 228 if (it == m_snapshots.end()) { |
229 *errorString = "Profile wasn't found"; | 229 *errorString = "Profile wasn't found"; |
230 return; | 230 return; |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 if (value.hasNoValue() || value.isUndefined()) { | 309 if (value.hasNoValue() || value.isUndefined()) { |
310 *errorString = "Object with given id not found"; | 310 *errorString = "Object with given id not found"; |
311 return; | 311 return; |
312 } | 312 } |
313 unsigned id = ScriptProfiler::getHeapObjectId(value); | 313 unsigned id = ScriptProfiler::getHeapObjectId(value); |
314 *heapSnapshotObjectId = String::number(id); | 314 *heapSnapshotObjectId = String::number(id); |
315 } | 315 } |
316 | 316 |
317 } // namespace WebCore | 317 } // namespace WebCore |
318 | 318 |
OLD | NEW |