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

Unified Diff: chrome/service/cloud_print/print_system_cups.cc

Issue 9187023: Convert use of int ms to TimeDelta in files owned by ajwong. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove static class instance initialization. Created 8 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy_backend.cc ('k') | chrome/service/service_process.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/service/cloud_print/print_system_cups.cc
diff --git a/chrome/service/cloud_print/print_system_cups.cc b/chrome/service/cloud_print/print_system_cups.cc
index 1371a0b3b27930eb68e8caf2303970dd9cd38bed..cad0d3d512e12acf6821694f7b07ede619f0c929 100644
--- a/chrome/service/cloud_print/print_system_cups.cc
+++ b/chrome/service/cloud_print/print_system_cups.cc
@@ -48,10 +48,10 @@ 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 int kCheckForPrinterUpdatesMinutes = 5;
// Job update timeout
-const int kJobUpdateTimeoutMs = 5000;
+const int kJobUpdateTimeoutSeconds = 5;
// Job id for dry run (it should not affect CUPS job ids, since 0 job-id is
// invalid in CUPS.
@@ -114,7 +114,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 +158,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 +183,7 @@ class PrintServerWatcherCUPS
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this),
- print_system_->GetUpdateTimeoutMs());
+ print_system_->GetUpdateTimeout());
return true;
}
@@ -204,7 +204,7 @@ class PrintServerWatcherCUPS
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&PrintServerWatcherCUPS::CheckForUpdates, this),
- print_system_->GetUpdateTimeoutMs());
+ print_system_->GetUpdateTimeout());
}
private:
@@ -258,13 +258,13 @@ class PrinterWatcherCUPS
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this),
- kJobUpdateTimeoutMs);
+ base::TimeDelta::FromSeconds(kJobUpdateTimeoutSeconds));
// 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 +289,7 @@ class PrinterWatcherCUPS
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&PrinterWatcherCUPS::JobStatusUpdate, this),
- kJobUpdateTimeoutMs);
+ base::TimeDelta::FromSeconds(kJobUpdateTimeoutSeconds));
}
void PrinterUpdate() {
@@ -311,7 +311,7 @@ class PrinterWatcherCUPS
MessageLoop::current()->PostDelayedTask(
FROM_HERE,
base::Bind(&PrinterWatcherCUPS::PrinterUpdate, this),
- print_system_->GetUpdateTimeoutMs());
+ print_system_->GetUpdateTimeout());
}
private:
@@ -389,14 +389,15 @@ class JobSpoolerCUPS : public PrintSystem::JobSpooler {
};
PrintSystemCUPS::PrintSystemCUPS(const DictionaryValue* print_system_settings)
- : update_timeout_(kCheckForPrinterUpdatesMs),
+ : update_timeout_(base::TimeDelta::FromMinutes(
+ kCheckForPrinterUpdatesMinutes)),
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, &notify_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(
« no previous file with comments | « chrome/service/cloud_print/cloud_print_proxy_backend.cc ('k') | chrome/service/service_process.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698