Commit e5e23f0b authored by Gabriel Marin's avatar Gabriel Marin Committed by Commit Bot

PerfProvider: Remove conversion to TimeDeltaInternalType

Store base::TimeDeltas directly instead of converting to and from
TimeDeltaInternalType. This removes the use of To/FromInternalValue,
which are deprecated. No logic changes.

BUG=634507,b:116527691
TEST=Unit tests pass.

Change-Id: I7fe53e4c418651ff88da2a123c1ab943a590679b
Reviewed-on: https://chromium-review.googlesource.com/c/1340604Reviewed-by: default avatarIlya Sherman <isherman@chromium.org>
Commit-Queue: Gabriel Marin <gmx@chromium.org>
Cr-Commit-Position: refs/heads/master@{#609432}
parent 2f3cca90
...@@ -332,17 +332,16 @@ PerfProvider::CollectionParams::CollectionParams( ...@@ -332,17 +332,16 @@ PerfProvider::CollectionParams::CollectionParams(
base::TimeDelta periodic_interval, base::TimeDelta periodic_interval,
TriggerParams resume_from_suspend, TriggerParams resume_from_suspend,
TriggerParams restore_session) TriggerParams restore_session)
: collection_duration_(collection_duration.ToInternalValue()), : collection_duration_(collection_duration),
periodic_interval_(periodic_interval.ToInternalValue()), periodic_interval_(periodic_interval),
resume_from_suspend_(resume_from_suspend), resume_from_suspend_(resume_from_suspend),
restore_session_(restore_session) { restore_session_(restore_session) {}
}
PerfProvider::CollectionParams::TriggerParams::TriggerParams( PerfProvider::CollectionParams::TriggerParams::TriggerParams(
int64_t sampling_factor, int64_t sampling_factor,
base::TimeDelta max_collection_delay) base::TimeDelta max_collection_delay)
: sampling_factor_(sampling_factor), : sampling_factor_(sampling_factor),
max_collection_delay_(max_collection_delay.ToInternalValue()) {} max_collection_delay_(max_collection_delay) {}
PerfProvider::PerfProvider() PerfProvider::PerfProvider()
: login_observer_(this), : login_observer_(this),
......
...@@ -48,8 +48,6 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer { ...@@ -48,8 +48,6 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
PERF_COMMAND_UNSUPPORTED, PERF_COMMAND_UNSUPPORTED,
}; };
typedef int64_t TimeDeltaInternalType;
class CollectionParams { class CollectionParams {
public: public:
class TriggerParams { class TriggerParams {
...@@ -61,10 +59,10 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer { ...@@ -61,10 +59,10 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
void set_sampling_factor(int64_t factor) { sampling_factor_ = factor; } void set_sampling_factor(int64_t factor) { sampling_factor_ = factor; }
base::TimeDelta max_collection_delay() const { base::TimeDelta max_collection_delay() const {
return base::TimeDelta::FromInternalValue(max_collection_delay_); return max_collection_delay_;
} }
void set_max_collection_delay(base::TimeDelta delay) { void set_max_collection_delay(base::TimeDelta delay) {
max_collection_delay_ = delay.ToInternalValue(); max_collection_delay_ = delay;
} }
private: private:
...@@ -75,7 +73,7 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer { ...@@ -75,7 +73,7 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
// Add a random delay before collecting after the trigger. // Add a random delay before collecting after the trigger.
// The delay should be randomly selected between 0 and this value. // The delay should be randomly selected between 0 and this value.
TimeDeltaInternalType max_collection_delay_; base::TimeDelta max_collection_delay_;
}; };
CollectionParams(); CollectionParams();
...@@ -85,18 +83,14 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer { ...@@ -85,18 +83,14 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
TriggerParams resume_from_suspend, TriggerParams resume_from_suspend,
TriggerParams restore_session); TriggerParams restore_session);
base::TimeDelta collection_duration() const { base::TimeDelta collection_duration() const { return collection_duration_; }
return base::TimeDelta::FromInternalValue(collection_duration_);
}
void set_collection_duration(base::TimeDelta duration) { void set_collection_duration(base::TimeDelta duration) {
collection_duration_ = duration.ToInternalValue(); collection_duration_ = duration;
} }
base::TimeDelta periodic_interval() const { base::TimeDelta periodic_interval() const { return periodic_interval_; }
return base::TimeDelta::FromInternalValue(periodic_interval_);
}
void set_periodic_interval(base::TimeDelta interval) { void set_periodic_interval(base::TimeDelta interval) {
periodic_interval_ = interval.ToInternalValue(); periodic_interval_ = interval;
} }
const TriggerParams& resume_from_suspend() const { const TriggerParams& resume_from_suspend() const {
...@@ -114,12 +108,12 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer { ...@@ -114,12 +108,12 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
private: private:
// Time perf is run for. // Time perf is run for.
TimeDeltaInternalType collection_duration_; base::TimeDelta collection_duration_;
// For PERIODIC_COLLECTION, partition time since login into successive // For PERIODIC_COLLECTION, partition time since login into successive
// intervals of this duration. In each interval, a random time is picked to // intervals of this duration. In each interval, a random time is picked to
// collect a profile. // collect a profile.
TimeDeltaInternalType periodic_interval_; base::TimeDelta periodic_interval_;
// Parameters for RESUME_FROM_SUSPEND and RESTORE_SESSION collections: // Parameters for RESUME_FROM_SUSPEND and RESTORE_SESSION collections:
TriggerParams resume_from_suspend_; TriggerParams resume_from_suspend_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment