OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/plugin/chromoting_instance.h" | 5 #include "remoting/client/plugin/chromoting_instance.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), | 354 base::Bind(&ChromotingInstance::SendOutgoingIq, AsWeakPtr()), |
355 plugin_message_loop_, | 355 plugin_message_loop_, |
356 context_.network_message_loop()); | 356 context_.network_message_loop()); |
357 | 357 |
358 // Kick off the connection. | 358 // Kick off the connection. |
359 client_->Start(xmpp_proxy_); | 359 client_->Start(xmpp_proxy_); |
360 | 360 |
361 // Start timer that periodically sends perf stats. | 361 // Start timer that periodically sends perf stats. |
362 plugin_message_loop_->PostDelayedTask( | 362 plugin_message_loop_->PostDelayedTask( |
363 FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, AsWeakPtr()), | 363 FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, AsWeakPtr()), |
364 kPerfStatsIntervalMs); | 364 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); |
365 | 365 |
366 VLOG(1) << "Connection status: Initializing"; | 366 VLOG(1) << "Connection status: Initializing"; |
367 SetConnectionState(STATE_INITIALIZING, ERROR_NONE); | 367 SetConnectionState(STATE_INITIALIZING, ERROR_NONE); |
368 } | 368 } |
369 | 369 |
370 void ChromotingInstance::Disconnect() { | 370 void ChromotingInstance::Disconnect() { |
371 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); | 371 DCHECK(plugin_message_loop_->BelongsToCurrentThread()); |
372 | 372 |
373 LOG(INFO) << "Disconnecting from host."; | 373 LOG(INFO) << "Disconnecting from host."; |
374 if (client_.get()) { | 374 if (client_.get()) { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 GetScriptableObject()->SendIq(iq); | 424 GetScriptableObject()->SendIq(iq); |
425 } | 425 } |
426 | 426 |
427 void ChromotingInstance::SendPerfStats() { | 427 void ChromotingInstance::SendPerfStats() { |
428 if (!client_.get()) { | 428 if (!client_.get()) { |
429 return; | 429 return; |
430 } | 430 } |
431 | 431 |
432 plugin_message_loop_->PostDelayedTask( | 432 plugin_message_loop_->PostDelayedTask( |
433 FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, AsWeakPtr()), | 433 FROM_HERE, base::Bind(&ChromotingInstance::SendPerfStats, AsWeakPtr()), |
434 kPerfStatsIntervalMs); | 434 base::TimeDelta::FromMilliseconds(kPerfStatsIntervalMs)); |
435 | 435 |
436 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 436 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
437 ChromotingStats* stats = client_->GetStats(); | 437 ChromotingStats* stats = client_->GetStats(); |
438 data->SetDouble("videoBandwidth", stats->video_bandwidth()->Rate()); | 438 data->SetDouble("videoBandwidth", stats->video_bandwidth()->Rate()); |
439 data->SetDouble("videoFrameRate", stats->video_frame_rate()->Rate()); | 439 data->SetDouble("videoFrameRate", stats->video_frame_rate()->Rate()); |
440 data->SetDouble("captureLatency", stats->video_capture_ms()->Average()); | 440 data->SetDouble("captureLatency", stats->video_capture_ms()->Average()); |
441 data->SetDouble("encodeLatency", stats->video_encode_ms()->Average()); | 441 data->SetDouble("encodeLatency", stats->video_encode_ms()->Average()); |
442 data->SetDouble("decodeLatency", stats->video_decode_ms()->Average()); | 442 data->SetDouble("decodeLatency", stats->video_decode_ms()->Average()); |
443 data->SetDouble("renderLatency", stats->video_paint_ms()->Average()); | 443 data->SetDouble("renderLatency", stats->video_paint_ms()->Average()); |
444 data->SetDouble("roundtripLatency", stats->round_trip_ms()->Average()); | 444 data->SetDouble("roundtripLatency", stats->round_trip_ms()->Average()); |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); | 539 scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); |
540 data->SetString("message", message); | 540 data->SetString("message", message); |
541 PostChromotingMessage("logDebugMessage", data.Pass()); | 541 PostChromotingMessage("logDebugMessage", data.Pass()); |
542 | 542 |
543 scriptable_object->LogDebugInfo(message); | 543 scriptable_object->LogDebugInfo(message); |
544 } | 544 } |
545 g_logging_to_plugin = false; | 545 g_logging_to_plugin = false; |
546 } | 546 } |
547 | 547 |
548 } // namespace remoting | 548 } // namespace remoting |
OLD | NEW |