Chromium Code Reviews| Index: components/metrics/call_stack_profile_metrics_provider.h |
| diff --git a/components/metrics/call_stack_profile_metrics_provider.h b/components/metrics/call_stack_profile_metrics_provider.h |
| index a2bb0f85a31bd8de9d0c53ad4d138ed1940aed4a..0de3017371eb9b889ea46c333ea258575acdc955 100644 |
| --- a/components/metrics/call_stack_profile_metrics_provider.h |
| +++ b/components/metrics/call_stack_profile_metrics_provider.h |
| @@ -7,7 +7,9 @@ |
| #include <vector> |
| +#include "base/memory/weak_ptr.h" |
| #include "base/profiler/stack_sampling_profiler.h" |
| +#include "base/synchronization/lock.h" |
| #include "components/metrics/metrics_provider.h" |
| namespace metrics { |
| @@ -20,6 +22,8 @@ class CallStackProfileMetricsProvider : public MetricsProvider { |
| ~CallStackProfileMetricsProvider() override; |
| // MetricsProvider: |
| + void OnRecordingEnabled() override; |
| + void OnRecordingDisabled() override; |
| void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; |
| // Uses |profiles| as the source data for the next invocation of |
| @@ -28,8 +32,23 @@ class CallStackProfileMetricsProvider : public MetricsProvider { |
| void SetSourceProfilesForTesting( |
| const std::vector<base::StackSamplingProfiler::Profile>& profiles); |
| + // Finch field trial and group for reporting profiles. |
| + static const char kFieldTrialName[]; |
| + static const char kReportProfilesGroupName[]; |
|
Ilya Sherman
2015/03/24 04:02:03
nit: If these are only used for tests, please mark
Mike Wittman
2015/03/24 18:37:39
Done.
|
| + |
| private: |
| - std::vector<base::StackSamplingProfiler::Profile> source_profiles_for_test_; |
| + // These functions will be called on a separate thread. |
| + void ReceiveCompletedProfiles( |
| + const std::vector<base::StackSamplingProfiler::Profile>& profiles); |
| + static void IgnoreCompletedProfiles( |
| + const std::vector<base::StackSamplingProfiler::Profile>& profiles); |
|
Ilya Sherman
2015/03/24 04:02:03
Can this be moved to an anonymous namespace in the
Mike Wittman
2015/03/24 18:37:39
Done.
|
| + |
| + // Pending profiles are updated from the profiler on a separate thread, so |
| + // must be guarded by a lock. |
| + base::Lock pending_profiles_lock_; |
| + std::vector<base::StackSamplingProfiler::Profile> pending_profiles_; |
|
Ilya Sherman
2015/03/24 04:02:03
Could you please instead post a task to the thread
Mike Wittman
2015/03/24 18:37:39
Done.
|
| + |
| + base::WeakPtrFactory<CallStackProfileMetricsProvider> weak_factory_; |
| DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); |
| }; |