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

Unified Diff: remoting/host/plugin/host_script_object.cc

Issue 8495024: Access ChromotingHost::clients_ only on network thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month 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
Index: remoting/host/plugin/host_script_object.cc
diff --git a/remoting/host/plugin/host_script_object.cc b/remoting/host/plugin/host_script_object.cc
index 1838cf0f9f0fdd022bf1efd2ec905569655e9d6c..a40b605361dcc0c4cfc53a3df0e1bdc7a608d6fe 100644
--- a/remoting/host/plugin/host_script_object.cc
+++ b/remoting/host/plugin/host_script_object.cc
@@ -351,7 +351,12 @@ void HostNPScriptObject::OnAccessDenied() {
}
void HostNPScriptObject::OnClientAuthenticated(const std::string& jid) {
- DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop());
+ if (MessageLoop::current() != host_context_.main_message_loop()) {
+ host_context_.main_message_loop()->PostTask(FROM_HERE, base::Bind(
+ &HostNPScriptObject::OnClientAuthenticated,
+ base::Unretained(this), jid));
+ return;
+ }
if (state_ == kDisconnecting) {
// Ignore the new connection if we are disconnecting.
@@ -367,7 +372,12 @@ void HostNPScriptObject::OnClientAuthenticated(const std::string& jid) {
}
void HostNPScriptObject::OnClientDisconnected(const std::string& jid) {
- DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop());
+ if (MessageLoop::current() != host_context_.main_message_loop()) {
+ host_context_.main_message_loop()->PostTask(FROM_HERE, base::Bind(
+ &HostNPScriptObject::OnClientDisconnected,
+ base::Unretained(this), jid));
+ return;
+ }
client_username_.clear();
@@ -376,7 +386,11 @@ void HostNPScriptObject::OnClientDisconnected(const std::string& jid) {
}
void HostNPScriptObject::OnShutdown() {
- DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop());
+ if (MessageLoop::current() != host_context_.main_message_loop()) {
+ host_context_.main_message_loop()->PostTask(FROM_HERE, base::Bind(
+ &HostNPScriptObject::OnShutdown, base::Unretained(this)));
+ return;
+ }
host_ = NULL;
if (state_ != kDisconnected) {
@@ -583,7 +597,11 @@ void HostNPScriptObject::DisconnectInternal() {
}
void HostNPScriptObject::OnShutdownFinished() {
- DCHECK_EQ(MessageLoop::current(), host_context_.main_message_loop());
+ if (MessageLoop::current() != host_context_.main_message_loop()) {
+ host_context_.main_message_loop()->PostTask(FROM_HERE, base::Bind(
+ &HostNPScriptObject::OnShutdownFinished, base::Unretained(this)));
+ return;
+ }
disconnected_event_.Signal();
}

Powered by Google App Engine
This is Rietveld 408576698