| OLD | NEW |
| 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 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "jingle/glue/thread_wrapper.h" |
| 11 #include "net/socket/client_socket_factory.h" | 12 #include "net/socket/client_socket_factory.h" |
| 12 #include "remoting/client/audio_player.h" | 13 #include "remoting/client/audio_player.h" |
| 13 #include "remoting/client/jni/android_keymap.h" | 14 #include "remoting/client/jni/android_keymap.h" |
| 14 #include "remoting/client/jni/chromoting_jni_runtime.h" | 15 #include "remoting/client/jni/chromoting_jni_runtime.h" |
| 15 #include "remoting/client/log_to_server.h" | 16 #include "remoting/client/log_to_server.h" |
| 16 #include "remoting/client/software_video_renderer.h" | 17 #include "remoting/client/software_video_renderer.h" |
| 17 #include "remoting/jingle_glue/chromium_port_allocator.h" | 18 #include "remoting/jingle_glue/chromium_port_allocator.h" |
| 18 #include "remoting/jingle_glue/chromium_socket_factory.h" | 19 #include "remoting/jingle_glue/chromium_socket_factory.h" |
| 19 #include "remoting/jingle_glue/network_settings.h" | 20 #include "remoting/jingle_glue/network_settings.h" |
| 20 #include "remoting/jingle_glue/server_log_entry.h" | 21 #include "remoting/jingle_glue/server_log_entry.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 | 308 |
| 308 jni_runtime_->network_task_runner()->PostTask( | 309 jni_runtime_->network_task_runner()->PostTask( |
| 309 FROM_HERE, | 310 FROM_HERE, |
| 310 base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread, | 311 base::Bind(&ChromotingJniInstance::ConnectToHostOnNetworkThread, |
| 311 this)); | 312 this)); |
| 312 } | 313 } |
| 313 | 314 |
| 314 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { | 315 void ChromotingJniInstance::ConnectToHostOnNetworkThread() { |
| 315 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); | 316 DCHECK(jni_runtime_->network_task_runner()->BelongsToCurrentThread()); |
| 316 | 317 |
| 318 jingle_glue::JingleThreadWrapper::EnsureForCurrentMessageLoop(); |
| 319 |
| 317 client_context_.reset(new ClientContext( | 320 client_context_.reset(new ClientContext( |
| 318 jni_runtime_->network_task_runner().get())); | 321 jni_runtime_->network_task_runner().get())); |
| 319 client_context_->Start(); | 322 client_context_->Start(); |
| 320 | 323 |
| 321 connection_.reset(new protocol::ConnectionToHost(true)); | 324 connection_.reset(new protocol::ConnectionToHost(true)); |
| 322 | 325 |
| 323 SoftwareVideoRenderer* renderer = | 326 SoftwareVideoRenderer* renderer = |
| 324 new SoftwareVideoRenderer(client_context_->main_task_runner(), | 327 new SoftwareVideoRenderer(client_context_->main_task_runner(), |
| 325 client_context_->decode_task_runner(), | 328 client_context_->decode_task_runner(), |
| 326 frame_consumer_); | 329 frame_consumer_); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 stats->round_trip_ms()->Average()); | 433 stats->round_trip_ms()->Average()); |
| 431 | 434 |
| 432 log_to_server_->LogStatistics(stats); | 435 log_to_server_->LogStatistics(stats); |
| 433 | 436 |
| 434 jni_runtime_->network_task_runner()->PostDelayedTask( | 437 jni_runtime_->network_task_runner()->PostDelayedTask( |
| 435 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), | 438 FROM_HERE, base::Bind(&ChromotingJniInstance::LogPerfStats, this), |
| 436 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); | 439 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); |
| 437 } | 440 } |
| 438 | 441 |
| 439 } // namespace remoting | 442 } // namespace remoting |
| OLD | NEW |