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

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
« no previous file with comments | « remoting/host/host_status_observer.h ('k') | remoting/host/screen_recorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 6fb01713a1d14657db6b439f5e427002575038e3..7a23eccc47b6948d8e2d41daaa21219d992843b9 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) {
@@ -584,7 +598,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();
}
« no previous file with comments | « remoting/host/host_status_observer.h ('k') | remoting/host/screen_recorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698