diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-10 18:06:32 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-09-10 18:06:32 +0000 |
commit | fe9ad8703fa33f196b896f676547e53fd368f735 (patch) | |
tree | bf08ec7b1de3a2a991ba96ddfa5c8d68d25e1637 /remoting/host | |
parent | c30fa32ff166ba04adc796e59dec61466b8ae479 (diff) | |
download | chromium_src-fe9ad8703fa33f196b896f676547e53fd368f735.zip chromium_src-fe9ad8703fa33f196b896f676547e53fd368f735.tar.gz chromium_src-fe9ad8703fa33f196b896f676547e53fd368f735.tar.bz2 |
Access Session::config() on the correct thread.
BUG=88600
TEST=Unittests
Review URL: http://codereview.chromium.org/7867019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@100589 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host')
-rw-r--r-- | remoting/host/chromoting_host.cc | 23 | ||||
-rw-r--r-- | remoting/host/chromoting_host.h | 5 |
2 files changed, 20 insertions, 8 deletions
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc index 8947a27..1b00087 100644 --- a/remoting/host/chromoting_host.cc +++ b/remoting/host/chromoting_host.cc @@ -447,12 +447,19 @@ void ChromotingHost::EnableCurtainMode(bool enable) { void ChromotingHost::LocalLoginSucceeded( scoped_refptr<ConnectionToClient> connection) { - if (MessageLoop::current() != context_->main_message_loop()) { - context_->main_message_loop()->PostTask( - FROM_HERE, base::Bind(&ChromotingHost::LocalLoginSucceeded, this, - connection)); - return; - } + 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()); protocol::LocalLoginStatus* status = new protocol::LocalLoginStatus(); status->set_success(true); @@ -477,7 +484,7 @@ void ChromotingHost::LocalLoginSucceeded( if (!recorder_.get()) { // Then we create a ScreenRecorder passing the message loops that // it should run on. - Encoder* encoder = CreateEncoder(connection->session()->config()); + Encoder* encoder = CreateEncoder(config); recorder_ = new ScreenRecorder(context_->main_message_loop(), context_->encode_message_loop(), @@ -498,7 +505,7 @@ void ChromotingHost::LocalLoginSucceeded( // including closing the connection on failure of a critical operation. EnableCurtainMode(true); if (is_it2me_) { - std::string username = connection->session()->jid(); + std::string username = 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 7b5cea5..3f34233 100644 --- a/remoting/host/chromoting_host.h +++ b/remoting/host/chromoting_host.h @@ -125,6 +125,11 @@ 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); |