OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef V8_PROFILER_TRACING_CPU_PROFILER_H | 5 #ifndef V8_PROFILER_TRACING_CPU_PROFILER_H |
6 #define V8_PROFILER_TRACING_CPU_PROFILER_H | 6 #define V8_PROFILER_TRACING_CPU_PROFILER_H |
7 | 7 |
| 8 #include "include/v8-platform.h" |
8 #include "include/v8-profiler.h" | 9 #include "include/v8-profiler.h" |
| 10 #include "src/base/atomic-utils.h" |
9 #include "src/base/macros.h" | 11 #include "src/base/macros.h" |
| 12 #include "src/base/platform/mutex.h" |
10 | 13 |
11 namespace v8 { | 14 namespace v8 { |
12 namespace internal { | 15 namespace internal { |
13 | 16 |
14 class TracingCpuProfilerImpl final : public TracingCpuProfiler { | 17 class CpuProfiler; |
| 18 class Isolate; |
| 19 |
| 20 class TracingCpuProfilerImpl final : public TracingCpuProfiler, |
| 21 private v8::Platform::TraceStateObserver { |
15 public: | 22 public: |
16 explicit TracingCpuProfilerImpl(Isolate*); | 23 explicit TracingCpuProfilerImpl(Isolate*); |
17 ~TracingCpuProfilerImpl(); | 24 ~TracingCpuProfilerImpl(); |
18 | 25 |
| 26 // v8::Platform::TraceStateObserver |
| 27 void OnTraceEnabled() final; |
| 28 void OnTraceDisabled() final; |
| 29 |
19 private: | 30 private: |
| 31 void StartProfiling(); |
| 32 void StopProfiling(); |
| 33 |
| 34 Isolate* isolate_; |
| 35 std::unique_ptr<CpuProfiler> profiler_; |
| 36 bool profiling_enabled_; |
| 37 base::Mutex mutex_; |
| 38 |
20 DISALLOW_COPY_AND_ASSIGN(TracingCpuProfilerImpl); | 39 DISALLOW_COPY_AND_ASSIGN(TracingCpuProfilerImpl); |
21 }; | 40 }; |
22 | 41 |
23 } // namespace internal | 42 } // namespace internal |
24 } // namespace v8 | 43 } // namespace v8 |
25 | 44 |
26 #endif // V8_PROFILER_TRACING_CPU_PROFILER_H | 45 #endif // V8_PROFILER_TRACING_CPU_PROFILER_H |
OLD | NEW |