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

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

Issue 1933573002: [DevTools] Remove last bits of logic from v8 agent wrappers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1913283003
Patch Set: rebased, fixed uninitialized variable Created 4 years, 7 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/V8InspectorSessionImpl.h" 9 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
10 #include "platform/v8_inspector/V8StackTraceImpl.h" 10 #include "platform/v8_inspector/V8StackTraceImpl.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
236 if (m_recordingCPUProfile) 236 if (m_recordingCPUProfile)
237 return; 237 return;
238 if (!m_enabled) { 238 if (!m_enabled) {
239 *error = "Profiler is not enabled"; 239 *error = "Profiler is not enabled";
240 return; 240 return;
241 } 241 }
242 m_recordingCPUProfile = true; 242 m_recordingCPUProfile = true;
243 m_frontendInitiatedProfileId = nextProfileId(); 243 m_frontendInitiatedProfileId = nextProfileId();
244 startProfiling(m_frontendInitiatedProfileId); 244 startProfiling(m_frontendInitiatedProfileId);
245 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true); 245 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, true);
246 m_session->client()->profilingStarted();
246 } 247 }
247 248
248 void V8ProfilerAgentImpl::stop(ErrorString* errorString, OwnPtr<protocol::Profil er::CPUProfile>* profile) 249 void V8ProfilerAgentImpl::stop(ErrorString* errorString, OwnPtr<protocol::Profil er::CPUProfile>* profile)
249 { 250 {
250 if (!m_recordingCPUProfile) { 251 if (!m_recordingCPUProfile) {
251 if (errorString) 252 if (errorString)
252 *errorString = "No recording profiles found"; 253 *errorString = "No recording profiles found";
253 return; 254 return;
254 } 255 }
255 m_recordingCPUProfile = false; 256 m_recordingCPUProfile = false;
256 OwnPtr<protocol::Profiler::CPUProfile> cpuProfile = stopProfiling(m_frontend InitiatedProfileId, !!profile); 257 OwnPtr<protocol::Profiler::CPUProfile> cpuProfile = stopProfiling(m_frontend InitiatedProfileId, !!profile);
257 if (profile) { 258 if (profile) {
258 *profile = cpuProfile.release(); 259 *profile = cpuProfile.release();
259 if (!profile->get() && errorString) 260 if (!profile->get() && errorString)
260 *errorString = "Profile is not found"; 261 *errorString = "Profile is not found";
261 } 262 }
262 m_frontendInitiatedProfileId = String16(); 263 m_frontendInitiatedProfileId = String16();
263 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); 264 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
265 m_session->client()->profilingStopped();
264 } 266 }
265 267
266 String16 V8ProfilerAgentImpl::nextProfileId() 268 String16 V8ProfilerAgentImpl::nextProfileId()
267 { 269 {
268 return String16::number(atomicIncrement(&s_lastProfileId)); 270 return String16::number(atomicIncrement(&s_lastProfileId));
269 } 271 }
270 272
271 void V8ProfilerAgentImpl::startProfiling(const String16& title) 273 void V8ProfilerAgentImpl::startProfiling(const String16& title)
272 { 274 {
273 v8::HandleScope handleScope(m_isolate); 275 v8::HandleScope handleScope(m_isolate);
(...skipping 12 matching lines...) Expand all
286 profile->Delete(); 288 profile->Delete();
287 return result.release(); 289 return result.release();
288 } 290 }
289 291
290 bool V8ProfilerAgentImpl::isRecording() const 292 bool V8ProfilerAgentImpl::isRecording() const
291 { 293 {
292 return m_recordingCPUProfile || !m_startedProfiles.isEmpty(); 294 return m_recordingCPUProfile || !m_startedProfiles.isEmpty();
293 } 295 }
294 296
295 } // namespace blink 297 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698