summaryrefslogtreecommitdiffstats
path: root/chrome/service
diff options
context:
space:
mode:
authorjam <jam@chromium.org>2015-09-28 19:26:18 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-29 02:27:37 +0000
commit7fab108c80ea62d1c0c3502345e70db75973a4bb (patch)
tree862a315f394891cfe5cbab8e85b53d43cc7a5165 /chrome/service
parente4da87517db5b2dab98207f7c4b3049a6b7e44a8 (diff)
downloadchromium_src-7fab108c80ea62d1c0c3502345e70db75973a4bb.zip
chromium_src-7fab108c80ea62d1c0c3502345e70db75973a4bb.tar.gz
chromium_src-7fab108c80ea62d1c0c3502345e70db75973a4bb.tar.bz2
Extend base::win::ObjectWatcher to watch an event multiple times.
This is split off from https://codereview.chromium.org/1350023003/. During performance testing, it was found that it was 5x faster to watch an auto-reset event once instead of a manual-reset event every time it fired. BUG=478251 Review URL: https://codereview.chromium.org/1366093006 Cr-Commit-Position: refs/heads/master@{#351240}
Diffstat (limited to 'chrome/service')
-rw-r--r--chrome/service/cloud_print/print_system_win.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/service/cloud_print/print_system_win.cc b/chrome/service/cloud_print/print_system_win.cc
index e4a6262..26c56263 100644
--- a/chrome/service/cloud_print/print_system_win.cc
+++ b/chrome/service/cloud_print/print_system_win.cc
@@ -68,7 +68,7 @@ class PrintSystemWatcherWin : public base::win::ObjectWatcher::Delegate {
printer_change_.Set(FindFirstPrinterChangeNotification(
printer_.Get(), PRINTER_CHANGE_PRINTER|PRINTER_CHANGE_JOB, 0, NULL));
if (printer_change_.IsValid()) {
- ret = watcher_.StartWatching(printer_change_.Get(), this);
+ ret = watcher_.StartWatchingOnce(printer_change_.Get(), this);
}
}
if (!ret) {
@@ -106,7 +106,7 @@ class PrintSystemWatcherWin : public base::win::ObjectWatcher::Delegate {
delegate_->OnJobChanged();
}
}
- watcher_.StartWatching(printer_change_.Get(), this);
+ watcher_.StartWatchingOnce(printer_change_.Get(), this);
}
bool GetCurrentPrinterInfo(printing::PrinterBasicInfo* printer_info) {
@@ -361,7 +361,8 @@ class JobSpoolerWin : public PrintSystem::JobSpooler {
delegate_->OnJobSpoolSucceeded(job_status.jobId);
} else {
job_progress_watcher_.StopWatching();
- job_progress_watcher_.StartWatching(job_progress_event_.Get(), this);
+ job_progress_watcher_.StartWatchingOnce(
+ job_progress_event_.Get(), this);
}
}
@@ -483,7 +484,8 @@ class JobSpoolerWin : public PrintSystem::JobSpooler {
if (FAILED(doc_stream->Close()))
return false;
- job_progress_watcher_.StartWatching(job_progress_event_.Get(), this);
+ job_progress_watcher_.StartWatchingOnce(
+ job_progress_event_.Get(), this);
job_canceler.reset();
return true;
}