Chromium Code Reviews| Index: content/browser/browser_thread_impl.cc |
| diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc |
| index 1aac305bcb8b2a05e247276c36b77c54e9e98c34..b0a24ae06c0e135ef1132d93fd954f076fc5b0a8 100644 |
| --- a/content/browser/browser_thread_impl.cc |
| +++ b/content/browser/browser_thread_impl.cc |
| @@ -10,8 +10,7 @@ |
| #include "base/bind.h" |
| #include "base/compiler_specific.h" |
| #include "base/lazy_instance.h" |
| -#include "base/message_loop/message_loop.h" |
| -#include "base/message_loop/message_loop_proxy.h" |
| +#include "base/single_thread_task_runner.h" |
| #include "base/threading/sequenced_worker_pool.h" |
| #include "base/threading/thread_restrictions.h" |
| #include "content/public/browser/browser_thread_delegate.h" |
| @@ -37,15 +36,14 @@ static const char* g_browser_thread_names[BrowserThread::ID_COUNT] = { |
| "Chrome_IOThread", // IO |
| }; |
| -// An implementation of MessageLoopProxy to be used in conjunction |
| +// An implementation of SingleThreadTaskRunner to be used in conjunction |
| // with BrowserThread. |
| -class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy { |
| +class BrowserThreadTaskRunner : public base::SingleThreadTaskRunner { |
|
no sievers
2015/06/01 23:30:47
Not that your patch is affecting that in any way -
Sami
2015/06/03 14:55:21
I was wondering about that too. I thought maybe so
|
| public: |
| - explicit BrowserThreadMessageLoopProxy(BrowserThread::ID identifier) |
| - : id_(identifier) { |
| - } |
| + explicit BrowserThreadTaskRunner(BrowserThread::ID identifier) |
| + : id_(identifier) {} |
| - // MessageLoopProxy implementation. |
| + // SingleThreadTaskRunner implementation. |
| bool PostDelayedTask(const tracked_objects::Location& from_here, |
| const base::Closure& task, |
| base::TimeDelta delay) override { |
| @@ -64,28 +62,28 @@ class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy { |
| } |
| protected: |
| - ~BrowserThreadMessageLoopProxy() override {} |
| + ~BrowserThreadTaskRunner() override {} |
| private: |
| BrowserThread::ID id_; |
| - DISALLOW_COPY_AND_ASSIGN(BrowserThreadMessageLoopProxy); |
| + DISALLOW_COPY_AND_ASSIGN(BrowserThreadTaskRunner); |
| }; |
| -// A separate helper is used just for the proxies, in order to avoid needing |
| -// to initialize the globals to create a proxy. |
| -struct BrowserThreadProxies { |
| - BrowserThreadProxies() { |
| +// A separate helper is used just for the task runners, in order to avoid |
| +// needing to initialize the globals to create a task runner. |
| +struct BrowserThreadTaskRunners { |
| + BrowserThreadTaskRunners() { |
| for (int i = 0; i < BrowserThread::ID_COUNT; ++i) { |
| proxies[i] = |
| - new BrowserThreadMessageLoopProxy(static_cast<BrowserThread::ID>(i)); |
| + new BrowserThreadTaskRunner(static_cast<BrowserThread::ID>(i)); |
| } |
| } |
| - scoped_refptr<base::MessageLoopProxy> proxies[BrowserThread::ID_COUNT]; |
| + scoped_refptr<base::SingleThreadTaskRunner> proxies[BrowserThread::ID_COUNT]; |
| }; |
| -base::LazyInstance<BrowserThreadProxies>::Leaky |
| - g_proxies = LAZY_INSTANCE_INITIALIZER; |
| +base::LazyInstance<BrowserThreadTaskRunners>::Leaky g_task_runners = |
| + LAZY_INSTANCE_INITIALIZER; |
| struct BrowserThreadGlobals { |
| BrowserThreadGlobals() |
| @@ -331,9 +329,10 @@ bool BrowserThreadImpl::PostTaskHelper( |
| : NULL; |
| if (message_loop) { |
| if (nestable) { |
| - message_loop->PostDelayedTask(from_here, task, delay); |
| + message_loop->task_runner()->PostDelayedTask(from_here, task, delay); |
| } else { |
| - message_loop->PostNonNestableDelayedTask(from_here, task, delay); |
| + message_loop->task_runner()->PostNonNestableDelayedTask(from_here, task, |
| + delay); |
| } |
| } |
| @@ -517,9 +516,9 @@ bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { |
| } |
| // static |
| -scoped_refptr<base::MessageLoopProxy> |
| +scoped_refptr<base::SingleThreadTaskRunner> |
| BrowserThread::GetMessageLoopProxyForThread(ID identifier) { |
| - return g_proxies.Get().proxies[identifier]; |
| + return g_task_runners.Get().proxies[identifier]; |
| } |
| // static |