diff options
author | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 02:42:41 +0000 |
---|---|---|
committer | sergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-27 02:42:41 +0000 |
commit | e18194cf541dc4a7a56e6792518002d37307b96a (patch) | |
tree | 00b8336c058bc16e59a8f0b9f715b2187fe2d391 /jingle/glue | |
parent | 866cd68e4fd9d4195026109b2e6d285b50334218 (diff) | |
download | chromium_src-e18194cf541dc4a7a56e6792518002d37307b96a.zip chromium_src-e18194cf541dc4a7a56e6792518002d37307b96a.tar.gz chromium_src-e18194cf541dc4a7a56e6792518002d37307b96a.tar.bz2 |
Unbranch libjingle
BUG=35195,76790
TEST=None
Review URL: http://codereview.chromium.org/7077019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@86954 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'jingle/glue')
-rw-r--r-- | jingle/glue/fake_socket_factory.cc | 24 | ||||
-rw-r--r-- | jingle/glue/fake_socket_factory.h | 13 |
2 files changed, 17 insertions, 20 deletions
diff --git a/jingle/glue/fake_socket_factory.cc b/jingle/glue/fake_socket_factory.cc index 6139334..95a0fa2 100644 --- a/jingle/glue/fake_socket_factory.cc +++ b/jingle/glue/fake_socket_factory.cc @@ -13,7 +13,7 @@ namespace jingle_glue { FakeUDPPacketSocket::FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager, const net::IPEndPoint& address) : fake_socket_manager_(fake_socket_manager), - endpoint_(address), state_(STATE_OPEN), error_(0) { + endpoint_(address), state_(IS_OPEN), error_(0) { CHECK(IPEndPointToSocketAddress(endpoint_, &local_address_)); fake_socket_manager_->AddSocket(this); } @@ -22,11 +22,9 @@ FakeUDPPacketSocket::~FakeUDPPacketSocket() { fake_socket_manager_->RemoveSocket(this); } -bool FakeUDPPacketSocket::GetLocalAddress( - talk_base::SocketAddress* address) const { +talk_base::SocketAddress FakeUDPPacketSocket::GetLocalAddress() const { DCHECK(CalledOnValidThread()); - *address = local_address_; - return true; + return local_address_; } talk_base::SocketAddress FakeUDPPacketSocket::GetRemoteAddress() const { @@ -43,7 +41,7 @@ int FakeUDPPacketSocket::SendTo(const void *data, size_t data_size, const talk_base::SocketAddress& address) { DCHECK(CalledOnValidThread()); - if (state_ == STATE_CLOSED) { + if (state_ == IS_CLOSED) { return ENOTCONN; } @@ -62,22 +60,22 @@ int FakeUDPPacketSocket::SendTo(const void *data, size_t data_size, int FakeUDPPacketSocket::Close() { DCHECK(CalledOnValidThread()); - state_ = STATE_CLOSED; + state_ = IS_CLOSED; return 0; } -talk_base::Socket::ConnState FakeUDPPacketSocket::GetState() const { +talk_base::AsyncPacketSocket::State FakeUDPPacketSocket::GetState() const { DCHECK(CalledOnValidThread()); switch (state_) { - case STATE_OPEN: - return talk_base::Socket::CS_CONNECTED; - case STATE_CLOSED: - return talk_base::Socket::CS_CLOSED; + case IS_OPEN: + return STATE_BOUND; + case IS_CLOSED: + return STATE_CLOSED; } NOTREACHED(); - return talk_base::Socket::CS_CLOSED; + return STATE_CLOSED; } int FakeUDPPacketSocket::GetOption(talk_base::Socket::Option opt, int* value) { diff --git a/jingle/glue/fake_socket_factory.h b/jingle/glue/fake_socket_factory.h index 2be2d5c..4e4fa40 100644 --- a/jingle/glue/fake_socket_factory.h +++ b/jingle/glue/fake_socket_factory.h @@ -34,30 +34,29 @@ class FakeUDPPacketSocket : public talk_base::AsyncPacketSocket, const std::vector<char>& data); // talk_base::AsyncPacketSocket implementation. - virtual bool GetLocalAddress( - talk_base::SocketAddress* address) const OVERRIDE; + virtual talk_base::SocketAddress GetLocalAddress() const OVERRIDE; virtual talk_base::SocketAddress GetRemoteAddress() const OVERRIDE; virtual int Send(const void *pv, size_t cb) OVERRIDE; virtual int SendTo(const void *pv, size_t cb, const talk_base::SocketAddress& addr) OVERRIDE; virtual int Close() OVERRIDE; - virtual talk_base::Socket::ConnState GetState() const OVERRIDE; + virtual State GetState() const OVERRIDE; virtual int GetOption(talk_base::Socket::Option opt, int* value) OVERRIDE; virtual int SetOption(talk_base::Socket::Option opt, int value) OVERRIDE; virtual int GetError() const OVERRIDE; virtual void SetError(int error) OVERRIDE; private: - enum State { - STATE_OPEN, - STATE_CLOSED, + enum InternalState { + IS_OPEN, + IS_CLOSED, }; scoped_refptr<FakeSocketManager> fake_socket_manager_; net::IPEndPoint endpoint_; talk_base::SocketAddress local_address_; talk_base::SocketAddress remote_address_; - State state_; + InternalState state_; int error_; DISALLOW_COPY_AND_ASSIGN(FakeUDPPacketSocket); |