diff options
author | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-03 18:18:14 +0000 |
---|---|---|
committer | darin@google.com <darin@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-09-03 18:18:14 +0000 |
commit | 2d31666a58e746b7a1d415c99e5f68ad9256d236 (patch) | |
tree | 144c99d4b80df0f0f9a3ded83f9d21a8b36f17cc /chrome/browser/printing/print_job.cc | |
parent | 90d6958fe2374a00d3c8583cf4d3b8a509ae8e90 (diff) | |
download | chromium_src-2d31666a58e746b7a1d415c99e5f68ad9256d236.zip chromium_src-2d31666a58e746b7a1d415c99e5f68ad9256d236.tar.gz chromium_src-2d31666a58e746b7a1d415c99e5f68ad9256d236.tar.bz2 |
Minor cleanup to OneShotTimer and RepeatingTimer: moves more of the member variables into the Task subclass.
Also included in this change: deprecate MessageLoop::timer_manager(), and change consumers over to use OneShotTimer or RepeatingTimer.
R=beng
BUG=1346553
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing/print_job.cc')
-rw-r--r-- | chrome/browser/printing/print_job.cc | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/chrome/browser/printing/print_job.cc b/chrome/browser/printing/print_job.cc index decd853..b1e2bdc 100644 --- a/chrome/browser/printing/print_job.cc +++ b/chrome/browser/printing/print_job.cc @@ -267,18 +267,14 @@ bool PrintJob::FlushJob(int timeout_ms) { // Make sure the object outlive this message loop. scoped_refptr<PrintJob> handle(this); - MessageLoop::QuitTask timeout_task; - scoped_ptr<Timer> timeout; - if (timeout_ms) { - timeout.reset(MessageLoop::current()->timer_manager()->StartTimer( - timeout_ms, - &timeout_task, - false)); - } - // Stop() will eventually be called, which will get out of the inner message // loop. But, don't take it for granted and set a timer in case something goes // wrong. + base::OneShotTimer<MessageLoop> quit_task; + if (timeout_ms) { + quit_task.Start(TimeDelta::FromMilliseconds(timeout_ms), + MessageLoop::current(), &MessageLoop::Quit); + } bool old_state = MessageLoop::current()->NestableTasksAllowed(); MessageLoop::current()->SetNestableTasksAllowed(true); @@ -286,9 +282,6 @@ bool PrintJob::FlushJob(int timeout_ms) { // Restore task state. MessageLoop::current()->SetNestableTasksAllowed(old_state); - if (timeout.get()) { - MessageLoop::current()->timer_manager()->StopTimer(timeout.get()); - } return true; } |