OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |