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

Side by Side Diff: remoting/client/jni/chromoting_jni_instance.cc

Issue 1681393006: Use UrlRequest in PortAllocator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | remoting/client/plugin/chromoting_instance.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/client/jni/chromoting_jni_instance.h" 5 #include "remoting/client/jni/chromoting_jni_instance.h"
6 6
7 #include <android/log.h> 7 #include <android/log.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "jingle/glue/thread_wrapper.h" 14 #include "jingle/glue/thread_wrapper.h"
15 #include "net/socket/client_socket_factory.h" 15 #include "net/socket/client_socket_factory.h"
16 #include "remoting/base/chromium_url_request.h"
16 #include "remoting/base/service_urls.h" 17 #include "remoting/base/service_urls.h"
17 #include "remoting/client/audio_player.h" 18 #include "remoting/client/audio_player.h"
18 #include "remoting/client/client_status_logger.h" 19 #include "remoting/client/client_status_logger.h"
19 #include "remoting/client/jni/android_keymap.h" 20 #include "remoting/client/jni/android_keymap.h"
20 #include "remoting/client/jni/chromoting_jni_runtime.h" 21 #include "remoting/client/jni/chromoting_jni_runtime.h"
21 #include "remoting/client/jni/jni_frame_consumer.h" 22 #include "remoting/client/jni/jni_frame_consumer.h"
22 #include "remoting/client/software_video_renderer.h" 23 #include "remoting/client/software_video_renderer.h"
23 #include "remoting/client/token_fetcher_proxy.h" 24 #include "remoting/client/token_fetcher_proxy.h"
24 #include "remoting/protocol/chromium_port_allocator.h" 25 #include "remoting/protocol/chromium_port_allocator_factory.h"
25 #include "remoting/protocol/chromium_socket_factory.h" 26 #include "remoting/protocol/chromium_socket_factory.h"
26 #include "remoting/protocol/host_stub.h" 27 #include "remoting/protocol/host_stub.h"
27 #include "remoting/protocol/negotiating_client_authenticator.h" 28 #include "remoting/protocol/negotiating_client_authenticator.h"
28 #include "remoting/protocol/network_settings.h" 29 #include "remoting/protocol/network_settings.h"
29 #include "remoting/protocol/performance_tracker.h" 30 #include "remoting/protocol/performance_tracker.h"
30 #include "remoting/protocol/transport_context.h" 31 #include "remoting/protocol/transport_context.h"
31 #include "remoting/signaling/server_log_entry.h" 32 #include "remoting/signaling/server_log_entry.h"
32 #include "ui/events/keycodes/dom/keycode_converter.h" 33 #include "ui/events/keycodes/dom/keycode_converter.h"
33 34
34 namespace remoting { 35 namespace remoting {
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 418
418 signaling_.reset(new XmppSignalStrategy( 419 signaling_.reset(new XmppSignalStrategy(
419 net::ClientSocketFactory::GetDefaultFactory(), 420 net::ClientSocketFactory::GetDefaultFactory(),
420 jni_runtime_->url_requester(), xmpp_config_)); 421 jni_runtime_->url_requester(), xmpp_config_));
421 422
422 client_status_logger_.reset( 423 client_status_logger_.reset(
423 new ClientStatusLogger(ServerLogEntry::ME2ME, 424 new ClientStatusLogger(ServerLogEntry::ME2ME,
424 signaling_.get(), 425 signaling_.get(),
425 ServiceUrls::GetInstance()->directory_bot_jid())); 426 ServiceUrls::GetInstance()->directory_bot_jid()));
426 427
427 protocol::NetworkSettings network_settings(
428 protocol::NetworkSettings::NAT_TRAVERSAL_FULL);
429
430 // Use Chrome's network stack to allocate ports for peer-to-peer channels.
431 scoped_ptr<protocol::ChromiumPortAllocatorFactory> port_allocator_factory(
432 new protocol::ChromiumPortAllocatorFactory(
433 jni_runtime_->url_requester()));
434
435 scoped_refptr<protocol::TransportContext> transport_context = 428 scoped_refptr<protocol::TransportContext> transport_context =
436 new protocol::TransportContext( 429 new protocol::TransportContext(
437 signaling_.get(), std::move(port_allocator_factory), network_settings, 430 signaling_.get(),
431 make_scoped_ptr(new protocol::ChromiumPortAllocatorFactory()),
432 make_scoped_ptr(
433 new ChromiumUrlRequestFactory(jni_runtime_->url_requester())),
434 protocol::NetworkSettings(
435 protocol::NetworkSettings::NAT_TRAVERSAL_FULL),
438 protocol::TransportRole::CLIENT); 436 protocol::TransportRole::CLIENT);
439 437
440 if (flags_.find("useWebrtc") != std::string::npos) { 438 if (flags_.find("useWebrtc") != std::string::npos) {
441 VLOG(0) << "Attempting to connect using WebRTC."; 439 VLOG(0) << "Attempting to connect using WebRTC.";
442 scoped_ptr<protocol::CandidateSessionConfig> protocol_config = 440 scoped_ptr<protocol::CandidateSessionConfig> protocol_config =
443 protocol::CandidateSessionConfig::CreateEmpty(); 441 protocol::CandidateSessionConfig::CreateEmpty();
444 protocol_config->set_webrtc_supported(true); 442 protocol_config->set_webrtc_supported(true);
445 protocol_config->set_ice_supported(false); 443 protocol_config->set_ice_supported(false);
446 client_->set_protocol_config(std::move(protocol_config)); 444 client_->set_protocol_config(std::move(protocol_config));
447 } 445 }
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
520 perf_tracker_->round_trip_ms()); 518 perf_tracker_->round_trip_ms());
521 519
522 client_status_logger_->LogStatistics(perf_tracker_.get()); 520 client_status_logger_->LogStatistics(perf_tracker_.get());
523 521
524 jni_runtime_->network_task_runner()->PostDelayedTask( 522 jni_runtime_->network_task_runner()->PostDelayedTask(
525 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), 523 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this),
526 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); 524 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs));
527 } 525 }
528 526
529 } // namespace remoting 527 } // namespace remoting
OLDNEW
« no previous file with comments | « no previous file | remoting/client/plugin/chromoting_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698