| 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/macros.h" | 10 #include "base/macros.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 // Get a callback for use with StackSamplingProfiler that provides completed | 25 // Get a callback for use with StackSamplingProfiler that provides completed |
| 26 // profiles to this object. The callback should be immediately passed to the | 26 // profiles to this object. The callback should be immediately passed to the |
| 27 // StackSamplingProfiler, and should not be reused between | 27 // StackSamplingProfiler, and should not be reused between |
| 28 // StackSamplingProfilers. This function may be called on any thread. | 28 // StackSamplingProfilers. This function may be called on any thread. |
| 29 static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( | 29 static base::StackSamplingProfiler::CompletedCallback GetProfilerCallback( |
| 30 const CallStackProfileParams& params); | 30 const CallStackProfileParams& params); |
| 31 | 31 |
| 32 // Provides completed stack profiles to the metrics provider. Intended for use | 32 // Provides completed stack profiles to the metrics provider. Intended for use |
| 33 // when receiving profiles over IPC. In-process StackSamplingProfiler users | 33 // when receiving profiles over IPC. In-process StackSamplingProfiler users |
| 34 // should use GetProfilerCallback() instead. | 34 // should use GetProfilerCallback() instead. |profiles| is not const& because |
| 35 // it must be passed with std::move. |
| 35 static void ReceiveCompletedProfiles( | 36 static void ReceiveCompletedProfiles( |
| 36 const CallStackProfileParams& params, | 37 const CallStackProfileParams& params, |
| 37 base::TimeTicks start_timestamp, | 38 base::TimeTicks start_timestamp, |
| 38 const base::StackSamplingProfiler::CallStackProfiles& profiles); | 39 base::StackSamplingProfiler::CallStackProfiles profiles); |
| 39 | 40 |
| 40 // MetricsProvider: | 41 // MetricsProvider: |
| 41 void OnRecordingEnabled() override; | 42 void OnRecordingEnabled() override; |
| 42 void OnRecordingDisabled() override; | 43 void OnRecordingDisabled() override; |
| 43 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; | 44 void ProvideGeneralMetrics(ChromeUserMetricsExtension* uma_proto) override; |
| 44 | 45 |
| 45 protected: | 46 protected: |
| 46 // Finch field trial and group for reporting profiles. Provided here for test | 47 // Finch field trial and group for reporting profiles. Provided here for test |
| 47 // use. | 48 // use. |
| 48 static const char kFieldTrialName[]; | 49 static const char kFieldTrialName[]; |
| 49 static const char kReportProfilesGroupName[]; | 50 static const char kReportProfilesGroupName[]; |
| 50 | 51 |
| 51 // Reset the static state to the defaults after startup. | 52 // Reset the static state to the defaults after startup. |
| 52 static void ResetStaticStateForTesting(); | 53 static void ResetStaticStateForTesting(); |
| 53 | 54 |
| 54 private: | 55 private: |
| 55 // Returns true if reporting of profiles is enabled according to the | 56 // Returns true if reporting of profiles is enabled according to the |
| 56 // controlling Finch field trial. | 57 // controlling Finch field trial. |
| 57 static bool IsReportingEnabledByFieldTrial(); | 58 static bool IsReportingEnabledByFieldTrial(); |
| 58 | 59 |
| 59 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); | 60 DISALLOW_COPY_AND_ASSIGN(CallStackProfileMetricsProvider); |
| 60 }; | 61 }; |
| 61 | 62 |
| 62 } // namespace metrics | 63 } // namespace metrics |
| 63 | 64 |
| 64 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ | 65 #endif // COMPONENTS_METRICS_CALL_STACK_PROFILE_METRICS_PROVIDER_H_ |
| OLD | NEW |