summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 21:12:59 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-12 21:12:59 +0000
commitfd5633b12e0ed15c62e6e0001b52bd53b895299c (patch)
treebe829493b515c9059962d1f8f646b0a0c8681a14 /remoting
parent8909be9febb02000f0b600b3bf0b85db92377a4a (diff)
downloadchromium_src-fd5633b12e0ed15c62e6e0001b52bd53b895299c.zip
chromium_src-fd5633b12e0ed15c62e6e0001b52bd53b895299c.tar.gz
chromium_src-fd5633b12e0ed15c62e6e0001b52bd53b895299c.tar.bz2
Revert 100589 - Access Session::config() on the correct thread.
BUG=88600 TEST=Unittests Review URL: http://codereview.chromium.org/7867019 TBR=sergeyu@chromium.org Review URL: http://codereview.chromium.org/7880002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/chromoting_host.cc23
-rw-r--r--remoting/host/chromoting_host.h5
-rw-r--r--remoting/protocol/jingle_session.cc10
3 files changed, 16 insertions, 22 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 1b00087..8947a27 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -447,19 +447,12 @@ void ChromotingHost::EnableCurtainMode(bool enable) {
void ChromotingHost::LocalLoginSucceeded(
scoped_refptr<ConnectionToClient> connection) {
- DCHECK(context_->network_message_loop()->BelongsToCurrentThread());
-
- context_->main_message_loop()->PostTask(
- FROM_HERE, base::Bind(&ChromotingHost::AddAuthenticatedClient,
- this, connection, connection->session()->config(),
- connection->session()->jid()));
-}
-
-void ChromotingHost::AddAuthenticatedClient(
- scoped_refptr<ConnectionToClient> connection,
- const protocol::SessionConfig& config,
- const std::string& jid) {
- DCHECK_EQ(context_->main_message_loop(), MessageLoop::current());
+ if (MessageLoop::current() != context_->main_message_loop()) {
+ context_->main_message_loop()->PostTask(
+ FROM_HERE, base::Bind(&ChromotingHost::LocalLoginSucceeded, this,
+ connection));
+ return;
+ }
protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus();
status->set_success(true);
@@ -484,7 +477,7 @@ void ChromotingHost::AddAuthenticatedClient(
if (!recorder_.get()) {
// Then we create a ScreenRecorder passing the message loops that
// it should run on.
- Encoder* encoder = CreateEncoder(config);
+ Encoder* encoder = CreateEncoder(connection->session()->config());
recorder_ = new ScreenRecorder(context_->main_message_loop(),
context_->encode_message_loop(),
@@ -505,7 +498,7 @@ void ChromotingHost::AddAuthenticatedClient(
// including closing the connection on failure of a critical operation.
EnableCurtainMode(true);
if (is_it2me_) {
- std::string username = jid;
+ std::string username = connection->session()->jid();
size_t pos = username.find('/');
if (pos != std::string::npos)
username.replace(pos, std::string::npos, "");
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 3f34233..7b5cea5 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -125,11 +125,6 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
protocol::Session* session,
protocol::SessionManager::IncomingSessionResponse* response) OVERRIDE;
- void AddAuthenticatedClient(
- scoped_refptr<protocol::ConnectionToClient> connection,
- const protocol::SessionConfig& config,
- const std::string& jid);
-
// Sets desired configuration for the protocol. Ownership of the
// |config| is transferred to the object. Must be called before Start().
void set_protocol_config(protocol::CandidateSessionConfig* config);
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index b30101c..b80239c 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -165,7 +165,10 @@ net::Socket* JingleSession::event_channel() {
}
const std::string& JingleSession::jid() {
- DCHECK(CalledOnValidThread());
+ // TODO(sergeyu): Fix ChromotingHost so that it doesn't call this
+ // method on invalid thread and uncomment this DCHECK.
+ // See crbug.com/88600 .
+ // DCHECK(CalledOnValidThread());
return jid_;
}
@@ -189,7 +192,10 @@ const std::string& JingleSession::local_certificate() const {
}
const SessionConfig& JingleSession::config() {
- DCHECK(CalledOnValidThread());
+ // TODO(sergeyu): Fix ChromotingHost so that it doesn't call this
+ // method on invalid thread and uncomment this DCHECK.
+ // See crbug.com/88600 .
+ // DCHECK(CalledOnValidThread());
DCHECK(config_set_);
return config_;
}