diff options
author | tedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 22:20:47 +0000 |
---|---|---|
committer | tedvessenes@gmail.com <tedvessenes@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-01-12 22:20:47 +0000 |
commit | 8f8e5c3e2a5f55b904e89afae9eb96a5c62482e1 (patch) | |
tree | a3c8012c194c11bb78969bda6cb4562c9208eb6d /chrome/service | |
parent | a7656c6a53cd7ef64c7a11e6b01b23c7729518be (diff) | |
download | chromium_src-8f8e5c3e2a5f55b904e89afae9eb96a5c62482e1.zip chromium_src-8f8e5c3e2a5f55b904e89afae9eb96a5c62482e1.tar.gz chromium_src-8f8e5c3e2a5f55b904e89afae9eb96a5c62482e1.tar.bz2 |
Convert use of int ms to TimeDelta in files owned by ajwong.
R=ajwong@chromium.org
BUG=108171
TEST=
Review URL: http://codereview.chromium.org/9187023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@117531 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/service')
-rw-r--r-- | chrome/service/cloud_print/cloud_print_auth.cc | 6 | ||||
-rw-r--r-- | chrome/service/cloud_print/cloud_print_proxy_backend.cc | 8 | ||||
-rw-r--r-- | chrome/service/cloud_print/print_system_cups.cc | 29 | ||||
-rw-r--r-- | chrome/service/service_process.cc | 4 |
4 files changed, 24 insertions, 23 deletions
diff --git a/chrome/service/cloud_print/cloud_print_auth.cc b/chrome/service/cloud_print/cloud_print_auth.cc index ac757f6..53e263d 100644 --- a/chrome/service/cloud_print/cloud_print_auth.cc +++ b/chrome/service/cloud_print/cloud_print_auth.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -137,8 +137,8 @@ void CloudPrintAuth::OnRefreshTokenResponse(const std::string& access_token, // Schedule a task to refresh the access token again when it is about to // expire. DCHECK(expires_in_seconds > kTokenRefreshGracePeriodSecs); - int64 refresh_delay = - (expires_in_seconds - kTokenRefreshGracePeriodSecs)*1000; + base::TimeDelta refresh_delay = base::TimeDelta::FromSeconds( + expires_in_seconds - kTokenRefreshGracePeriodSecs); MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&CloudPrintAuth::RefreshAccessToken, this), refresh_delay); diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc index 4b02dd8..21c5c00 100644 --- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc +++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -399,12 +399,12 @@ void CloudPrintProxyBackend::Core::PollForJobs() { void CloudPrintProxyBackend::Core::ScheduleJobPoll() { if (!job_poll_scheduled_) { - int interval_in_seconds = base::RandInt(kMinJobPollIntervalSecs, - kMaxJobPollIntervalSecs); + base::TimeDelta interval = base::TimeDelta::FromSeconds( + base::RandInt(kMinJobPollIntervalSecs, kMaxJobPollIntervalSecs)); MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&CloudPrintProxyBackend::Core::PollForJobs, this), - interval_in_seconds * 1000); + interval); job_poll_scheduled_ = true; } } diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc index 1371a0b..bb4dd56 100644 --- a/chrome/service/cloud_print/print_system_cups.cc +++ b/chrome/service/cloud_print/print_system_cups.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -48,10 +48,11 @@ static const char kCUPSNotifyDelete[] = "notify_delete"; static const int kDefaultIPPServerPort = 631; // Time interval to check for printer's updates. -const int kCheckForPrinterUpdatesMs = 5*60*1000; +const base::TimeDelta kCheckForPrinterUpdates = + base::TimeDelta::FromMinutes(5); // Job update timeout -const int kJobUpdateTimeoutMs = 5000; +const base::TimeDelta kJobUpdateTimeout = base::TimeDelta::FromSeconds(5); // Job id for dry run (it should not affect CUPS job ids, since 0 job-id is // invalid in CUPS. @@ -114,7 +115,7 @@ class PrintSystemCUPS : public PrintSystem { const std::string& printer_name, printing::PrinterCapsAndDefaults* printer_info); - int GetUpdateTimeoutMs() const { + base::TimeDelta GetUpdateTimeout() const { return update_timeout_; } @@ -158,7 +159,7 @@ class PrintSystemCUPS : public PrintSystem { typedef std::list<PrintServerInfoCUPS> PrintServerList; PrintServerList print_servers_; - int update_timeout_; + base::TimeDelta update_timeout_; bool initialized_; bool printer_enum_succeeded_; bool notify_delete_; @@ -183,7 +184,7 @@ class PrintServerWatcherCUPS MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this), - print_system_->GetUpdateTimeoutMs()); + print_system_->GetUpdateTimeout()); return true; } @@ -204,7 +205,7 @@ class PrintServerWatcherCUPS MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this), - print_system_->GetUpdateTimeoutMs()); + print_system_->GetUpdateTimeout()); } private: @@ -258,13 +259,13 @@ class PrinterWatcherCUPS MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this), - kJobUpdateTimeoutMs); + kJobUpdateTimeout); // Schedule next printer check. // TODO(gene): Randomize time for the next printer update. MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this), - print_system_->GetUpdateTimeoutMs()); + print_system_->GetUpdateTimeout()); return true; } @@ -289,7 +290,7 @@ class PrinterWatcherCUPS MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this), - kJobUpdateTimeoutMs); + kJobUpdateTimeout); } void PrinterUpdate() { @@ -311,7 +312,7 @@ class PrinterWatcherCUPS MessageLoop::current()->PostDelayedTask( FROM_HERE, base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this), - print_system_->GetUpdateTimeoutMs()); + print_system_->GetUpdateTimeout()); } private: @@ -389,14 +390,14 @@ class JobSpoolerCUPS : public PrintSystem::JobSpooler { }; PrintSystemCUPS::PrintSystemCUPS(const DictionaryValue* print_system_settings) - : update_timeout_(kCheckForPrinterUpdatesMs), + : update_timeout_(kCheckForPrinterUpdates), initialized_(false), printer_enum_succeeded_(false), notify_delete_(true) { if (print_system_settings) { int timeout; if (print_system_settings->GetInteger(kCUPSUpdateTimeoutMs, &timeout)) - update_timeout_ = timeout; + update_timeout_ = base::TimeDelta::FromMilliseconds(timeout); bool notify_delete = true; if (print_system_settings->GetBoolean(kCUPSNotifyDelete, ¬ify_delete)) @@ -468,7 +469,7 @@ void PrintSystemCUPS::UpdatePrinters() { // Schedule next update. MessageLoop::current()->PostDelayedTask( FROM_HERE, - base::Bind(&PrintSystemCUPS::UpdatePrinters, this), GetUpdateTimeoutMs()); + base::Bind(&PrintSystemCUPS::UpdatePrinters, this), GetUpdateTimeout()); } PrintSystem::PrintSystemResult PrintSystemCUPS::EnumeratePrinters( diff --git a/chrome/service/service_process.cc b/chrome/service/service_process.cc index d2fa127..7a191b6 100644 --- a/chrome/service/service_process.cc +++ b/chrome/service/service_process.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -45,7 +45,7 @@ namespace { // Delay in millseconds after the last service is disabled before we attempt // a shutdown. -const int64 kShutdownDelay = 60000; +const base::TimeDelta kShutdownDelay = base::TimeDelta::FromMinutes(1); const char kDefaultServiceProcessLocale[] = "en-US"; |