OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/chromoting_client.h" | 5 #include "remoting/client/chromoting_client.h" |
6 | 6 |
7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
8 #include "remoting/base/tracer.h" | 8 #include "remoting/base/tracer.h" |
9 #include "remoting/client/chromoting_view.h" | 9 #include "remoting/client/chromoting_view.h" |
10 #include "remoting/client/client_context.h" | 10 #include "remoting/client/client_context.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 | 85 |
86 view_->TearDown(); | 86 view_->TearDown(); |
87 } | 87 } |
88 | 88 |
89 void ChromotingClient::ClientDone() { | 89 void ChromotingClient::ClientDone() { |
90 if (client_done_ != NULL) { | 90 if (client_done_ != NULL) { |
91 message_loop()->PostTask(FROM_HERE, client_done_); | 91 message_loop()->PostTask(FROM_HERE, client_done_); |
92 } | 92 } |
93 } | 93 } |
94 | 94 |
| 95 ChromotingStats* ChromotingClient::GetStats() { |
| 96 return &stats_; |
| 97 } |
| 98 |
95 void ChromotingClient::Repaint() { | 99 void ChromotingClient::Repaint() { |
96 if (message_loop() != MessageLoop::current()) { | 100 if (message_loop() != MessageLoop::current()) { |
97 message_loop()->PostTask( | 101 message_loop()->PostTask( |
98 FROM_HERE, | 102 FROM_HERE, |
99 NewRunnableMethod(this, &ChromotingClient::Repaint)); | 103 NewRunnableMethod(this, &ChromotingClient::Repaint)); |
100 return; | 104 return; |
101 } | 105 } |
102 | 106 |
103 view_->Paint(); | 107 view_->Paint(); |
104 } | 108 } |
(...skipping 13 matching lines...) Expand all Loading... |
118 void ChromotingClient::ProcessVideoPacket(const VideoPacket* packet, | 122 void ChromotingClient::ProcessVideoPacket(const VideoPacket* packet, |
119 Task* done) { | 123 Task* done) { |
120 if (message_loop() != MessageLoop::current()) { | 124 if (message_loop() != MessageLoop::current()) { |
121 message_loop()->PostTask( | 125 message_loop()->PostTask( |
122 FROM_HERE, | 126 FROM_HERE, |
123 NewRunnableMethod(this, &ChromotingClient::ProcessVideoPacket, | 127 NewRunnableMethod(this, &ChromotingClient::ProcessVideoPacket, |
124 packet, done)); | 128 packet, done)); |
125 return; | 129 return; |
126 } | 130 } |
127 | 131 |
| 132 // Record size of the packet for statistics. |
| 133 stats_.video_bandwidth()->Record(packet->data().size()); |
| 134 |
128 received_packets_.push_back(QueuedVideoPacket(packet, done)); | 135 received_packets_.push_back(QueuedVideoPacket(packet, done)); |
129 if (!packet_being_processed_) | 136 if (!packet_being_processed_) |
130 DispatchPacket(); | 137 DispatchPacket(); |
131 } | 138 } |
132 | 139 |
133 int ChromotingClient::GetPendingPackets() { | 140 int ChromotingClient::GetPendingPackets() { |
134 return received_packets_.size(); | 141 return received_packets_.size(); |
135 } | 142 } |
136 | 143 |
137 void ChromotingClient::DispatchPacket() { | 144 void ChromotingClient::DispatchPacket() { |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 if (msg->success()) { | 266 if (msg->success()) { |
260 connection_->OnClientAuthenticated(); | 267 connection_->OnClientAuthenticated(); |
261 } | 268 } |
262 | 269 |
263 view_->UpdateLoginStatus(msg->success(), msg->error_info()); | 270 view_->UpdateLoginStatus(msg->success(), msg->error_info()); |
264 done->Run(); | 271 done->Run(); |
265 delete done; | 272 delete done; |
266 } | 273 } |
267 | 274 |
268 } // namespace remoting | 275 } // namespace remoting |
OLD | NEW |