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

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

Issue 2765813002: [debug] refactor code coverage to use enum for mode. (Closed)
Patch Set: fix d8 Created 3 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
« no previous file with comments | « src/feedback-vector.cc ('k') | src/isolate.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-profiler-agent-impl.h" 5 #include "src/inspector/v8-profiler-agent-impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "src/base/atomicops.h" 9 #include "src/base/atomicops.h"
10 #include "src/inspector/protocol/Protocol.h" 10 #include "src/inspector/protocol/Protocol.h"
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 if (!profile->get()) return Response::Error("Profile is not found"); 266 if (!profile->get()) return Response::Error("Profile is not found");
267 } 267 }
268 m_frontendInitiatedProfileId = String16(); 268 m_frontendInitiatedProfileId = String16();
269 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false); 269 m_state->setBoolean(ProfilerAgentState::userInitiatedProfiling, false);
270 return Response::OK(); 270 return Response::OK();
271 } 271 }
272 272
273 Response V8ProfilerAgentImpl::startPreciseCoverage() { 273 Response V8ProfilerAgentImpl::startPreciseCoverage() {
274 if (!m_enabled) return Response::Error("Profiler is not enabled"); 274 if (!m_enabled) return Response::Error("Profiler is not enabled");
275 m_state->setBoolean(ProfilerAgentState::preciseCoverageStarted, true); 275 m_state->setBoolean(ProfilerAgentState::preciseCoverageStarted, true);
276 v8::debug::Coverage::TogglePrecise(m_isolate, true); 276 v8::debug::Coverage::SelectMode(m_isolate,
277 v8::debug::Coverage::kPreciseCount);
277 return Response::OK(); 278 return Response::OK();
278 } 279 }
279 280
280 Response V8ProfilerAgentImpl::stopPreciseCoverage() { 281 Response V8ProfilerAgentImpl::stopPreciseCoverage() {
281 if (!m_enabled) return Response::Error("Profiler is not enabled"); 282 if (!m_enabled) return Response::Error("Profiler is not enabled");
282 m_state->setBoolean(ProfilerAgentState::preciseCoverageStarted, false); 283 m_state->setBoolean(ProfilerAgentState::preciseCoverageStarted, false);
283 v8::debug::Coverage::TogglePrecise(m_isolate, false); 284 v8::debug::Coverage::SelectMode(m_isolate, v8::debug::Coverage::kBestEffort);
284 return Response::OK(); 285 return Response::OK();
285 } 286 }
286 287
287 namespace { 288 namespace {
288 Response takeCoverage( 289 Response takeCoverage(
289 v8::Isolate* isolate, bool reset_count, 290 v8::Isolate* isolate, bool reset_count,
290 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>* 291 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>*
291 out_result) { 292 out_result) {
292 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>> result = 293 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>> result =
293 protocol::Array<protocol::Profiler::ScriptCoverage>::create(); 294 protocol::Array<protocol::Profiler::ScriptCoverage>::create();
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 return m_profiler; 395 return m_profiler;
395 } 396 }
396 397
397 bool V8ProfilerAgentImpl::idleFinished() { 398 bool V8ProfilerAgentImpl::idleFinished() {
398 m_idle = false; 399 m_idle = false;
399 if (m_profiler) m_profiler->SetIdle(m_idle); 400 if (m_profiler) m_profiler->SetIdle(m_idle);
400 return m_profiler; 401 return m_profiler;
401 } 402 }
402 403
403 } // namespace v8_inspector 404 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/feedback-vector.cc ('k') | src/isolate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698