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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8ProfilerAgentImpl.cpp

Issue 1758313002: DevTools: introduce collections shim to be backed by non-wtf in v8_inspector. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for landing Created 4 years, 9 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium 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 "platform/v8_inspector/V8ProfilerAgentImpl.h" 5 #include "platform/v8_inspector/V8ProfilerAgentImpl.h"
6 6
7 #include "platform/v8_inspector/Atomics.h" 7 #include "platform/v8_inspector/Atomics.h"
8 #include "platform/v8_inspector/V8DebuggerImpl.h" 8 #include "platform/v8_inspector/V8DebuggerImpl.h"
9 #include "platform/v8_inspector/V8StackTraceImpl.h" 9 #include "platform/v8_inspector/V8StackTraceImpl.h"
10 #include "platform/v8_inspector/V8StringUtil.h" 10 #include "platform/v8_inspector/V8StringUtil.h"
11 #include <v8-profiler.h> 11 #include <v8-profiler.h>
12 12
13 namespace blink { 13 namespace blink {
14 14
15 namespace ProfilerAgentState { 15 namespace ProfilerAgentState {
16 static const char samplingInterval[] = "samplingInterval"; 16 static const char samplingInterval[] = "samplingInterval";
17 static const char userInitiatedProfiling[] = "userInitiatedProfiling"; 17 static const char userInitiatedProfiling[] = "userInitiatedProfiling";
18 } 18 }
19 19
20 namespace { 20 namespace {
21 21
22 PassOwnPtr<protocol::Array<protocol::Profiler::PositionTickInfo>> buildInspector ObjectForPositionTicks(const v8::CpuProfileNode* node) 22 PassOwnPtr<protocol::Array<protocol::Profiler::PositionTickInfo>> buildInspector ObjectForPositionTicks(const v8::CpuProfileNode* node)
23 { 23 {
24 OwnPtr<protocol::Array<protocol::Profiler::PositionTickInfo>> array = protoc ol::Array<protocol::Profiler::PositionTickInfo>::create(); 24 OwnPtr<protocol::Array<protocol::Profiler::PositionTickInfo>> array = protoc ol::Array<protocol::Profiler::PositionTickInfo>::create();
25 unsigned lineCount = node->GetHitLineCount(); 25 unsigned lineCount = node->GetHitLineCount();
26 if (!lineCount) 26 if (!lineCount)
27 return array.release(); 27 return array.release();
28 28
29 Vector<v8::CpuProfileNode::LineTick> entries(lineCount); 29 protocol::Vector<v8::CpuProfileNode::LineTick> entries(lineCount);
30 if (node->GetLineTicks(&entries[0], lineCount)) { 30 if (node->GetLineTicks(&entries[0], lineCount)) {
31 for (unsigned i = 0; i < lineCount; i++) { 31 for (unsigned i = 0; i < lineCount; i++) {
32 OwnPtr<protocol::Profiler::PositionTickInfo> line = protocol::Profil er::PositionTickInfo::create() 32 OwnPtr<protocol::Profiler::PositionTickInfo> line = protocol::Profil er::PositionTickInfo::create()
33 .setLine(entries[i].line) 33 .setLine(entries[i].line)
34 .setTicks(entries[i].hit_count).build(); 34 .setTicks(entries[i].hit_count).build();
35 array->addItem(line.release()); 35 array->addItem(line.release());
36 } 36 }
37 } 37 }
38 38
39 return array.release(); 39 return array.release();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 m_frontend->consoleProfileFinished(id, location.release(), profile.release() , resolvedTitle); 178 m_frontend->consoleProfileFinished(id, location.release(), profile.release() , resolvedTitle);
179 } 179 }
180 180
181 void V8ProfilerAgentImpl::enable(ErrorString*) 181 void V8ProfilerAgentImpl::enable(ErrorString*)
182 { 182 {
183 m_enabled = true; 183 m_enabled = true;
184 } 184 }
185 185
186 void V8ProfilerAgentImpl::disable(ErrorString* errorString) 186 void V8ProfilerAgentImpl::disable(ErrorString* errorString)
187 { 187 {
188 for (Vector<ProfileDescriptor>::reverse_iterator it = m_startedProfiles.rbeg in(); it != m_startedProfiles.rend(); ++it) 188 for (size_t i = m_startedProfiles.size(); i > 0; --i)
189 stopProfiling(it->m_id, false); 189 stopProfiling(m_startedProfiles[i - 1].m_id, false);
190 m_startedProfiles.clear(); 190 m_startedProfiles.clear();
191 stop(nullptr, nullptr); 191 stop(nullptr, nullptr);
192 m_enabled = false; 192 m_enabled = false;
193 } 193 }
194 194
195 void V8ProfilerAgentImpl::setSamplingInterval(ErrorString* error, int interval) 195 void V8ProfilerAgentImpl::setSamplingInterval(ErrorString* error, int interval)
196 { 196 {
197 if (m_recordingCPUProfile) { 197 if (m_recordingCPUProfile) {
198 *error = "Cannot change sampling interval when profiling."; 198 *error = "Cannot change sampling interval when profiling.";
199 return; 199 return;
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 } 292 }
293 293
294 void V8ProfilerAgentImpl::idleStarted() 294 void V8ProfilerAgentImpl::idleStarted()
295 { 295 {
296 if (!isRecording()) 296 if (!isRecording())
297 return; 297 return;
298 m_isolate->GetCpuProfiler()->SetIdle(true); 298 m_isolate->GetCpuProfiler()->SetIdle(true);
299 } 299 }
300 300
301 } // namespace blink 301 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698