OLD | NEW |
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 #ifndef CHROME_BROWSER_NET_NETWORK_STATS_H_ | 5 #ifndef CHROME_BROWSER_NET_NETWORK_STATS_H_ |
6 #define CHROME_BROWSER_NET_NETWORK_STATS_H_ | 6 #define CHROME_BROWSER_NET_NETWORK_STATS_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 // The encoded message read from the server. | 170 // The encoded message read from the server. |
171 std::string encoded_message_; | 171 std::string encoded_message_; |
172 | 172 |
173 // |stream_| is used to generate data to be sent to the server and it is also | 173 // |stream_| is used to generate data to be sent to the server and it is also |
174 // used to verify the data received from the server. | 174 // used to verify the data received from the server. |
175 net::TestDataStream stream_; | 175 net::TestDataStream stream_; |
176 | 176 |
177 // HostResolver fills out the |addresses_| after host resolution is completed. | 177 // HostResolver fills out the |addresses_| after host resolution is completed. |
178 net::AddressList addresses_; | 178 net::AddressList addresses_; |
179 | 179 |
180 // Callback to call when data is read from the server. | |
181 net::OldCompletionCallbackImpl<NetworkStats> read_callback_; | |
182 | |
183 // Callback to call when data is sent to the server. | |
184 net::OldCompletionCallbackImpl<NetworkStats> write_callback_; | |
185 | |
186 // Callback to call when echo protocol is successefully finished or whenever | 180 // Callback to call when echo protocol is successefully finished or whenever |
187 // there is an error (this allows unittests to wait until echo protocol's | 181 // there is an error (this allows unittests to wait until echo protocol's |
188 // round trip is finished). | 182 // round trip is finished). |
189 net::OldCompletionCallback* finished_callback_; | 183 net::OldCompletionCallback* finished_callback_; |
190 | 184 |
191 // The time when the session was started. | 185 // The time when the session was started. |
192 base::TimeTicks start_time_; | 186 base::TimeTicks start_time_; |
193 | 187 |
194 // We use this factory to create timeout tasks for socket's ReadData. | 188 // We use this factory to create timeout tasks for socket's ReadData. |
195 base::WeakPtrFactory<NetworkStats> weak_factory_; | 189 base::WeakPtrFactory<NetworkStats> weak_factory_; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 virtual bool ReadComplete(int result) OVERRIDE; | 235 virtual bool ReadComplete(int result) OVERRIDE; |
242 | 236 |
243 // Collects stats for TCP connectivity. This is called when all the data from | 237 // Collects stats for TCP connectivity. This is called when all the data from |
244 // server is read or when there is a failure during connect/read/write. | 238 // server is read or when there is a failure during connect/read/write. |
245 virtual void Finish(Status status, int result) OVERRIDE; | 239 virtual void Finish(Status status, int result) OVERRIDE; |
246 | 240 |
247 private: | 241 private: |
248 // Callback that is called when connect is completed and calls | 242 // Callback that is called when connect is completed and calls |
249 // ConnectComplete() to start the echo protocol. | 243 // ConnectComplete() to start the echo protocol. |
250 void OnConnectComplete(int result); | 244 void OnConnectComplete(int result); |
251 | |
252 // Callback to call when connect is completed. | |
253 net::OldCompletionCallbackImpl<TCPStatsClient> connect_callback_; | |
254 }; | 245 }; |
255 | 246 |
256 // This collects the network connectivity stats for UDP and TCP for small | 247 // This collects the network connectivity stats for UDP and TCP for small |
257 // percentage of users who are participating in the experiment. All users must | 248 // percentage of users who are participating in the experiment. All users must |
258 // have enabled "UMA upload". This method gets called only if UMA upload to the | 249 // have enabled "UMA upload". This method gets called only if UMA upload to the |
259 // server has succeeded. | 250 // server has succeeded. |
260 void CollectNetworkStats(const std::string& network_stats_server_url, | 251 void CollectNetworkStats(const std::string& network_stats_server_url, |
261 IOThread* io_thread); | 252 IOThread* io_thread); |
262 | 253 |
263 } // namespace chrome_browser_net | 254 } // namespace chrome_browser_net |
264 | 255 |
265 #endif // CHROME_BROWSER_NET_NETWORK_STATS_H_ | 256 #endif // CHROME_BROWSER_NET_NETWORK_STATS_H_ |
OLD | NEW |