Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(675)

Side by Side Diff: jingle/glue/fake_socket_factory.cc

Issue 8551004: base::Bind: Convert jingle/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « jingle/glue/fake_network_manager.cc ('k') | jingle/glue/pseudotcp_adapter_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "jingle/glue/fake_socket_factory.h" 5 #include "jingle/glue/fake_socket_factory.h"
6 6
7 #include "base/bind.h"
7 #include "base/message_loop.h" 8 #include "base/message_loop.h"
8 #include "jingle/glue/utils.h" 9 #include "jingle/glue/utils.h"
9 #include "third_party/libjingle/source/talk/base/asyncsocket.h" 10 #include "third_party/libjingle/source/talk/base/asyncsocket.h"
10 11
11 namespace jingle_glue { 12 namespace jingle_glue {
12 13
13 FakeUDPPacketSocket::FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager, 14 FakeUDPPacketSocket::FakeUDPPacketSocket(FakeSocketManager* fake_socket_manager,
14 const net::IPEndPoint& address) 15 const net::IPEndPoint& address)
15 : fake_socket_manager_(fake_socket_manager), 16 : fake_socket_manager_(fake_socket_manager),
16 endpoint_(address), state_(IS_OPEN), error_(0) { 17 endpoint_(address), state_(IS_OPEN), error_(0) {
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 119 }
119 120
120 FakeSocketManager::~FakeSocketManager() { } 121 FakeSocketManager::~FakeSocketManager() { }
121 122
122 void FakeSocketManager::SendPacket(const net::IPEndPoint& from, 123 void FakeSocketManager::SendPacket(const net::IPEndPoint& from,
123 const net::IPEndPoint& to, 124 const net::IPEndPoint& to,
124 const std::vector<char>& data) { 125 const std::vector<char>& data) {
125 DCHECK_EQ(MessageLoop::current(), message_loop_); 126 DCHECK_EQ(MessageLoop::current(), message_loop_);
126 127
127 message_loop_->PostTask( 128 message_loop_->PostTask(
128 FROM_HERE, NewRunnableMethod(this, &FakeSocketManager::DeliverPacket, 129 FROM_HERE,
129 from, to, data)); 130 base::Bind(&FakeSocketManager::DeliverPacket, this, from, to, data));
130 } 131 }
131 132
132 void FakeSocketManager::DeliverPacket(const net::IPEndPoint& from, 133 void FakeSocketManager::DeliverPacket(const net::IPEndPoint& from,
133 const net::IPEndPoint& to, 134 const net::IPEndPoint& to,
134 const std::vector<char>& data) { 135 const std::vector<char>& data) {
135 DCHECK_EQ(MessageLoop::current(), message_loop_); 136 DCHECK_EQ(MessageLoop::current(), message_loop_);
136 137
137 std::map<net::IPEndPoint, FakeUDPPacketSocket*>::iterator it = 138 std::map<net::IPEndPoint, FakeUDPPacketSocket*>::iterator it =
138 endpoints_.find(to); 139 endpoints_.find(to);
139 if (it == endpoints_.end()) { 140 if (it == endpoints_.end()) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 const talk_base::SocketAddress& local_address, 187 const talk_base::SocketAddress& local_address,
187 const talk_base::SocketAddress& remote_address, 188 const talk_base::SocketAddress& remote_address,
188 const talk_base::ProxyInfo& proxy_info, const std::string& user_agent, 189 const talk_base::ProxyInfo& proxy_info, const std::string& user_agent,
189 bool ssl) { 190 bool ssl) {
190 // TODO(sergeyu): Implement fake TCP sockets. 191 // TODO(sergeyu): Implement fake TCP sockets.
191 NOTIMPLEMENTED(); 192 NOTIMPLEMENTED();
192 return NULL; 193 return NULL;
193 } 194 }
194 195
195 } // namespace jingle_glue 196 } // namespace jingle_glue
OLDNEW
« no previous file with comments | « jingle/glue/fake_network_manager.cc ('k') | jingle/glue/pseudotcp_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698