| 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 "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" | 5 #include "chrome/browser/net/websocket_experiment/websocket_experiment_task.h" |
| 6 | 6 |
| 7 #include "base/hash_tables.h" | 7 #include "base/hash_tables.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/browser_thread.h" | 9 #include "chrome/browser/browser_thread.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 UpdateHistogramTimes(config_, "WebSocketTotal", result_.websocket_total, | 288 UpdateHistogramTimes(config_, "WebSocketTotal", result_.websocket_total, |
| 289 base::TimeDelta::FromMilliseconds(1), | 289 base::TimeDelta::FromMilliseconds(1), |
| 290 base::TimeDelta::FromSeconds(kWebSocketTimeSec), | 290 base::TimeDelta::FromSeconds(kWebSocketTimeSec), |
| 291 kTimeBucketCount); | 291 kTimeBucketCount); |
| 292 } | 292 } |
| 293 | 293 |
| 294 // URLFetcher::Delegate method. | 294 // URLFetcher::Delegate method. |
| 295 void WebSocketExperimentTask::OnURLFetchComplete( | 295 void WebSocketExperimentTask::OnURLFetchComplete( |
| 296 const URLFetcher* source, | 296 const URLFetcher* source, |
| 297 const GURL& url, | 297 const GURL& url, |
| 298 const URLRequestStatus& status, | 298 const net::URLRequestStatus& status, |
| 299 int response_code, | 299 int response_code, |
| 300 const ResponseCookies& cookies, | 300 const ResponseCookies& cookies, |
| 301 const std::string& data) { | 301 const std::string& data) { |
| 302 result_.url_fetch = base::TimeTicks::Now() - url_fetch_start_time_; | 302 result_.url_fetch = base::TimeTicks::Now() - url_fetch_start_time_; |
| 303 RevokeTimeoutTimer(); | 303 RevokeTimeoutTimer(); |
| 304 int result = net::ERR_FAILED; | 304 int result = net::ERR_FAILED; |
| 305 if (next_state_ != STATE_URL_FETCH_COMPLETE) { | 305 if (next_state_ != STATE_URL_FETCH_COMPLETE) { |
| 306 DVLOG(1) << "unexpected state=" << next_state_ | 306 DVLOG(1) << "unexpected state=" << next_state_ |
| 307 << " at OnURLFetchComplete for " << config_.http_url; | 307 << " at OnURLFetchComplete for " << config_.http_url; |
| 308 result = net::ERR_UNEXPECTED; | 308 result = net::ERR_UNEXPECTED; |
| (...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 645 if (websocket) | 645 if (websocket) |
| 646 websocket->DetachDelegate(); | 646 websocket->DetachDelegate(); |
| 647 DVLOG(1) << "Finish WebSocket experiment for " << config_.url | 647 DVLOG(1) << "Finish WebSocket experiment for " << config_.url |
| 648 << " " << GetProtocolVersionName(config_.protocol_version) | 648 << " " << GetProtocolVersionName(config_.protocol_version) |
| 649 << " next_state=" << next_state_ | 649 << " next_state=" << next_state_ |
| 650 << " result=" << net::ErrorToString(result); | 650 << " result=" << net::ErrorToString(result); |
| 651 callback_->Run(result); // will release this. | 651 callback_->Run(result); // will release this. |
| 652 } | 652 } |
| 653 | 653 |
| 654 } // namespace chrome_browser_net | 654 } // namespace chrome_browser_net |
| OLD | NEW |