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

Unified Diff: components/metrics/call_stack_profile_metrics_provider.cc

Issue 1318733007: Refactor CallStackProfile::Params into base/ for use over IPC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/metrics/call_stack_profile_metrics_provider.cc
diff --git a/components/metrics/call_stack_profile_metrics_provider.cc b/components/metrics/call_stack_profile_metrics_provider.cc
index b4d6afe5719f70bffeb09293208a20dd970299c9..56f03c7da364236b9b1ba7dc43458ac4971b4d0a 100644
--- a/components/metrics/call_stack_profile_metrics_provider.cc
+++ b/components/metrics/call_stack_profile_metrics_provider.cc
@@ -35,13 +35,13 @@ namespace {
// A set of profiles and the CallStackProfileMetricsProvider state associated
// with them.
struct ProfilesState {
- ProfilesState(const CallStackProfileMetricsProvider::Params& params,
+ ProfilesState(const base::CallStackProfileParams& params,
const base::StackSamplingProfiler::CallStackProfiles& profiles,
base::TimeTicks start_timestamp);
// The metrics-related parameters provided to
// CallStackProfileMetricsProvider::GetProfilerCallback().
- CallStackProfileMetricsProvider::Params params;
+ base::CallStackProfileParams params;
// The call stack profiles collected by the profiler.
base::StackSamplingProfiler::CallStackProfiles profiles;
@@ -54,13 +54,10 @@ struct ProfilesState {
};
ProfilesState::ProfilesState(
- const CallStackProfileMetricsProvider::Params& params,
+ const base::CallStackProfileParams& params,
const base::StackSamplingProfiler::CallStackProfiles& profiles,
base::TimeTicks start_timestamp)
- : params(params),
- profiles(profiles),
- start_timestamp(start_timestamp) {
-}
+ : params(params), profiles(profiles), start_timestamp(start_timestamp) {}
// PendingProfiles ------------------------------------------------------------
@@ -186,7 +183,7 @@ PendingProfiles::~PendingProfiles() {}
// Invoked on the profiler's thread. Provides the profiles to PendingProfiles to
// append, if the collecting state allows.
void ReceiveCompletedProfiles(
- const CallStackProfileMetricsProvider::Params& params,
+ const base::CallStackProfileParams& params,
base::TimeTicks start_timestamp,
const StackSamplingProfiler::CallStackProfiles& profiles) {
PendingProfiles::GetInstance()->CollectProfilesIfCollectionEnabled(
@@ -289,18 +286,18 @@ void CopyProfileToProto(
// Translates CallStackProfileMetricsProvider's trigger to the corresponding
// SampledProfile TriggerEvent.
SampledProfile::TriggerEvent ToSampledProfileTriggerEvent(
- CallStackProfileMetricsProvider::Trigger trigger) {
+ base::CallStackProfileParams::Trigger trigger) {
switch (trigger) {
- case CallStackProfileMetricsProvider::UNKNOWN:
+ case base::CallStackProfileParams::UNKNOWN:
return SampledProfile::UNKNOWN_TRIGGER_EVENT;
break;
- case CallStackProfileMetricsProvider::PROCESS_STARTUP:
+ case base::CallStackProfileParams::PROCESS_STARTUP:
return SampledProfile::PROCESS_STARTUP;
break;
- case CallStackProfileMetricsProvider::JANKY_TASK:
+ case base::CallStackProfileParams::JANKY_TASK:
return SampledProfile::JANKY_TASK;
break;
- case CallStackProfileMetricsProvider::THREAD_HUNG:
+ case base::CallStackProfileParams::THREAD_HUNG:
return SampledProfile::THREAD_HUNG;
break;
}
@@ -310,20 +307,6 @@ SampledProfile::TriggerEvent ToSampledProfileTriggerEvent(
} // namespace
-// CallStackProfileMetricsProvider::Params ------------------------------------
-
-CallStackProfileMetricsProvider::Params::Params(
- CallStackProfileMetricsProvider::Trigger trigger)
- : Params(trigger, false) {
-}
-
-CallStackProfileMetricsProvider::Params::Params(
- CallStackProfileMetricsProvider::Trigger trigger,
- bool preserve_sample_ordering)
- : trigger(trigger),
- preserve_sample_ordering(preserve_sample_ordering) {
-}
-
// CallStackProfileMetricsProvider --------------------------------------------
const char CallStackProfileMetricsProvider::kFieldTrialName[] =
@@ -339,7 +322,8 @@ CallStackProfileMetricsProvider::~CallStackProfileMetricsProvider() {
// This function can be invoked on an abitrary thread.
base::StackSamplingProfiler::CompletedCallback
-CallStackProfileMetricsProvider::GetProfilerCallback(const Params& params) {
+CallStackProfileMetricsProvider::GetProfilerCallback(
+ const base::CallStackProfileParams& params) {
// Ignore the profiles if the collection is disabled. If the collection state
// changes while collecting, this will be detected by the callback and
// profiles will be ignored at that point.

Powered by Google App Engine
This is Rietveld 408576698