| 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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>* | 357 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>* |
| 358 out_result) { | 358 out_result) { |
| 359 v8::HandleScope handle_scope(m_isolate); | 359 v8::HandleScope handle_scope(m_isolate); |
| 360 v8::debug::Coverage coverage = | 360 v8::debug::Coverage coverage = |
| 361 v8::debug::Coverage::CollectBestEffort(m_isolate); | 361 v8::debug::Coverage::CollectBestEffort(m_isolate); |
| 362 return coverageToProtocol(m_isolate, coverage, out_result); | 362 return coverageToProtocol(m_isolate, coverage, out_result); |
| 363 } | 363 } |
| 364 | 364 |
| 365 String16 V8ProfilerAgentImpl::nextProfileId() { | 365 String16 V8ProfilerAgentImpl::nextProfileId() { |
| 366 return String16::fromInteger( | 366 return String16::fromInteger( |
| 367 v8::base::NoBarrier_AtomicIncrement(&s_lastProfileId, 1)); | 367 v8::base::Relaxed_AtomicIncrement(&s_lastProfileId, 1)); |
| 368 } | 368 } |
| 369 | 369 |
| 370 void V8ProfilerAgentImpl::startProfiling(const String16& title) { | 370 void V8ProfilerAgentImpl::startProfiling(const String16& title) { |
| 371 v8::HandleScope handleScope(m_isolate); | 371 v8::HandleScope handleScope(m_isolate); |
| 372 if (!m_startedProfilesCount) { | 372 if (!m_startedProfilesCount) { |
| 373 DCHECK(!m_profiler); | 373 DCHECK(!m_profiler); |
| 374 m_profiler = v8::CpuProfiler::New(m_isolate); | 374 m_profiler = v8::CpuProfiler::New(m_isolate); |
| 375 m_profiler->SetIdle(m_idle); | 375 m_profiler->SetIdle(m_idle); |
| 376 int interval = | 376 int interval = |
| 377 m_state->integerProperty(ProfilerAgentState::samplingInterval, 0); | 377 m_state->integerProperty(ProfilerAgentState::samplingInterval, 0); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 405 return m_profiler; | 405 return m_profiler; |
| 406 } | 406 } |
| 407 | 407 |
| 408 bool V8ProfilerAgentImpl::idleFinished() { | 408 bool V8ProfilerAgentImpl::idleFinished() { |
| 409 m_idle = false; | 409 m_idle = false; |
| 410 if (m_profiler) m_profiler->SetIdle(m_idle); | 410 if (m_profiler) m_profiler->SetIdle(m_idle); |
| 411 return m_profiler; | 411 return m_profiler; |
| 412 } | 412 } |
| 413 | 413 |
| 414 } // namespace v8_inspector | 414 } // namespace v8_inspector |
| OLD | NEW |