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

Unified Diff: net/proxy/multi_threaded_proxy_resolver.cc

Issue 1141573002: [net/proxy] Usage of ThreadTaskRunnerHandle & SingleThreadTaskRunner instead of MLP (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
« no previous file with comments | « no previous file | net/proxy/network_delegate_error_observer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/proxy/multi_threaded_proxy_resolver.cc
diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc
index a579e7964340bfd69452aada7ec4f3029dced585..7c38275a7a1f2391a8a68cfaf8a9b77b46a8680b 100644
--- a/net/proxy/multi_threaded_proxy_resolver.cc
+++ b/net/proxy/multi_threaded_proxy_resolver.cc
@@ -9,10 +9,11 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
-#include "base/message_loop/message_loop_proxy.h"
+#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
+#include "base/thread_task_runner_handle.h"
#include "base/threading/non_thread_safe.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
@@ -201,8 +202,9 @@ class Job : public base::RefCountedThreadSafe<Job> {
// This method is called on the worker thread to do the job's work. On
// completion, implementors are expected to call OnJobCompleted() on
- // |origin_loop|.
- virtual void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) = 0;
+ // |origin_runner|.
+ virtual void Run(
+ scoped_refptr<base::SingleThreadTaskRunner> origin_runner) = 0;
protected:
void OnJobCompleted() {
@@ -242,13 +244,13 @@ class CreateResolverJob : public Job {
factory_(factory) {}
// Runs on the worker thread.
- void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) override {
+ void Run(scoped_refptr<base::SingleThreadTaskRunner> origin_runner) override {
scoped_ptr<ProxyResolverFactory::Request> request;
int rv = factory_->CreateProxyResolver(script_data_, &resolver_,
CompletionCallback(), &request);
DCHECK_NE(rv, ERR_IO_PENDING);
- origin_loop->PostTask(
+ origin_runner->PostTask(
FROM_HERE, base::Bind(&CreateResolverJob::RequestComplete, this, rv));
}
@@ -309,16 +311,15 @@ class MultiThreadedProxyResolver::GetProxyForURLJob : public Job {
}
// Runs on the worker thread.
- void Run(scoped_refptr<base::MessageLoopProxy> origin_loop) override {
+ void Run(scoped_refptr<base::SingleThreadTaskRunner> origin_runner) override {
ProxyResolver* resolver = executor()->resolver();
DCHECK(resolver);
int rv = resolver->GetProxyForURL(
url_, &results_buf_, CompletionCallback(), NULL, net_log_);
DCHECK_NE(rv, ERR_IO_PENDING);
- origin_loop->PostTask(
- FROM_HERE,
- base::Bind(&GetProxyForURLJob::QueryComplete, this, rv));
+ origin_runner->PostTask(
+ FROM_HERE, base::Bind(&GetProxyForURLJob::QueryComplete, this, rv));
}
protected:
@@ -371,7 +372,7 @@ void Executor::StartJob(Job* job) {
job->FinishedWaitingForThread();
thread_->message_loop()->PostTask(
FROM_HERE,
- base::Bind(&Job::Run, job, base::MessageLoopProxy::current()));
+ base::Bind(&Job::Run, job, base::ThreadTaskRunnerHandle::Get()));
}
void Executor::OnJobCompleted(Job* job) {
« no previous file with comments | « no previous file | net/proxy/network_delegate_error_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698