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

Side by Side Diff: components/domain_reliability/util.cc

Issue 2837863004: Use base::OneShotTimer instead of base::Timer(false, false)
Patch Set: rebase Created 3 years, 7 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 unified diff | Download patch
« no previous file with comments | « components/cryptauth/sync_scheduler_impl.cc ('k') | components/drive/file_write_watcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include "components/domain_reliability/util.h" 5 #include "components/domain_reliability/util.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 replacements.SetPathStr(*longest_path_prefix); 198 replacements.SetPathStr(*longest_path_prefix);
199 replacements.ClearQuery(); 199 replacements.ClearQuery();
200 replacements.ClearRef(); 200 replacements.ClearRef();
201 return beacon_url.ReplaceComponents(replacements); 201 return beacon_url.ReplaceComponents(replacements);
202 } 202 }
203 203
204 namespace { 204 namespace {
205 205
206 class ActualTimer : public MockableTime::Timer { 206 class ActualTimer : public MockableTime::Timer {
207 public: 207 public:
208 // Initialize base timer with retain_user_info and is_repeating false. 208 ActualTimer() {}
209 ActualTimer() : base_timer_(false, false) {}
210 209
211 ~ActualTimer() override {} 210 ~ActualTimer() override {}
212 211
213 // MockableTime::Timer implementation: 212 // MockableTime::Timer implementation:
214 void Start(const tracked_objects::Location& posted_from, 213 void Start(const tracked_objects::Location& posted_from,
215 base::TimeDelta delay, 214 base::TimeDelta delay,
216 const base::Closure& user_task) override { 215 const base::Closure& user_task) override {
217 base_timer_.Start(posted_from, delay, user_task); 216 base_timer_.Start(posted_from, delay, user_task);
218 } 217 }
219 218
220 void Stop() override { base_timer_.Stop(); } 219 void Stop() override { base_timer_.Stop(); }
221 220
222 bool IsRunning() override { return base_timer_.IsRunning(); } 221 bool IsRunning() override { return base_timer_.IsRunning(); }
223 222
224 private: 223 private:
225 base::Timer base_timer_; 224 base::OneShotTimer base_timer_;
226 }; 225 };
227 226
228 } // namespace 227 } // namespace
229 228
230 MockableTime::Timer::~Timer() {} 229 MockableTime::Timer::~Timer() {}
231 MockableTime::Timer::Timer() {} 230 MockableTime::Timer::Timer() {}
232 231
233 MockableTime::~MockableTime() {} 232 MockableTime::~MockableTime() {}
234 MockableTime::MockableTime() {} 233 MockableTime::MockableTime() {}
235 234
236 ActualTime::ActualTime() {} 235 ActualTime::ActualTime() {}
237 ActualTime::~ActualTime() {} 236 ActualTime::~ActualTime() {}
238 237
239 base::Time ActualTime::Now() { return base::Time::Now(); } 238 base::Time ActualTime::Now() { return base::Time::Now(); }
240 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); } 239 base::TimeTicks ActualTime::NowTicks() { return base::TimeTicks::Now(); }
241 240
242 std::unique_ptr<MockableTime::Timer> ActualTime::CreateTimer() { 241 std::unique_ptr<MockableTime::Timer> ActualTime::CreateTimer() {
243 return std::unique_ptr<MockableTime::Timer>(new ActualTimer()); 242 return std::unique_ptr<MockableTime::Timer>(new ActualTimer());
244 } 243 }
245 244
246 } // namespace domain_reliability 245 } // namespace domain_reliability
OLDNEW
« no previous file with comments | « components/cryptauth/sync_scheduler_impl.cc ('k') | components/drive/file_write_watcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698