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

Side by Side Diff: chrome/browser/upgrade_detector_impl.cc

Issue 500623002: Use TimeTicks::Now() instead of Time::Now() in upgrade detector. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix type. Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/upgrade_detector_impl.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/upgrade_detector_impl.h" 5 #include "chrome/browser/upgrade_detector_impl.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/build_time.h" 10 #include "base/build_time.h"
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()), 352 base::TimeDelta::FromMilliseconds(GetCheckForUpgradeEveryMs()),
353 this, &UpgradeDetectorImpl::CheckForUpgrade); 353 this, &UpgradeDetectorImpl::CheckForUpgrade);
354 } 354 }
355 355
356 void UpgradeDetectorImpl::StartUpgradeNotificationTimer() { 356 void UpgradeDetectorImpl::StartUpgradeNotificationTimer() {
357 // The timer may already be running (e.g. due to both a software upgrade and 357 // The timer may already be running (e.g. due to both a software upgrade and
358 // experiment updates being available). 358 // experiment updates being available).
359 if (upgrade_notification_timer_.IsRunning()) 359 if (upgrade_notification_timer_.IsRunning())
360 return; 360 return;
361 361
362 upgrade_detected_time_ = base::Time::Now(); 362 upgrade_detected_time_ = base::TimeTicks::Now();
363 363
364 // Start the repeating timer for notifying the user after a certain period. 364 // Start the repeating timer for notifying the user after a certain period.
365 // The called function will eventually figure out that enough time has passed 365 // The called function will eventually figure out that enough time has passed
366 // and stop the timer. 366 // and stop the timer.
367 const int cycle_time_ms = IsTesting() ? 367 const int cycle_time_ms = IsTesting() ?
368 kNotifyCycleTimeForTestingMs : kNotifyCycleTimeMs; 368 kNotifyCycleTimeForTestingMs : kNotifyCycleTimeMs;
369 upgrade_notification_timer_.Start(FROM_HERE, 369 upgrade_notification_timer_.Start(FROM_HERE,
370 base::TimeDelta::FromMilliseconds(cycle_time_ms), 370 base::TimeDelta::FromMilliseconds(cycle_time_ms),
371 this, &UpgradeDetectorImpl::NotifyOnUpgrade); 371 this, &UpgradeDetectorImpl::NotifyOnUpgrade);
372 } 372 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 } else { 505 } else {
506 return; // Not ready to recommend upgrade. 506 return; // Not ready to recommend upgrade.
507 } 507 }
508 } 508 }
509 509
510 NotifyUpgradeRecommended(); 510 NotifyUpgradeRecommended();
511 } 511 }
512 512
513 void UpgradeDetectorImpl::NotifyOnUpgrade() { 513 void UpgradeDetectorImpl::NotifyOnUpgrade() {
514 const base::TimeDelta time_passed = 514 const base::TimeDelta time_passed =
515 base::Time::Now() - upgrade_detected_time_; 515 base::TimeTicks::Now() - upgrade_detected_time_;
516 NotifyOnUpgradeWithTimePassed(time_passed); 516 NotifyOnUpgradeWithTimePassed(time_passed);
517 } 517 }
518 518
519 // static 519 // static
520 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() { 520 UpgradeDetectorImpl* UpgradeDetectorImpl::GetInstance() {
521 return Singleton<UpgradeDetectorImpl>::get(); 521 return Singleton<UpgradeDetectorImpl>::get();
522 } 522 }
523 523
524 // static 524 // static
525 UpgradeDetector* UpgradeDetector::GetInstance() { 525 UpgradeDetector* UpgradeDetector::GetInstance() {
526 return UpgradeDetectorImpl::GetInstance(); 526 return UpgradeDetectorImpl::GetInstance();
527 } 527 }
OLDNEW
« no previous file with comments | « chrome/browser/upgrade_detector_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698