OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ | 5 #ifndef COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ |
6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ | 6 #define COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
12 #include "base/profiler/stack_sampling_profiler.h" | 12 #include "base/profiler/stack_sampling_profiler.h" |
13 #include "components/metrics/metrics_provider.h" | 13 #include "components/metrics/metrics_provider.h" |
14 | 14 |
15 namespace base { | 15 namespace base { |
16 class MessageLoopProxy; | 16 class SingleThreadTaskRunner; |
17 } // namespace base | 17 } // namespace base |
18 | 18 |
19 namespace metrics { | 19 namespace metrics { |
20 class ChromeUserMetricsExtension; | 20 class ChromeUserMetricsExtension; |
21 | 21 |
22 // Performs metrics logging for the stack sampling profiler. | 22 // Performs metrics logging for the stack sampling profiler. |
23 class CallStackProfileMetricsProvider : public MetricsProvider { | 23 class CallStackProfileMetricsProvider : public MetricsProvider { |
24 public: | 24 public: |
25 // The event that triggered the profile collection. | 25 // The event that triggered the profile collection. |
26 enum Trigger { | 26 enum Trigger { |
(...skipping 23 matching lines...) Expand all Loading... |
50 static const char kFieldTrialName[]; | 50 static const char kFieldTrialName[]; |
51 static const char kReportProfilesGroupName[]; | 51 static const char kReportProfilesGroupName[]; |
52 | 52 |
53 private: | 53 private: |
54 // Returns true if reporting of profiles is enabled according to the | 54 // Returns true if reporting of profiles is enabled according to the |
55 // controlling Finch field trial. | 55 // controlling Finch field trial. |
56 static bool IsSamplingProfilingReportingEnabled(); | 56 static bool IsSamplingProfilingReportingEnabled(); |
57 | 57 |
58 // Invoked by the profiler on another thread. | 58 // Invoked by the profiler on another thread. |
59 static void ReceiveCompletedProfiles( | 59 static void ReceiveCompletedProfiles( |
60 scoped_refptr<base::MessageLoopProxy> message_loop, | 60 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
61 base::WeakPtr<CallStackProfileMetricsProvider> provider, | 61 base::WeakPtr<CallStackProfileMetricsProvider> provider, |
62 const base::StackSamplingProfiler::CallStackProfiles& profiles); | 62 const base::StackSamplingProfiler::CallStackProfiles& profiles); |
63 void AppendCompletedProfiles( | 63 void AppendCompletedProfiles( |
64 const base::StackSamplingProfiler::CallStackProfiles& profiles); | 64 const base::StackSamplingProfiler::CallStackProfiles& profiles); |
65 | 65 |
66 base::StackSamplingProfiler::CallStackProfiles pending_profiles_; | 66 base::StackSamplingProfiler::CallStackProfiles pending_profiles_; |
67 | 67 |
68 base::WeakPtrFactory<CallStackProfileMetricsProvider> weak_factory_; | 68 base::WeakPtrFactory<CallStackProfileMetricsProvider> weak_factory_; |
69 | 69 |
70 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); | 70 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); |
71 }; | 71 }; |
72 | 72 |
73 } // namespace metrics | 73 } // namespace metrics |
74 | 74 |
75 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ | 75 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ |
OLD | NEW |