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

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

Issue 2001893002: DevTools: expose raw pointers in protocol collections, s/ASSERT/DCHECK/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 } 132 }
133 133
134 V8ProfilerAgentImpl::~V8ProfilerAgentImpl() 134 V8ProfilerAgentImpl::~V8ProfilerAgentImpl()
135 { 135 {
136 } 136 }
137 137
138 void V8ProfilerAgentImpl::consoleProfile(const String16& title) 138 void V8ProfilerAgentImpl::consoleProfile(const String16& title)
139 { 139 {
140 if (!m_enabled) 140 if (!m_enabled)
141 return; 141 return;
142 ASSERT(m_frontend); 142 DCHECK(m_frontend);
143 String16 id = nextProfileId(); 143 String16 id = nextProfileId();
144 m_startedProfiles.append(ProfileDescriptor(id, title)); 144 m_startedProfiles.append(ProfileDescriptor(id, title));
145 startProfiling(id); 145 startProfiling(id);
146 m_frontend->consoleProfileStarted(id, currentDebugLocation(m_session->debugg er()), title); 146 m_frontend->consoleProfileStarted(id, currentDebugLocation(m_session->debugg er()), title);
147 } 147 }
148 148
149 void V8ProfilerAgentImpl::consoleProfileEnd(const String16& title) 149 void V8ProfilerAgentImpl::consoleProfileEnd(const String16& title)
150 { 150 {
151 if (!m_enabled) 151 if (!m_enabled)
152 return; 152 return;
153 ASSERT(m_frontend); 153 DCHECK(m_frontend);
154 String16 id; 154 String16 id;
155 String16 resolvedTitle; 155 String16 resolvedTitle;
156 // Take last started profile if no title was passed. 156 // Take last started profile if no title was passed.
157 if (title.isEmpty()) { 157 if (title.isEmpty()) {
158 if (m_startedProfiles.isEmpty()) 158 if (m_startedProfiles.isEmpty())
159 return; 159 return;
160 id = m_startedProfiles.last().m_id; 160 id = m_startedProfiles.last().m_id;
161 resolvedTitle = m_startedProfiles.last().m_title; 161 resolvedTitle = m_startedProfiles.last().m_title;
162 m_startedProfiles.removeLast(); 162 m_startedProfiles.removeLast();
163 } else { 163 } else {
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 return; 208 return;
209 } 209 }
210 m_state->setNumber(ProfilerAgentState::samplingInterval, interval); 210 m_state->setNumber(ProfilerAgentState::samplingInterval, interval);
211 m_isolate->GetCpuProfiler()->SetSamplingInterval(interval); 211 m_isolate->GetCpuProfiler()->SetSamplingInterval(interval);
212 } 212 }
213 213
214 void V8ProfilerAgentImpl::clearFrontend() 214 void V8ProfilerAgentImpl::clearFrontend()
215 { 215 {
216 ErrorString error; 216 ErrorString error;
217 disable(&error); 217 disable(&error);
218 ASSERT(m_frontend); 218 DCHECK(m_frontend);
219 m_frontend = nullptr; 219 m_frontend = nullptr;
220 } 220 }
221 221
222 void V8ProfilerAgentImpl::restore() 222 void V8ProfilerAgentImpl::restore()
223 { 223 {
224 ASSERT(!m_enabled); 224 DCHECK(!m_enabled);
225 if (!m_state->booleanProperty(ProfilerAgentState::profilerEnabled, false)) 225 if (!m_state->booleanProperty(ProfilerAgentState::profilerEnabled, false))
226 return; 226 return;
227 m_enabled = true; 227 m_enabled = true;
228 m_session->changeInstrumentationCounter(+1); 228 m_session->changeInstrumentationCounter(+1);
229 int interval = 0; 229 int interval = 0;
230 m_state->getNumber(ProfilerAgentState::samplingInterval, &interval); 230 m_state->getNumber(ProfilerAgentState::samplingInterval, &interval);
231 if (interval) 231 if (interval)
232 m_isolate->GetCpuProfiler()->SetSamplingInterval(interval); 232 m_isolate->GetCpuProfiler()->SetSamplingInterval(interval);
233 if (m_state->booleanProperty(ProfilerAgentState::userInitiatedProfiling, fal se)) { 233 if (m_state->booleanProperty(ProfilerAgentState::userInitiatedProfiling, fal se)) {
234 ErrorString error; 234 ErrorString error;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 profile->Delete(); 293 profile->Delete();
294 return result; 294 return result;
295 } 295 }
296 296
297 bool V8ProfilerAgentImpl::isRecording() const 297 bool V8ProfilerAgentImpl::isRecording() const
298 { 298 {
299 return m_recordingCPUProfile || !m_startedProfiles.isEmpty(); 299 return m_recordingCPUProfile || !m_startedProfiles.isEmpty();
300 } 300 }
301 301
302 } // namespace blink 302 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698