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

Side by Side Diff: content/renderer/devtools/v8_sampling_profiler.h

Issue 1967793004: Change base class of V8SamplingProfiler to AsyncEnabledStateObserver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address alph's comments Created 4 years, 7 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 | « no previous file | content/renderer/devtools/v8_sampling_profiler.cc » ('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 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/single_thread_task_runner.h"
12 #include "base/synchronization/waitable_event.h" 11 #include "base/synchronization/waitable_event.h"
13 #include "base/trace_event/trace_log.h" 12 #include "base/trace_event/trace_log.h"
14 #include "content/common/content_export.h" 13 #include "content/common/content_export.h"
15 14
16 namespace content { 15 namespace content {
17 16
18 class Sampler; 17 class Sampler;
19 class V8SamplingThread; 18 class V8SamplingThread;
20 19
21 // The class monitors enablement of V8 CPU profiler and 20 // The class monitors enablement of V8 CPU profiler and
22 // spawns a sampling thread when needed. 21 // spawns a sampling thread when needed.
23 class CONTENT_EXPORT V8SamplingProfiler final 22 class CONTENT_EXPORT V8SamplingProfiler final
24 : public base::trace_event::TraceLog::EnabledStateObserver { 23 : public base::trace_event::TraceLog::AsyncEnabledStateObserver {
25 public: 24 public:
26 explicit V8SamplingProfiler(bool underTest = false); 25 explicit V8SamplingProfiler(bool underTest = false);
27 ~V8SamplingProfiler() override; 26 ~V8SamplingProfiler() override;
28 27
29 // Implementation of TraceLog::EnabledStateObserver 28 // Implementation of TraceLog::EnabledStateObserver
30 void OnTraceLogEnabled() override; 29 void OnTraceLogEnabled() override;
31 void OnTraceLogDisabled() override; 30 void OnTraceLogDisabled() override;
32 31
33 void EnableSamplingEventForTesting(int code_added_events, int sample_events); 32 void EnableSamplingEventForTesting(int code_added_events, int sample_events);
34 void WaitSamplingEventForTesting(); 33 void WaitSamplingEventForTesting();
35 34
36 private: 35 private:
37 void StartSamplingThread(); 36 void StartSamplingThread();
38 void StopSamplingThread(); 37 void StopSamplingThread();
39 38
40 std::unique_ptr<base::WaitableEvent> waitable_event_for_testing_; 39 std::unique_ptr<base::WaitableEvent> waitable_event_for_testing_;
41 std::unique_ptr<V8SamplingThread> sampling_thread_; 40 std::unique_ptr<V8SamplingThread> sampling_thread_;
42 std::unique_ptr<Sampler> render_thread_sampler_; 41 std::unique_ptr<Sampler> render_thread_sampler_;
43 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 42 base::WeakPtrFactory<V8SamplingProfiler> weak_factory_;
44 43
45 DISALLOW_COPY_AND_ASSIGN(V8SamplingProfiler); 44 DISALLOW_COPY_AND_ASSIGN(V8SamplingProfiler);
46 }; 45 };
47 46
48 } // namespace content 47 } // namespace content
49 48
50 #endif // CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_ 49 #endif // CONTENT_RENDERER_DEVTOOLS_V8_SAMPLING_PROFILER_H_
OLDNEW
« no previous file with comments | « no previous file | content/renderer/devtools/v8_sampling_profiler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698