summaryrefslogtreecommitdiffstats
path: root/remoting/protocol
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 19:19:19 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-22 19:19:19 +0000
commitf8807b2dd6f9b6306a18db9af6e830a7bfb1239c (patch)
treecb79ae35866e72ed6061c005d18c696ae2fb5463 /remoting/protocol
parentff53f2dc67f68d418a33d1961eb07d382be66097 (diff)
downloadchromium_src-f8807b2dd6f9b6306a18db9af6e830a7bfb1239c.zip
chromium_src-f8807b2dd6f9b6306a18db9af6e830a7bfb1239c.tar.gz
chromium_src-f8807b2dd6f9b6306a18db9af6e830a7bfb1239c.tar.bz2
Use plugin main thread for network code on the client side
BUG=None TEST=Everything still works. Review URL: http://codereview.chromium.org/7655060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97706 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/protocol')
-rw-r--r--remoting/protocol/connection_to_host.cc1
-rw-r--r--remoting/protocol/jingle_session.cc24
-rw-r--r--remoting/protocol/jingle_session.h1
3 files changed, 11 insertions, 15 deletions
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index 3b82499..8113366 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -177,7 +177,6 @@ void ConnectionToHost::OnSessionStateChange(
switch (state) {
case Session::FAILED:
- state_ = STATE_FAILED;
CloseOnError();
break;
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 1f79b8e..3a906e2 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -55,7 +55,6 @@ JingleSession::JingleSession(
: jingle_session_manager_(jingle_session_manager),
local_cert_(local_cert),
state_(INITIALIZING),
- closed_(false),
closing_(false),
cricket_session_(NULL),
ALLOW_THIS_IN_INITIALIZER_LIST(task_factory_(this)) {
@@ -90,16 +89,9 @@ void JingleSession::Init(cricket::Session* cricket_session) {
void JingleSession::CloseInternal(int result, bool failed) {
DCHECK(CalledOnValidThread());
- if (!closed_ && !closing_) {
+ if (state_ != FAILED && state_ != CLOSED && !closing_) {
closing_ = true;
- // Inform the StateChangeCallback, so calling code knows not to touch any
- // channels.
- if (failed)
- SetState(FAILED);
- else
- SetState(CLOSED);
-
control_channel_socket_.reset();
event_channel_socket_.reset();
STLDeleteContainerPairSecondPointers(channel_connectors_.begin(),
@@ -111,7 +103,13 @@ void JingleSession::CloseInternal(int result, bool failed) {
cricket_session_->SignalState.disconnect(this);
}
- closed_ = true;
+ // Inform the StateChangeCallback, so calling code knows not to
+ // touch any channels. Needs to be done in the end because the
+ // session may be deleted in response to this event.
+ if (failed)
+ SetState(FAILED);
+ else
+ SetState(CLOSED);
}
}
@@ -124,7 +122,7 @@ cricket::Session* JingleSession::ReleaseSession() {
DCHECK(CalledOnValidThread());
// Session may be destroyed only after it is closed.
- DCHECK(closed_);
+ DCHECK(state_ == FAILED || state_ == CLOSED);
cricket::Session* session = cricket_session_;
if (cricket_session_)
@@ -250,7 +248,7 @@ void JingleSession::OnSessionState(
DCHECK(CalledOnValidThread());
DCHECK_EQ(cricket_session_, session);
- if (closed_) {
+ if (state_ == FAILED || state_ == CLOSED) {
// Don't do anything if we already closed.
return;
}
@@ -474,7 +472,7 @@ void JingleSession::SetState(State new_state) {
DCHECK_NE(state_, FAILED);
state_ = new_state;
- if (!closed_ && state_change_callback_.get())
+ if (state_change_callback_.get())
state_change_callback_->Run(new_state);
}
}
diff --git a/remoting/protocol/jingle_session.h b/remoting/protocol/jingle_session.h
index ee0a80e..288720d 100644
--- a/remoting/protocol/jingle_session.h
+++ b/remoting/protocol/jingle_session.h
@@ -150,7 +150,6 @@ class JingleSession : public protocol::Session,
State state_;
scoped_ptr<StateChangeCallback> state_change_callback_;
- bool closed_;
bool closing_;
// JID of the other side. Set when the connection is initialized,