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(
base::TimeDelta periodic_interval,
TriggerParams resume_from_suspend,
TriggerParams restore_session)
: collection_duration_(collection_duration.ToInternalValue()),
periodic_interval_(periodic_interval.ToInternalValue()),
: collection_duration_(collection_duration),
periodic_interval_(periodic_interval),
resume_from_suspend_(resume_from_suspend),
restore_session_(restore_session) {
}
restore_session_(restore_session) {}
PerfProvider::CollectionParams::TriggerParams::TriggerParams(
int64_t sampling_factor,
base::TimeDelta max_collection_delay)
: sampling_factor_(sampling_factor),
max_collection_delay_(max_collection_delay.ToInternalValue()) {}
max_collection_delay_(max_collection_delay) {}
PerfProvider::PerfProvider()
: login_observer_(this),
......
......@@ -48,8 +48,6 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
PERF_COMMAND_UNSUPPORTED,
};
typedef int64_t TimeDeltaInternalType;
class CollectionParams {
public:
class TriggerParams {
......@@ -61,10 +59,10 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
void set_sampling_factor(int64_t factor) { sampling_factor_ = factor; }
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) {
max_collection_delay_ = delay.ToInternalValue();
max_collection_delay_ = delay;
}
private:
......@@ -75,7 +73,7 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
// Add a random delay before collecting after the trigger.
// The delay should be randomly selected between 0 and this value.
TimeDeltaInternalType max_collection_delay_;
base::TimeDelta max_collection_delay_;
};
CollectionParams();
......@@ -85,18 +83,14 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
TriggerParams resume_from_suspend,
TriggerParams restore_session);
base::TimeDelta collection_duration() const {
return base::TimeDelta::FromInternalValue(collection_duration_);
}
base::TimeDelta collection_duration() const { return collection_duration_; }
void set_collection_duration(base::TimeDelta duration) {
collection_duration_ = duration.ToInternalValue();
collection_duration_ = duration;
}
base::TimeDelta periodic_interval() const {
return base::TimeDelta::FromInternalValue(periodic_interval_);
}
base::TimeDelta periodic_interval() const { return periodic_interval_; }
void set_periodic_interval(base::TimeDelta interval) {
periodic_interval_ = interval.ToInternalValue();
periodic_interval_ = interval;
}
const TriggerParams& resume_from_suspend() const {
......@@ -114,12 +108,12 @@ class PerfProvider : public chromeos::PowerManagerClient::Observer {
private:
// Time perf is run for.
TimeDeltaInternalType collection_duration_;
base::TimeDelta collection_duration_;
// For PERIODIC_COLLECTION, partition time since login into successive
// intervals of this duration. In each interval, a random time is picked to
// collect a profile.
TimeDeltaInternalType periodic_interval_;
base::TimeDelta periodic_interval_;
// Parameters for RESUME_FROM_SUSPEND and RESTORE_SESSION collections:
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