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

Side by Side Diff: src/inspector/v8-heap-profiler-agent-impl.cc

Issue 2343733002: [inspector] enabled presubmit for inspector sub folder (Closed)
Patch Set: addressed comments Created 4 years, 2 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
« no previous file with comments | « src/inspector/v8-heap-profiler-agent-impl.h ('k') | src/inspector/v8-inspector-impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/inspector/v8-heap-profiler-agent-impl.h" 5 #include "src/inspector/v8-heap-profiler-agent-impl.h"
6 6
7 #include "src/inspector/injected-script.h" 7 #include "src/inspector/injected-script.h"
8 #include "src/inspector/protocol/Protocol.h" 8 #include "src/inspector/protocol/Protocol.h"
9 #include "src/inspector/string-util.h" 9 #include "src/inspector/string-util.h"
10 #include "src/inspector/v8-debugger.h" 10 #include "src/inspector/v8-debugger.h"
(...skipping 12 matching lines...) Expand all
23 static const char heapProfilerEnabled[] = "heapProfilerEnabled"; 23 static const char heapProfilerEnabled[] = "heapProfilerEnabled";
24 static const char heapObjectsTrackingEnabled[] = "heapObjectsTrackingEnabled"; 24 static const char heapObjectsTrackingEnabled[] = "heapObjectsTrackingEnabled";
25 static const char allocationTrackingEnabled[] = "allocationTrackingEnabled"; 25 static const char allocationTrackingEnabled[] = "allocationTrackingEnabled";
26 static const char samplingHeapProfilerEnabled[] = "samplingHeapProfilerEnabled"; 26 static const char samplingHeapProfilerEnabled[] = "samplingHeapProfilerEnabled";
27 static const char samplingHeapProfilerInterval[] = 27 static const char samplingHeapProfilerInterval[] =
28 "samplingHeapProfilerInterval"; 28 "samplingHeapProfilerInterval";
29 } 29 }
30 30
31 class HeapSnapshotProgress final : public v8::ActivityControl { 31 class HeapSnapshotProgress final : public v8::ActivityControl {
32 public: 32 public:
33 HeapSnapshotProgress(protocol::HeapProfiler::Frontend* frontend) 33 explicit HeapSnapshotProgress(protocol::HeapProfiler::Frontend* frontend)
34 : m_frontend(frontend) {} 34 : m_frontend(frontend) {}
35 ControlOption ReportProgressValue(int done, int total) override { 35 ControlOption ReportProgressValue(int done, int total) override {
36 m_frontend->reportHeapSnapshotProgress(done, total, 36 m_frontend->reportHeapSnapshotProgress(done, total,
37 protocol::Maybe<bool>()); 37 protocol::Maybe<bool>());
38 if (done >= total) { 38 if (done >= total) {
39 m_frontend->reportHeapSnapshotProgress(total, total, true); 39 m_frontend->reportHeapSnapshotProgress(total, total, true);
40 } 40 }
41 m_frontend->flush(); 41 m_frontend->flush();
42 return kContinue; 42 return kContinue;
43 } 43 }
(...skipping 27 matching lines...) Expand all
71 } 71 }
72 72
73 private: 73 private:
74 size_t m_offset; 74 size_t m_offset;
75 std::vector<char> m_strings; 75 std::vector<char> m_strings;
76 V8InspectorSessionImpl* m_session; 76 V8InspectorSessionImpl* m_session;
77 }; 77 };
78 78
79 class HeapSnapshotOutputStream final : public v8::OutputStream { 79 class HeapSnapshotOutputStream final : public v8::OutputStream {
80 public: 80 public:
81 HeapSnapshotOutputStream(protocol::HeapProfiler::Frontend* frontend) 81 explicit HeapSnapshotOutputStream(protocol::HeapProfiler::Frontend* frontend)
82 : m_frontend(frontend) {} 82 : m_frontend(frontend) {}
83 void EndOfStream() override {} 83 void EndOfStream() override {}
84 int GetChunkSize() override { return 102400; } 84 int GetChunkSize() override { return 102400; }
85 WriteResult WriteAsciiChunk(char* data, int size) override { 85 WriteResult WriteAsciiChunk(char* data, int size) override {
86 m_frontend->addHeapSnapshotChunk(String16(data, size)); 86 m_frontend->addHeapSnapshotChunk(String16(data, size));
87 m_frontend->flush(); 87 m_frontend->flush();
88 return kContinue; 88 return kContinue;
89 } 89 }
90 90
91 private: 91 private:
(...skipping 14 matching lines...) Expand all
106 v8::Local<v8::Value> get(v8::Local<v8::Context> context) override { 106 v8::Local<v8::Value> get(v8::Local<v8::Context> context) override {
107 return objectByHeapObjectId(context->GetIsolate(), m_heapObjectId); 107 return objectByHeapObjectId(context->GetIsolate(), m_heapObjectId);
108 } 108 }
109 109
110 private: 110 private:
111 int m_heapObjectId; 111 int m_heapObjectId;
112 }; 112 };
113 113
114 class HeapStatsStream final : public v8::OutputStream { 114 class HeapStatsStream final : public v8::OutputStream {
115 public: 115 public:
116 HeapStatsStream(protocol::HeapProfiler::Frontend* frontend) 116 explicit HeapStatsStream(protocol::HeapProfiler::Frontend* frontend)
117 : m_frontend(frontend) {} 117 : m_frontend(frontend) {}
118 118
119 void EndOfStream() override {} 119 void EndOfStream() override {}
120 120
121 WriteResult WriteAsciiChunk(char* data, int size) override { 121 WriteResult WriteAsciiChunk(char* data, int size) override {
122 DCHECK(false); 122 DCHECK(false);
123 return kAbort; 123 return kAbort;
124 } 124 }
125 125
126 WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* updateData, 126 WriteResult WriteHeapStatsChunk(v8::HeapStatsUpdate* updateData,
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 *errorString = "Cannot access v8 sampled heap profile."; 398 *errorString = "Cannot access v8 sampled heap profile.";
399 return; 399 return;
400 } 400 }
401 v8::AllocationProfile::Node* root = v8Profile->GetRootNode(); 401 v8::AllocationProfile::Node* root = v8Profile->GetRootNode();
402 *profile = protocol::HeapProfiler::SamplingHeapProfile::create() 402 *profile = protocol::HeapProfiler::SamplingHeapProfile::create()
403 .setHead(buildSampingHeapProfileNode(root)) 403 .setHead(buildSampingHeapProfileNode(root))
404 .build(); 404 .build();
405 } 405 }
406 406
407 } // namespace v8_inspector 407 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/v8-heap-profiler-agent-impl.h ('k') | src/inspector/v8-inspector-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698