| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #ifndef CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ | 5 #ifndef CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ |
| 6 #define CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ | 6 #define CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 12 #include "base/threading/thread_checker.h" |
| 12 #include "base/trace_event/trace_log.h" | 13 #include "base/trace_event/trace_log.h" |
| 13 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 14 | 15 |
| 15 namespace content { | 16 namespace content { |
| 16 | 17 |
| 17 class Sampler; | 18 class Sampler; |
| 18 class V8SamplingThread; | 19 class V8SamplingThread; |
| 19 | 20 |
| 20 // The class monitors enablement of V8 CPU profiler and | 21 // The class monitors enablement of V8 CPU profiler and |
| 21 // spawns a sampling thread when needed. | 22 // spawns a sampling thread when needed. |
| (...skipping 10 matching lines...) Expand all Loading... |
| 32 void EnableSamplingEventForTesting(int code_added_events, int sample_events); | 33 void EnableSamplingEventForTesting(int code_added_events, int sample_events); |
| 33 void WaitSamplingEventForTesting(); | 34 void WaitSamplingEventForTesting(); |
| 34 | 35 |
| 35 private: | 36 private: |
| 36 void StartSamplingThread(); | 37 void StartSamplingThread(); |
| 37 void StopSamplingThread(); | 38 void StopSamplingThread(); |
| 38 | 39 |
| 39 std::unique_ptr<base::WaitableEvent> waitable_event_for_testing_; | 40 std::unique_ptr<base::WaitableEvent> waitable_event_for_testing_; |
| 40 std::unique_ptr<V8SamplingThread> sampling_thread_; | 41 std::unique_ptr<V8SamplingThread> sampling_thread_; |
| 41 std::unique_ptr<Sampler> render_thread_sampler_; | 42 std::unique_ptr<Sampler> render_thread_sampler_; |
| 43 base::ThreadChecker thread_checker_; |
| 42 base::WeakPtrFactory<V8SamplingProfiler> weak_factory_; | 44 base::WeakPtrFactory<V8SamplingProfiler> weak_factory_; |
| 43 | 45 |
| 44 DISALLOW_COPY_AND_ASSIGN(V8SamplingProfiler); | 46 DISALLOW_COPY_AND_ASSIGN(V8SamplingProfiler); |
| 45 }; | 47 }; |
| 46 | 48 |
| 47 } // namespace content | 49 } // namespace content |
| 48 | 50 |
| 49 #endif // CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ | 51 #endif // CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ |
| OLD | NEW |