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

Side by Side Diff: remoting/jingle_glue/jingle_client.cc

Issue 6623048: Replace libjingle's HttpPortAllocatorSession with Pepper's http client (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thread switching Created 9 years, 9 months 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
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 "remoting/jingle_glue/jingle_client.h" 5 #include "remoting/jingle_glue/jingle_client.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "jingle/notifier/communicator/gaia_token_pre_xmpp_auth.h" 9 #include "jingle/notifier/communicator/gaia_token_pre_xmpp_auth.h"
10 #include "remoting/jingle_glue/http_port_allocator.h"
10 #include "remoting/jingle_glue/iq_request.h" 11 #include "remoting/jingle_glue/iq_request.h"
11 #include "remoting/jingle_glue/jingle_info_task.h" 12 #include "remoting/jingle_glue/jingle_info_task.h"
12 #include "remoting/jingle_glue/jingle_thread.h" 13 #include "remoting/jingle_glue/jingle_thread.h"
13 #include "remoting/jingle_glue/xmpp_socket_adapter.h" 14 #include "remoting/jingle_glue/xmpp_socket_adapter.h"
14 #include "third_party/libjingle/source/talk/base/asyncsocket.h" 15 #include "third_party/libjingle/source/talk/base/asyncsocket.h"
15 #include "third_party/libjingle/source/talk/base/basicpacketsocketfactory.h" 16 #include "third_party/libjingle/source/talk/base/basicpacketsocketfactory.h"
16 #include "third_party/libjingle/source/talk/base/ssladapter.h" 17 #include "third_party/libjingle/source/talk/base/ssladapter.h"
17 #include "third_party/libjingle/source/talk/p2p/base/sessionmanager.h" 18 #include "third_party/libjingle/source/talk/p2p/base/sessionmanager.h"
18 #include "third_party/libjingle/source/talk/p2p/base/transport.h" 19 #include "third_party/libjingle/source/talk/p2p/base/transport.h"
19 #include "third_party/libjingle/source/talk/p2p/client/httpportallocator.h"
20 #include "third_party/libjingle/source/talk/p2p/client/sessionmanagertask.h" 20 #include "third_party/libjingle/source/talk/p2p/client/sessionmanagertask.h"
21 #include "third_party/libjingle/source/talk/session/tunnel/tunnelsessionclient.h " 21 #include "third_party/libjingle/source/talk/session/tunnel/tunnelsessionclient.h "
22 #include "third_party/libjingle/source/talk/xmpp/prexmppauth.h" 22 #include "third_party/libjingle/source/talk/xmpp/prexmppauth.h"
23 #include "third_party/libjingle/source/talk/xmpp/saslcookiemechanism.h" 23 #include "third_party/libjingle/source/talk/xmpp/saslcookiemechanism.h"
24 24
25 namespace remoting { 25 namespace remoting {
26 26
27 // The XmppSignalStrategy encapsulates all the logic to perform the signaling 27 // The XmppSignalStrategy encapsulates all the logic to perform the signaling
28 // STUN/ICE for jingle via a direct XMPP connection. 28 // STUN/ICE for jingle via a direct XMPP connection.
29 // 29 //
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 closed_(false), 190 closed_(false),
191 initialized_finished_(false), 191 initialized_finished_(false),
192 callback_(callback), 192 callback_(callback),
193 signal_strategy_(signal_strategy) { 193 signal_strategy_(signal_strategy) {
194 } 194 }
195 195
196 JingleClient::JingleClient(JingleThread* thread, 196 JingleClient::JingleClient(JingleThread* thread,
197 SignalStrategy* signal_strategy, 197 SignalStrategy* signal_strategy,
198 talk_base::NetworkManager* network_manager, 198 talk_base::NetworkManager* network_manager,
199 talk_base::PacketSocketFactory* socket_factory, 199 talk_base::PacketSocketFactory* socket_factory,
200 PortAllocatorSessionFactory* session_factory,
200 Callback* callback) 201 Callback* callback)
201 : thread_(thread), 202 : thread_(thread),
202 state_(START), 203 state_(START),
203 initialized_(false), 204 initialized_(false),
204 closed_(false), 205 closed_(false),
205 initialized_finished_(false), 206 initialized_finished_(false),
206 callback_(callback), 207 callback_(callback),
207 signal_strategy_(signal_strategy), 208 signal_strategy_(signal_strategy),
208 network_manager_(network_manager), 209 network_manager_(network_manager),
209 socket_factory_(socket_factory) { 210 socket_factory_(socket_factory),
211 port_allocator_session_factory_(session_factory) {
210 } 212 }
211 213
212 JingleClient::~JingleClient() { 214 JingleClient::~JingleClient() {
213 base::AutoLock auto_lock(state_lock_); 215 base::AutoLock auto_lock(state_lock_);
214 DCHECK(!initialized_ || closed_); 216 DCHECK(!initialized_ || closed_);
215 } 217 }
216 218
217 void JingleClient::Init() { 219 void JingleClient::Init() {
218 { 220 {
219 base::AutoLock auto_lock(state_lock_); 221 base::AutoLock auto_lock(state_lock_);
(...skipping 12 matching lines...) Expand all
232 VLOG(1) << "Creating talk_base::NetworkManager."; 234 VLOG(1) << "Creating talk_base::NetworkManager.";
233 network_manager_.reset(new talk_base::NetworkManager()); 235 network_manager_.reset(new talk_base::NetworkManager());
234 } 236 }
235 if (!socket_factory_.get()) { 237 if (!socket_factory_.get()) {
236 VLOG(1) << "Creating talk_base::BasicPacketSocketFactory."; 238 VLOG(1) << "Creating talk_base::BasicPacketSocketFactory.";
237 socket_factory_.reset(new talk_base::BasicPacketSocketFactory( 239 socket_factory_.reset(new talk_base::BasicPacketSocketFactory(
238 talk_base::Thread::Current())); 240 talk_base::Thread::Current()));
239 } 241 }
240 242
241 port_allocator_.reset( 243 port_allocator_.reset(
242 new cricket::HttpPortAllocator(network_manager_.get(), 244 new remoting::HttpPortAllocator(
243 socket_factory_.get(), "transp2")); 245 network_manager_.get(), socket_factory_.get(),
246 port_allocator_session_factory_.get(), "transp2"));
247
244 // TODO(ajwong): The strategy needs a "start" command or something. Right 248 // TODO(ajwong): The strategy needs a "start" command or something. Right
245 // now, Init() implicitly starts processing events. Thus, we must have the 249 // now, Init() implicitly starts processing events. Thus, we must have the
246 // other fields of JingleClient initialized first, otherwise the state-change 250 // other fields of JingleClient initialized first, otherwise the state-change
247 // may occur and callback into class before we're done initializing. 251 // may occur and callback into class before we're done initializing.
248 signal_strategy_->Init(this); 252 signal_strategy_->Init(this);
249 signal_strategy_->ConfigureAllocator( 253 signal_strategy_->ConfigureAllocator(
250 port_allocator_.get(), 254 port_allocator_.get(),
251 NewRunnableMethod(this, &JingleClient::DoStartSession)); 255 NewRunnableMethod(this, &JingleClient::DoStartSession));
252 } 256 }
253 257
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 344 }
341 } 345 }
342 } 346 }
343 347
344 void JingleClient::OnJidChange(const std::string& full_jid) { 348 void JingleClient::OnJidChange(const std::string& full_jid) {
345 base::AutoLock auto_lock(jid_lock_); 349 base::AutoLock auto_lock(jid_lock_);
346 full_jid_ = full_jid; 350 full_jid_ = full_jid;
347 } 351 }
348 352
349 } // namespace remoting 353 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698