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

Unified Diff: components/nacl/loader/nacl_listener.cc

Issue 2087583002: Remove calls to MessageLoop::current() in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix test error 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 | « components/nacl/loader/nacl_listener.h ('k') | components/policy/core/browser/browser_policy_connector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/nacl/loader/nacl_listener.cc
diff --git a/components/nacl/loader/nacl_listener.cc b/components/nacl/loader/nacl_listener.cc
index 146b855f2e10ab64adb441de7b9c30779308a84c..66f967178fe7f22a84aba89258dcc6f483a11955 100644
--- a/components/nacl/loader/nacl_listener.cc
+++ b/components/nacl/loader/nacl_listener.cc
@@ -19,7 +19,9 @@
#include "base/command_line.h"
#include "base/logging.h"
#include "base/rand_util.h"
+#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
+#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "components/nacl/common/nacl_messages.h"
#include "components/nacl/common/nacl_renderer_messages.h"
@@ -165,7 +167,6 @@ NaClListener::NaClListener()
#if defined(OS_POSIX)
number_of_cores_(-1), // unknown/error
#endif
- main_loop_(NULL),
is_started_(false) {
IPC::AttachmentBrokerUnprivileged::CreateBrokerIfNeeded();
io_thread_.StartWithOptions(
@@ -181,8 +182,8 @@ NaClListener::~NaClListener() {
}
bool NaClListener::Send(IPC::Message* msg) {
- DCHECK(main_loop_ != NULL);
- if (base::MessageLoop::current() == main_loop_) {
+ DCHECK(!!main_task_runner_);
+ if (main_task_runner_->BelongsToCurrentThread()) {
// This thread owns the channel.
return channel_->Send(msg);
} else {
@@ -231,7 +232,7 @@ void NaClListener::Listen() {
if (global && !global->IsPrivilegedBroker())
global->RegisterBrokerCommunicationChannel(channel_.get());
channel_->Init(channel_name, IPC::Channel::MODE_CLIENT, true);
- main_loop_ = base::MessageLoop::current();
+ main_task_runner_ = base::ThreadTaskRunnerHandle::Get();
base::RunLoop().Run();
}
« no previous file with comments | « components/nacl/loader/nacl_listener.h ('k') | components/policy/core/browser/browser_policy_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698