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

Unified Diff: services/shell/background/background_shell.cc

Issue 2082513004: Remove calls to MessageLoop::current() in services. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: self-review Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/shell/background/background_shell.cc
diff --git a/services/shell/background/background_shell.cc b/services/shell/background/background_shell.cc
index bed732b068f1bdf26074cfec54c02512ace79e4a..57b544c3e81d9076daf8fd5b973e601f7942d713 100644
--- a/services/shell/background/background_shell.cc
+++ b/services/shell/background/background_shell.cc
@@ -11,6 +11,7 @@
#include "base/memory/ptr_util.h"
#include "base/message_loop/message_pump_default.h"
#include "base/path_service.h"
+#include "base/single_thread_task_runner.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/simple_thread.h"
#include "services/catalog/store.h"
@@ -55,7 +56,7 @@ class BackgroundShell::MojoThread : public base::SimpleThread {
const std::string& name,
mojom::ShellClientRequest* request) {
// Only valid to call this on the background thread.
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
*request = context_->shell()->InitInstanceForEmbedder(name);
signal->Signal();
}
@@ -75,7 +76,7 @@ class BackgroundShell::MojoThread : public base::SimpleThread {
}
void RunShellCallback(const BackgroundShell::ShellThreadCallback& callback) {
- DCHECK_EQ(message_loop_, base::MessageLoop::current());
+ DCHECK(message_loop_->task_runner()->BelongsToCurrentThread());
callback.Run(context_->shell());
}
@@ -154,14 +155,14 @@ mojom::ShellClientRequest BackgroundShell::CreateShellClientRequest(
base::WaitableEvent signal(base::WaitableEvent::ResetPolicy::MANUAL,
base::WaitableEvent::InitialState::NOT_SIGNALED);
thread_->message_loop()->task_runner()->PostTask(
- FROM_HERE, base::Bind(&MojoThread::CreateShellClientRequest,
- base::Unretained(thread_.get()), &signal, name,
- &request));
+ FROM_HERE,
+ base::Bind(&MojoThread::CreateShellClientRequest,
+ base::Unretained(thread_.get()), &signal, name, &request));
signal.Wait();
thread_->message_loop()->task_runner()->PostTask(
- FROM_HERE, base::Bind(&MojoThread::Connect,
- base::Unretained(thread_.get()),
- base::Passed(&params)));
+ FROM_HERE,
+ base::Bind(&MojoThread::Connect, base::Unretained(thread_.get()),
+ base::Passed(&params)));
return request;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698