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

Unified Diff: content/browser/browser_thread_impl.cc

Issue 1170623003: Revert "content: Remove use of MessageLoopProxy and deprecated MessageLoop APIs" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « content/browser/browser_shutdown_profile_dumper.cc ('k') | content/browser/browser_thread_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_thread_impl.cc
diff --git a/content/browser/browser_thread_impl.cc b/content/browser/browser_thread_impl.cc
index b0a24ae06c0e135ef1132d93fd954f076fc5b0a8..1aac305bcb8b2a05e247276c36b77c54e9e98c34 100644
--- a/content/browser/browser_thread_impl.cc
+++ b/content/browser/browser_thread_impl.cc
@@ -10,7 +10,8 @@
#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/lazy_instance.h"
-#include "base/single_thread_task_runner.h"
+#include "base/message_loop/message_loop.h"
+#include "base/message_loop/message_loop_proxy.h"
#include "base/threading/sequenced_worker_pool.h"
#include "base/threading/thread_restrictions.h"
#include "content/public/browser/browser_thread_delegate.h"
@@ -36,14 +37,15 @@ static const char* g_browser_thread_names[BrowserThread::ID_COUNT] = {
"Chrome_IOThread", // IO
};
-// An implementation of SingleThreadTaskRunner to be used in conjunction
+// An implementation of MessageLoopProxy to be used in conjunction
// with BrowserThread.
-class BrowserThreadTaskRunner : public base::SingleThreadTaskRunner {
+class BrowserThreadMessageLoopProxy : public base::MessageLoopProxy {
public:
- explicit BrowserThreadTaskRunner(BrowserThread::ID identifier)
- : id_(identifier) {}
+ explicit BrowserThreadMessageLoopProxy(BrowserThread::ID identifier)
+ : id_(identifier) {
+ }
- // SingleThreadTaskRunner implementation.
+ // MessageLoopProxy implementation.
bool PostDelayedTask(const tracked_objects::Location& from_here,
const base::Closure& task,
base::TimeDelta delay) override {
@@ -62,28 +64,28 @@ class BrowserThreadTaskRunner : public base::SingleThreadTaskRunner {
}
protected:
- ~BrowserThreadTaskRunner() override {}
+ ~BrowserThreadMessageLoopProxy() override {}
private:
BrowserThread::ID id_;
- DISALLOW_COPY_AND_ASSIGN(BrowserThreadTaskRunner);
+ DISALLOW_COPY_AND_ASSIGN(BrowserThreadMessageLoopProxy);
};
-// 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() {
+// 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() {
for (int i = 0; i < BrowserThread::ID_COUNT; ++i) {
proxies[i] =
- new BrowserThreadTaskRunner(static_cast<BrowserThread::ID>(i));
+ new BrowserThreadMessageLoopProxy(static_cast<BrowserThread::ID>(i));
}
}
- scoped_refptr<base::SingleThreadTaskRunner> proxies[BrowserThread::ID_COUNT];
+ scoped_refptr<base::MessageLoopProxy> proxies[BrowserThread::ID_COUNT];
};
-base::LazyInstance<BrowserThreadTaskRunners>::Leaky g_task_runners =
- LAZY_INSTANCE_INITIALIZER;
+base::LazyInstance<BrowserThreadProxies>::Leaky
+ g_proxies = LAZY_INSTANCE_INITIALIZER;
struct BrowserThreadGlobals {
BrowserThreadGlobals()
@@ -329,10 +331,9 @@ bool BrowserThreadImpl::PostTaskHelper(
: NULL;
if (message_loop) {
if (nestable) {
- message_loop->task_runner()->PostDelayedTask(from_here, task, delay);
+ message_loop->PostDelayedTask(from_here, task, delay);
} else {
- message_loop->task_runner()->PostNonNestableDelayedTask(from_here, task,
- delay);
+ message_loop->PostNonNestableDelayedTask(from_here, task, delay);
}
}
@@ -516,9 +517,9 @@ bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) {
}
// static
-scoped_refptr<base::SingleThreadTaskRunner>
+scoped_refptr<base::MessageLoopProxy>
BrowserThread::GetMessageLoopProxyForThread(ID identifier) {
- return g_task_runners.Get().proxies[identifier];
+ return g_proxies.Get().proxies[identifier];
}
// static
« no previous file with comments | « content/browser/browser_shutdown_profile_dumper.cc ('k') | content/browser/browser_thread_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698