diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 03:30:19 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-16 03:30:19 +0000 |
commit | a85eba366b78e2f4ff4a90463042bf46ed8e3a50 (patch) | |
tree | 657afd99b339eb7ec2a7c4cd544555f1caec8c9c | |
parent | 49211b31dfda9a2a9184e2139dc0c6472f6adf39 (diff) | |
download | chromium_src-a85eba366b78e2f4ff4a90463042bf46ed8e3a50.zip chromium_src-a85eba366b78e2f4ff4a90463042bf46ed8e3a50.tar.gz chromium_src-a85eba366b78e2f4ff4a90463042bf46ed8e3a50.tar.bz2 |
Style fixes after readability review.
TEST=compile
BUG=none
Review URL: http://codereview.chromium.org/2816007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49897 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | remoting/jingle_glue/iq_request.cc | 8 | ||||
-rw-r--r-- | remoting/jingle_glue/iq_request.h | 2 | ||||
-rw-r--r-- | remoting/jingle_glue/iq_request_unittest.cc | 2 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_channel.cc | 19 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_channel.h | 22 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_channel_unittest.cc | 28 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_client.cc | 22 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_client.h | 6 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_info_task.cc | 13 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_info_task.h | 11 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_thread.cc | 7 | ||||
-rw-r--r-- | remoting/jingle_glue/jingle_thread.h | 20 | ||||
-rw-r--r-- | remoting/jingle_glue/relay_port_allocator.cc | 10 | ||||
-rw-r--r-- | remoting/jingle_glue/relay_port_allocator.h | 20 |
14 files changed, 100 insertions, 90 deletions
diff --git a/remoting/jingle_glue/iq_request.cc b/remoting/jingle_glue/iq_request.cc index b9fd6bf..c56ef4c 100644 --- a/remoting/jingle_glue/iq_request.cc +++ b/remoting/jingle_glue/iq_request.cc @@ -8,8 +8,8 @@ #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "remoting/jingle_glue/jingle_client.h" -#include "talk/xmpp/constants.h" -#include "talk/xmpp/xmppengine.h" +#include "third_party/libjingle/source/talk/xmpp/constants.h" +#include "third_party/libjingle/source/talk/xmpp/xmppengine.h" namespace remoting { @@ -33,8 +33,8 @@ void IqRequest::SendIq(const std::string& type, // Unregister the handler if it is already registered. Unregister(); - DCHECK(type.length() > 0); - DCHECK(addressee.length() > 0); + DCHECK_GT(type.length(), 0U); + DCHECK_GT(addressee.length(), 0U); buzz::XmppClient* xmpp_client = jingle_client_->xmpp_client(); DCHECK(xmpp_client); // Expect that connection is active. diff --git a/remoting/jingle_glue/iq_request.h b/remoting/jingle_glue/iq_request.h index 1e9e764..e95fa1e 100644 --- a/remoting/jingle_glue/iq_request.h +++ b/remoting/jingle_glue/iq_request.h @@ -8,8 +8,8 @@ #include <string> #include "base/callback.h" -#include "talk/xmpp/xmppengine.h" #include "testing/gtest/include/gtest/gtest_prod.h" +#include "third_party/libjingle/source/talk/xmpp/xmppengine.h" namespace remoting { diff --git a/remoting/jingle_glue/iq_request_unittest.cc b/remoting/jingle_glue/iq_request_unittest.cc index 88a6033..c79e2fe 100644 --- a/remoting/jingle_glue/iq_request_unittest.cc +++ b/remoting/jingle_glue/iq_request_unittest.cc @@ -6,9 +6,9 @@ #include "base/string_util.h" #include "media/base/data_buffer.h" #include "remoting/jingle_glue/iq_request.h" -#include "talk/xmllite/xmlelement.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/libjingle/source/talk/xmllite/xmlelement.h" namespace remoting { diff --git a/remoting/jingle_glue/jingle_channel.cc b/remoting/jingle_glue/jingle_channel.cc index 49bfc5b4..77fcd1b 100644 --- a/remoting/jingle_glue/jingle_channel.cc +++ b/remoting/jingle_glue/jingle_channel.cc @@ -10,12 +10,13 @@ #include "base/waitable_event.h" #include "media/base/data_buffer.h" #include "remoting/jingle_glue/jingle_thread.h" -#include "talk/base/stream.h" +#include "third_party/libjingle/source/talk/base/stream.h" using media::DataBuffer; namespace remoting { +// Size of a read buffer chunk in bytes. const size_t kReadBufferSize = 4096; JingleChannel::JingleChannel(Callback* callback) @@ -35,7 +36,7 @@ JingleChannel::JingleChannel() } JingleChannel::~JingleChannel() { - DCHECK(state_ == CLOSED); + DCHECK_EQ(CLOSED, state_); } void JingleChannel::Init(JingleThread* thread, @@ -99,7 +100,7 @@ void JingleChannel::DoRead() { buffer->GetWritableData(), bytes_to_read, &bytes_read, &error); switch (result) { case talk_base::SR_SUCCESS: { - DCHECK(bytes_read > 0); + DCHECK_GT(bytes_read, 0U); buffer->SetDataSize(bytes_read); callback_->OnPacketReceived(this, buffer); break; @@ -164,21 +165,17 @@ void JingleChannel::DoWrite() { void JingleChannel::OnStreamEvent(talk_base::StreamInterface* stream, int events, int error) { - if (events & talk_base::SE_OPEN) { + if (events & talk_base::SE_OPEN) SetState(OPEN); - } - if (state_ == OPEN && (events & talk_base::SE_WRITE)) { + if (state_ == OPEN && (events & talk_base::SE_WRITE)) DoWrite(); - } - if (state_ == OPEN && (events & talk_base::SE_READ)) { + if (state_ == OPEN && (events & talk_base::SE_READ)) DoRead(); - } - if (events & talk_base::SE_CLOSE) { + if (events & talk_base::SE_CLOSE) SetState(CLOSED); - } } void JingleChannel::SetState(State state) { diff --git a/remoting/jingle_glue/jingle_channel.h b/remoting/jingle_glue/jingle_channel.h index e3f5e51..c53119c 100644 --- a/remoting/jingle_glue/jingle_channel.h +++ b/remoting/jingle_glue/jingle_channel.h @@ -13,8 +13,8 @@ #include "base/lock.h" #include "base/ref_counted.h" #include "base/scoped_ptr.h" -#include "talk/base/sigslot.h" #include "testing/gtest/include/gtest/gtest_prod.h" +#include "third_party/libjingle/source/talk/base/sigslot.h" namespace base { class WaitableEvent; @@ -63,10 +63,10 @@ class JingleChannel : public base::RefCountedThreadSafe<JingleChannel> { virtual void Close(); // Current state of the tunnel. - State state() { return state_; } + State state() const { return state_; } // JID of the other end of the channel. - const std::string& jid() { return jid_; } + const std::string& jid() const { return jid_; } // Number of bytes currently stored in the write buffer. size_t write_buffer_size(); @@ -76,12 +76,12 @@ class JingleChannel : public base::RefCountedThreadSafe<JingleChannel> { friend class JingleClient; // Constructor used by unit test only. - // TODO(hclam): Have to suppress warnnings in MSVC. + // TODO(hclam): Have to suppress warnings in MSVC. JingleChannel(); // Used by JingleClient to create an instance of the channel. |callback| // must not be NULL. - JingleChannel(Callback* callback); + explicit JingleChannel(Callback* callback); // Initialized the channel. Ownership of the |stream| is transfered to // caller. Ownership of |thread| is not. @@ -105,8 +105,7 @@ class JingleChannel : public base::RefCountedThreadSafe<JingleChannel> { // to JingleChannel. class EventHandler : public sigslot::has_slots<> { protected: - EventHandler(JingleChannel* channel) - : channel_(channel) { } + explicit EventHandler(JingleChannel* channel) : channel_(channel) {} // Constructor used only by unit test. EventHandler() : channel_(NULL) {} @@ -115,8 +114,8 @@ class JingleChannel : public base::RefCountedThreadSafe<JingleChannel> { int events, int error) { channel_->OnStreamEvent(stream, events, error); } - friend class JingleChannel; private: + friend class JingleChannel; JingleChannel* channel_; }; friend class EventHandler; @@ -135,12 +134,17 @@ class JingleChannel : public base::RefCountedThreadSafe<JingleChannel> { void DoClose(base::WaitableEvent* done_event); + // Callback that is called on channel events. Initialized in the constructor. Callback* callback_; + + // Event handler for stream events. EventHandler event_handler_; + + // Jid of the other end of the channel. std::string jid_; // Write buffer. |write_lock_| should be locked when accessing |write_queue_| - // and |write_buffer_size_|, but isn't neccessary for |current_write_buf_|. + // and |write_buffer_size_|, but isn't necessary for |current_write_buf_|. // |current_write_buf_| is accessed only by the jingle thread. // |write_buffer_size_| stores number of bytes currently in |write_queue_| // and in |current_write_buf_|. diff --git a/remoting/jingle_glue/jingle_channel_unittest.cc b/remoting/jingle_glue/jingle_channel_unittest.cc index 1a6a01e..140f6da 100644 --- a/remoting/jingle_glue/jingle_channel_unittest.cc +++ b/remoting/jingle_glue/jingle_channel_unittest.cc @@ -6,9 +6,9 @@ #include "media/base/data_buffer.h" #include "remoting/jingle_glue/jingle_channel.h" #include "remoting/jingle_glue/jingle_thread.h" -#include "talk/base/stream.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" +#include "third_party/libjingle/source/talk/base/stream.h" using testing::_; using testing::Return; @@ -18,6 +18,7 @@ using testing::SetArgumentPointee; namespace remoting { namespace { +// Size of test buffer in bytes. const size_t kBufferSize = 100; } // namespace @@ -31,23 +32,22 @@ class MockCallback : public JingleChannel::Callback { class MockStream : public talk_base::StreamInterface { public: virtual ~MockStream() {} - MOCK_CONST_METHOD0(GetState, talk_base::StreamState ()); + MOCK_CONST_METHOD0(GetState, talk_base::StreamState()); - MOCK_METHOD4(Read, talk_base::StreamResult (void*, size_t, + MOCK_METHOD4(Read, talk_base::StreamResult(void*, size_t, size_t*, int*)); + MOCK_METHOD4(Write, talk_base::StreamResult(const void*, size_t, size_t*, int*)); - MOCK_METHOD4(Write, talk_base::StreamResult (const void*, size_t, - size_t*, int*)); - MOCK_CONST_METHOD1(GetAvailable, bool (size_t *)); - MOCK_METHOD0(Close, void ()); + MOCK_CONST_METHOD1(GetAvailable, bool(size_t*)); + MOCK_METHOD0(Close, void()); - MOCK_METHOD3(PostEvent, void (talk_base::Thread*, int, int)); - MOCK_METHOD2(PostEvent, void (int, int)); + MOCK_METHOD3(PostEvent, void(talk_base::Thread*, int, int)); + MOCK_METHOD2(PostEvent, void(int, int)); }; TEST(JingleChannelTest, Init) { JingleThread thread; - MockStream *stream = new MockStream(); + MockStream* stream = new MockStream(); MockCallback callback; EXPECT_CALL(*stream, GetState()) @@ -71,14 +71,14 @@ TEST(JingleChannelTest, Init) { TEST(JingleChannelTest, Write) { JingleThread thread; - MockStream* stream = new MockStream(); // Freed by the channel. + MockStream* stream = new MockStream(); // Freed by the channel. MockCallback callback; scoped_refptr<media::DataBuffer> data = new media::DataBuffer(kBufferSize); data->SetDataSize(kBufferSize); EXPECT_CALL(*stream, Write(static_cast<const void*>(data->GetData()), - kBufferSize, _, _)) + kBufferSize, _, _)) .WillOnce(DoAll(SetArgumentPointee<2>(kBufferSize), Return(talk_base::SR_SUCCESS))); @@ -95,7 +95,7 @@ TEST(JingleChannelTest, Write) { TEST(JingleChannelTest, Read) { JingleThread thread; - MockStream* stream = new MockStream(); // Freed by the channel. + MockStream* stream = new MockStream(); // Freed by the channel. MockCallback callback; scoped_refptr<media::DataBuffer> data = new media::DataBuffer(kBufferSize); @@ -127,7 +127,7 @@ TEST(JingleChannelTest, Read) { TEST(JingleChannelTest, Close) { JingleThread thread; - MockStream* stream = new MockStream(); // Freed by the channel. + MockStream* stream = new MockStream(); // Freed by the channel. MockCallback callback; EXPECT_CALL(*stream, Close()) diff --git a/remoting/jingle_glue/jingle_client.cc b/remoting/jingle_glue/jingle_client.cc index b1cecdc..05d7fd3 100644 --- a/remoting/jingle_glue/jingle_client.cc +++ b/remoting/jingle_glue/jingle_client.cc @@ -16,16 +16,16 @@ #include "chrome/common/net/notifier/communicator/xmpp_socket_adapter.h" #include "remoting/jingle_glue/jingle_thread.h" #include "remoting/jingle_glue/relay_port_allocator.h" -#include "talk/base/asyncsocket.h" -#include "talk/base/ssladapter.h" -#include "talk/p2p/base/sessionmanager.h" -#include "talk/p2p/client/sessionmanagertask.h" +#include "third_party/libjingle/source/talk/base/asyncsocket.h" +#include "third_party/libjingle/source/talk/base/ssladapter.h" +#include "third_party/libjingle/source/talk/p2p/base/sessionmanager.h" +#include "third_party/libjingle/source/talk/p2p/client/sessionmanagertask.h" #ifdef USE_SSL_TUNNEL -#include "talk/session/tunnel/securetunnelsessionclient.h" +#include "third_party/libjingle/source/talk/session/tunnel/securetunnelsessionclient.h" #endif -#include "talk/session/tunnel/tunnelsessionclient.h" -#include "talk/xmpp/prexmppauth.h" -#include "talk/xmpp/saslcookiemechanism.h" +#include "third_party/libjingle/source/talk/session/tunnel/tunnelsessionclient.h" +#include "third_party/libjingle/source/talk/xmpp/prexmppauth.h" +#include "third_party/libjingle/source/talk/xmpp/saslcookiemechanism.h" namespace remoting { @@ -44,7 +44,7 @@ JingleClient::~JingleClient() { void JingleClient::Init( const std::string& username, const std::string& auth_token, const std::string& auth_token_service, Callback* callback) { - DCHECK(username != ""); + DCHECK_NE(username, ""); DCHECK(callback != NULL); DCHECK(callback_ == NULL); // Init() can be called only once. @@ -197,14 +197,12 @@ void JingleClient::OnIncomingTunnel( JingleChannel::Callback* channel_callback; if (callback_->OnAcceptConnection(this, jid.Str(), &channel_callback)) { DCHECK(channel_callback != NULL); - talk_base::StreamInterface* stream = - client->AcceptTunnel(session); + talk_base::StreamInterface* stream = client->AcceptTunnel(session); scoped_refptr<JingleChannel> channel(new JingleChannel(channel_callback)); channel->Init(thread_, stream, jid.Str()); callback_->OnNewConnection(this, channel); } else { client->DeclineTunnel(session); - return; } } diff --git a/remoting/jingle_glue/jingle_client.h b/remoting/jingle_glue/jingle_client.h index a074757..aa94a00 100644 --- a/remoting/jingle_glue/jingle_client.h +++ b/remoting/jingle_glue/jingle_client.h @@ -8,7 +8,7 @@ #include <string> #include "remoting/jingle_glue/jingle_channel.h" -#include "talk/xmpp/xmppclient.h" +#include "third_party/libjingle/source/talk/xmpp/xmppclient.h" class MessageLoop; @@ -64,10 +64,10 @@ class JingleClient : public base::RefCountedThreadSafe<JingleClient>, // take ownership of |thread| and expects that the thread is started before // the constructor is called, and only stopped after the JingleClient object // has been destructed. - JingleClient(JingleThread* thread); + explicit JingleClient(JingleThread* thread); virtual ~JingleClient(); - // Starts the XMPP connection inialization. Must be called only once. + // Starts the XMPP connection initialization. Must be called only once. // |callback| specifies callback object for the client and must not be NULL. void Init(const std::string& username, const std::string& auth_token, const std::string& auth_token_service, Callback* callback); diff --git a/remoting/jingle_glue/jingle_info_task.cc b/remoting/jingle_glue/jingle_info_task.cc index c2e6525..ca10e6a 100644 --- a/remoting/jingle_glue/jingle_info_task.cc +++ b/remoting/jingle_glue/jingle_info_task.cc @@ -5,9 +5,9 @@ #include "remoting/jingle_glue/jingle_info_task.h" #include "base/scoped_ptr.h" -#include "talk/base/socketaddress.h" -#include "talk/xmpp/constants.h" -#include "talk/xmpp/xmppclient.h" +#include "third_party/libjingle/source/talk/base/socketaddress.h" +#include "third_party/libjingle/source/talk/xmpp/constants.h" +#include "third_party/libjingle/source/talk/xmpp/xmppclient.h" namespace remoting { @@ -15,9 +15,10 @@ namespace remoting { class JingleInfoTask::JingleInfoGetTask : public XmppTask { public: - explicit JingleInfoGetTask(talk_base::TaskParent* parent) : - XmppTask(parent, buzz::XmppEngine::HL_SINGLE), - done_(false) { } + explicit JingleInfoGetTask(talk_base::TaskParent* parent) + : XmppTask(parent, buzz::XmppEngine::HL_SINGLE), + done_(false) { + } virtual int ProcessStart() { // Set jingle info query IQ stanza. diff --git a/remoting/jingle_glue/jingle_info_task.h b/remoting/jingle_glue/jingle_info_task.h index f02e54e..361b27a 100644 --- a/remoting/jingle_glue/jingle_info_task.h +++ b/remoting/jingle_glue/jingle_info_task.h @@ -8,10 +8,10 @@ #include <vector> #include <string> -#include "talk/base/sigslot.h" -#include "talk/p2p/client/httpportallocator.h" -#include "talk/xmpp/xmppengine.h" -#include "talk/xmpp/xmpptask.h" +#include "third_party/libjingle/source/talk/base/sigslot.h" +#include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" +#include "third_party/libjingle/source/talk/xmpp/xmppengine.h" +#include "third_party/libjingle/source/talk/xmpp/xmpptask.h" namespace remoting { @@ -23,7 +23,8 @@ namespace remoting { class JingleInfoTask : public buzz::XmppTask { public: explicit JingleInfoTask(talk_base::TaskParent* parent) - : XmppTask(parent, buzz::XmppEngine::HL_TYPE) {} + : XmppTask(parent, buzz::XmppEngine::HL_TYPE) { + } virtual int ProcessStart(); void RefreshJingleInfoNow(); diff --git a/remoting/jingle_glue/jingle_thread.cc b/remoting/jingle_glue/jingle_thread.cc index ee02a5c..b11637d 100644 --- a/remoting/jingle_glue/jingle_thread.cc +++ b/remoting/jingle_glue/jingle_thread.cc @@ -6,7 +6,7 @@ #include "base/logging.h" #include "base/message_loop.h" -#include "talk/base/ssladapter.h" +#include "third_party/libjingle/source/talk/base/ssladapter.h" namespace remoting { @@ -30,7 +30,8 @@ void TaskPump::OnMessage(talk_base::Message* pmsg) { JingleThread::JingleThread() : task_pump_(NULL), started_event_(true, false), - message_loop_(NULL) { } + message_loop_(NULL) { +} JingleThread::~JingleThread() { } @@ -63,7 +64,7 @@ void JingleThread::Run() { LOG(INFO) << "Jingle thread finished."; } -// This method is called every 20ms to process tasks from |message_loop_| +// This method is called every 20ms to process tasks from |message_loop_| // on this thread. // TODO(sergeyu): Remove it when JingleThread moved to Chromium's base::Thread. void JingleThread::PumpAuxiliaryLoops() { diff --git a/remoting/jingle_glue/jingle_thread.h b/remoting/jingle_glue/jingle_thread.h index ecef1fb..b30d07f 100644 --- a/remoting/jingle_glue/jingle_thread.h +++ b/remoting/jingle_glue/jingle_thread.h @@ -2,14 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef REMOTING_JINGLE_GLUE_JINGLE_THREAD_H -#define REMOTING_JINGLE_GLUE_JINGLE_THREAD_H +#ifndef REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ +#define REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ #include "base/tracked_objects.h" #include "base/waitable_event.h" -#include "talk/base/messagequeue.h" -#include "talk/base/taskrunner.h" -#include "talk/base/thread.h" +#include "third_party/libjingle/source/talk/base/messagequeue.h" +#include "third_party/libjingle/source/talk/base/taskrunner.h" +#include "third_party/libjingle/source/talk/base/thread.h" class MessageLoop; @@ -25,11 +25,11 @@ class TaskPump : public talk_base::MessageHandler, TaskPump(); // TaskRunner methods. - void WakeTasks(); - int64 CurrentTime(); + virtual void WakeTasks(); + virtual int64 CurrentTime(); // MessageHandler methods. - void OnMessage(talk_base::Message* pmsg); + virtual void OnMessage(talk_base::Message* pmsg); }; // TODO(sergeyu): This class should be changed to inherit from Chromiums @@ -46,7 +46,7 @@ class JingleThread : public talk_base::Thread, void Run(); // Returns Chromiums message loop for this thread. - // TODO(sergeyu): remove this methid when we use base::Thread insted of + // TODO(sergeyu): remove this method when we use base::Thread instead of // talk_base::Thread MessageLoop* message_loop() { return message_loop_; } @@ -67,4 +67,4 @@ class JingleThread : public talk_base::Thread, } // namespace remoting -#endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H +#endif // REMOTING_JINGLE_GLUE_JINGLE_THREAD_H_ diff --git a/remoting/jingle_glue/relay_port_allocator.cc b/remoting/jingle_glue/relay_port_allocator.cc index 8b50dca..ba9221a 100644 --- a/remoting/jingle_glue/relay_port_allocator.cc +++ b/remoting/jingle_glue/relay_port_allocator.cc @@ -4,15 +4,17 @@ #include "remoting/jingle_glue/relay_port_allocator.h" +#include <vector> + #include "remoting/jingle_glue/jingle_info_task.h" -#include "talk/xmpp/xmppclient.h" +#include "third_party/libjingle/source/talk/xmpp/xmppclient.h" namespace remoting { void RelayPortAllocator::OnJingleInfo( - const std::string & token, - const std::vector<std::string> & relay_hosts, - const std::vector<talk_base::SocketAddress> & stun_hosts) { + const std::string& token, + const std::vector<std::string>& relay_hosts, + const std::vector<talk_base::SocketAddress>& stun_hosts) { this->SetRelayToken(token); this->SetStunHosts(stun_hosts); this->SetRelayHosts(relay_hosts); diff --git a/remoting/jingle_glue/relay_port_allocator.h b/remoting/jingle_glue/relay_port_allocator.h index 2651d3f3..476e617 100644 --- a/remoting/jingle_glue/relay_port_allocator.h +++ b/remoting/jingle_glue/relay_port_allocator.h @@ -6,9 +6,10 @@ #define REMOTING_JINGLE_GLUE_RELAY_PORT_ALLOCATOR_H_ #include <string> +#include <vector> -#include "talk/base/sigslot.h" -#include "talk/p2p/client/httpportallocator.h" +#include "third_party/libjingle/source/talk/base/sigslot.h" +#include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h" namespace buzz { class XmppClient; @@ -16,17 +17,22 @@ class XmppClient; namespace remoting { -class RelayPortAllocator: public cricket::HttpPortAllocator, - public sigslot::has_slots<> { +class RelayPortAllocator : public cricket::HttpPortAllocator, + public sigslot::has_slots<> { public: + // Caller keeps ownership of |network_manager|. |network_manager| must not + // be destroyed before RelayPortAllocator. RelayPortAllocator(talk_base::NetworkManager* network_manager, - const std::string& user_agent): - cricket::HttpPortAllocator(network_manager, user_agent) { } + const std::string& user_agent) + : cricket::HttpPortAllocator(network_manager, user_agent) { + } void OnJingleInfo(const std::string& token, const std::vector<std::string>& relay_hosts, const std::vector<talk_base::SocketAddress>& stun_hosts); + // Starts JingleInfoTask to get new relay information. Caller keeps ownership + // of |client|. void SetJingleInfo(buzz::XmppClient* client); private: @@ -35,4 +41,4 @@ class RelayPortAllocator: public cricket::HttpPortAllocator, } // namespace remoting -#endif // REMOTING_JINGLE_GLUE_RELAY_PORT_ALLOCATOR_H_ +#endif // REMOTING_JINGLE_GLUE_RELAY_PORT_ALLOCATOR_H_ |