| 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 6d5ff8ccab362ead89d94c8ec8f62db03f8ff643..33f7f775622d049b1d23723885180509aa015c32 100644
|
| --- a/components/metrics/call_stack_profile_metrics_provider.h
|
| +++ b/components/metrics/call_stack_profile_metrics_provider.h
|
| @@ -7,9 +7,15 @@
|
|
|
| #include <vector>
|
|
|
| +#include "base/memory/ref_counted.h"
|
| +#include "base/memory/weak_ptr.h"
|
| #include "base/profiler/stack_sampling_profiler.h"
|
| #include "components/metrics/metrics_provider.h"
|
|
|
| +namespace base {
|
| +class MessageLoopProxy;
|
| +} // namespace base
|
| +
|
| namespace metrics {
|
| class ChromeUserMetricsExtension;
|
|
|
| @@ -20,18 +26,38 @@ 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
|
| - // ProvideGeneralMetrics, rather than sourcing them from the
|
| - // StackSamplingProfiler.
|
| - void SetSourceProfilesForTesting(
|
| + // Appends |profiles| for use by the next invocation of ProvideGeneralMetrics,
|
| + // rather than sourcing them from the StackSamplingProfiler.
|
| + void AppendSourceProfilesForTesting(
|
| const std::vector<base::StackSamplingProfiler::CallStackProfile>&
|
| profiles);
|
|
|
| + protected:
|
| + // Finch field trial and group for reporting profiles. Provided here for test
|
| + // use.
|
| + static const char kFieldTrialName[];
|
| + static const char kReportProfilesGroupName[];
|
| +
|
| private:
|
| - std::vector<base::StackSamplingProfiler::CallStackProfile>
|
| - source_profiles_for_test_;
|
| + // Returns true if reporting of profiles is enabled according to the
|
| + // controlling Finch field trial.
|
| + static bool IsSamplingProfilingReportingEnabled();
|
| +
|
| + // Invoked by the profiler on another thread.
|
| + static void ReceiveCompletedProfiles(
|
| + scoped_refptr<base::MessageLoopProxy> message_loop,
|
| + base::WeakPtr<CallStackProfileMetricsProvider> provider,
|
| + const base::StackSamplingProfiler::CallStackProfiles& profiles);
|
| + void AppendCompletedProfiles(
|
| + const base::StackSamplingProfiler::CallStackProfiles& profiles);
|
| +
|
| + base::StackSamplingProfiler::CallStackProfiles pending_profiles_;
|
| +
|
| + base::WeakPtrFactory<CallStackProfileMetricsProvider> weak_factory_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider);
|
| };
|
|
|