diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-04 01:00:49 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-04 01:00:49 +0000 |
commit | b39e182dca78d0c165ba75bb04878f4eb71b3625 (patch) | |
tree | c8f3d4f74b05cdb50b4d5244620595a758d8a996 /remoting/host/heartbeat_sender.cc | |
parent | dc01874febf63d62bd05178f168f5459fec05372 (diff) | |
download | chromium_src-b39e182dca78d0c165ba75bb04878f4eb71b3625.zip chromium_src-b39e182dca78d0c165ba75bb04878f4eb71b3625.tar.gz chromium_src-b39e182dca78d0c165ba75bb04878f4eb71b3625.tar.bz2 |
Refactor IqRequest.
Remove CreateIqRequest from SignalStrategy interface. Intead to send an Iq
stanza the new IqSender now need to be used. IqSender creats of IqRequest
objects and handling iq responses.
BUG=None
TEST=Unittests.
Review URL: http://codereview.chromium.org/8432009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108606 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/heartbeat_sender.cc')
-rw-r--r-- | remoting/host/heartbeat_sender.cc | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/remoting/host/heartbeat_sender.cc b/remoting/host/heartbeat_sender.cc index ecd35ca..c4e3a23 100644 --- a/remoting/host/heartbeat_sender.cc +++ b/remoting/host/heartbeat_sender.cc @@ -11,7 +11,7 @@ #include "base/time.h" #include "remoting/base/constants.h" #include "remoting/host/host_config.h" -#include "remoting/jingle_glue/iq_request.h" +#include "remoting/jingle_glue/iq_sender.h" #include "remoting/jingle_glue/jingle_thread.h" #include "remoting/jingle_glue/signal_strategy.h" #include "third_party/libjingle/source/talk/xmllite/xmlelement.h" @@ -72,9 +72,8 @@ void HeartbeatSender::OnSignallingConnected(SignalStrategy* signal_strategy, state_ = STARTED; full_jid_ = full_jid; - request_.reset(signal_strategy->CreateIqRequest()); - request_->set_callback(base::Bind(&HeartbeatSender::ProcessResponse, - base::Unretained(this))); + + iq_sender_.reset(new IqSender(signal_strategy)); DoSendStanza(); timer_.Start(FROM_HERE, base::TimeDelta::FromMilliseconds(interval_ms_), this, @@ -84,7 +83,8 @@ void HeartbeatSender::OnSignallingConnected(SignalStrategy* signal_strategy, void HeartbeatSender::OnSignallingDisconnected() { DCHECK(message_loop_->BelongsToCurrentThread()); state_ = STOPPED; - request_.reset(NULL); + request_.reset(); + iq_sender_.reset(); } // Ignore any notifications other than signalling @@ -99,8 +99,10 @@ void HeartbeatSender::DoSendStanza() { DCHECK_EQ(state_, STARTED); VLOG(1) << "Sending heartbeat stanza to " << kChromotingBotJid; - request_->SendIq(IqRequest::MakeIqStanza( - buzz::STR_SET, kChromotingBotJid, CreateHeartbeatMessage())); + request_.reset(iq_sender_->SendIq( + buzz::STR_SET, kChromotingBotJid, CreateHeartbeatMessage(), + base::Bind(&HeartbeatSender::ProcessResponse, + base::Unretained(this)))); } void HeartbeatSender::ProcessResponse(const XmlElement* response) { |