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

Unified Diff: chrome/browser/chromeos/drive/job_scheduler.cc

Issue 1124813003: [chrome/browser/chromeos/drive] Avoid use of MessageLoopProxy by use of TTRH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
Index: chrome/browser/chromeos/drive/job_scheduler.cc
diff --git a/chrome/browser/chromeos/drive/job_scheduler.cc b/chrome/browser/chromeos/drive/job_scheduler.cc
index d55b02dfd73af5f67ac6078c3a552d01bb3dd8b8..fb1777d5e23ce67d4ad2b0fa41f8310c7115417d 100644
--- a/chrome/browser/chromeos/drive/job_scheduler.cc
+++ b/chrome/browser/chromeos/drive/job_scheduler.cc
@@ -5,12 +5,12 @@
#include "chrome/browser/chromeos/drive/job_scheduler.h"
#include "base/files/file_util.h"
-#include "base/message_loop/message_loop.h"
#include "base/metrics/histogram.h"
#include "base/prefs/pref_service.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
+#include "base/thread_task_runner_handle.h"
#include "chrome/browser/drive/event_logger.h"
#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
@@ -784,11 +784,9 @@ void JobScheduler::DoJobLoop(QueueType queue_type) {
// Wait when throttled.
const base::Time now = base::Time::Now();
if (now < wait_until_) {
- base::MessageLoopProxy::current()->PostDelayedTask(
- FROM_HERE,
- base::Bind(&JobScheduler::DoJobLoop,
- weak_ptr_factory_.GetWeakPtr(),
- queue_type),
+ base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
+ FROM_HERE, base::Bind(&JobScheduler::DoJobLoop,
+ weak_ptr_factory_.GetWeakPtr(), queue_type),
wait_until_ - now);
return;
}
@@ -907,10 +905,9 @@ bool JobScheduler::OnJobDone(JobID job_id,
// Post a task to continue the job loop. This allows us to finish handling
// the current job before starting the next one.
- base::MessageLoopProxy::current()->PostTask(FROM_HERE,
- base::Bind(&JobScheduler::DoJobLoop,
- weak_ptr_factory_.GetWeakPtr(),
- queue_type));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(
+ FROM_HERE, base::Bind(&JobScheduler::DoJobLoop,
+ weak_ptr_factory_.GetWeakPtr(), queue_type));
return !should_retry;
}
@@ -1138,8 +1135,8 @@ void JobScheduler::AbortNotRunningJob(JobEntry* job,
queue_[GetJobQueueType(job->job_info.job_type)]->Remove(job->job_info.job_id);
NotifyJobDone(job->job_info, error);
job_map_.Remove(job->job_info.job_id);
- base::MessageLoopProxy::current()->PostTask(FROM_HERE,
- base::Bind(callback, error));
+ base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
+ base::Bind(callback, error));
}
void JobScheduler::NotifyJobAdded(const JobInfo& job_info) {

Powered by Google App Engine
This is Rietveld 408576698