OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "sync/internal_api/public/http_bridge.h" | 5 #include "sync/internal_api/public/http_bridge.h" |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
9 #include "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/metrics/sparse_histogram.h" |
10 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
13 #include "net/base/load_flags.h" | 14 #include "net/base/load_flags.h" |
14 #include "net/base/net_errors.h" | 15 #include "net/base/net_errors.h" |
15 #include "net/http/http_cache.h" | 16 #include "net/http/http_cache.h" |
16 #include "net/http/http_network_layer.h" | 17 #include "net/http/http_network_layer.h" |
17 #include "net/http/http_request_headers.h" | 18 #include "net/http/http_request_headers.h" |
18 #include "net/http/http_response_headers.h" | 19 #include "net/http/http_response_headers.h" |
19 #include "net/url_request/static_http_user_agent_settings.h" | 20 #include "net/url_request/static_http_user_agent_settings.h" |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 426 |
426 fetch_state_.end_time = base::Time::Now(); | 427 fetch_state_.end_time = base::Time::Now(); |
427 fetch_state_.request_completed = true; | 428 fetch_state_.request_completed = true; |
428 fetch_state_.request_succeeded = | 429 fetch_state_.request_succeeded = |
429 (net::URLRequestStatus::SUCCESS == source->GetStatus().status()); | 430 (net::URLRequestStatus::SUCCESS == source->GetStatus().status()); |
430 fetch_state_.http_response_code = source->GetResponseCode(); | 431 fetch_state_.http_response_code = source->GetResponseCode(); |
431 fetch_state_.error_code = source->GetStatus().error(); | 432 fetch_state_.error_code = source->GetStatus().error(); |
432 | 433 |
433 if (fetch_state_.request_succeeded) | 434 if (fetch_state_.request_succeeded) |
434 LogTimeout(false); | 435 LogTimeout(false); |
| 436 UMA_HISTOGRAM_SPARSE_SLOWLY("Sync.URLFetchResponse", |
| 437 source->GetStatus().is_success() |
| 438 ? source->GetResponseCode() |
| 439 : source->GetStatus().ToNetError()); |
435 UMA_HISTOGRAM_LONG_TIMES("Sync.URLFetchTime", | 440 UMA_HISTOGRAM_LONG_TIMES("Sync.URLFetchTime", |
436 fetch_state_.end_time - fetch_state_.start_time); | 441 fetch_state_.end_time - fetch_state_.start_time); |
437 | 442 |
438 // Use a real (non-debug) log to facilitate troubleshooting in the wild. | 443 // Use a real (non-debug) log to facilitate troubleshooting in the wild. |
439 VLOG(2) << "HttpBridge::OnURLFetchComplete for: " | 444 VLOG(2) << "HttpBridge::OnURLFetchComplete for: " |
440 << fetch_state_.url_poster->GetURL().spec(); | 445 << fetch_state_.url_poster->GetURL().spec(); |
441 VLOG(1) << "HttpBridge received response code: " | 446 VLOG(1) << "HttpBridge received response code: " |
442 << fetch_state_.http_response_code; | 447 << fetch_state_.http_response_code; |
443 | 448 |
444 source->GetResponseAsString(&fetch_state_.response_content); | 449 source->GetResponseAsString(&fetch_state_.response_content); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 int64 sane_time_ms = 0; | 538 int64 sane_time_ms = 0; |
534 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { | 539 if (base::StringToInt64(sane_time_str, &sane_time_ms)) { |
535 network_time_update_callback_.Run( | 540 network_time_update_callback_.Run( |
536 base::Time::FromJsTime(sane_time_ms), | 541 base::Time::FromJsTime(sane_time_ms), |
537 base::TimeDelta::FromMilliseconds(1), | 542 base::TimeDelta::FromMilliseconds(1), |
538 fetch_state_.end_time - fetch_state_.start_time); | 543 fetch_state_.end_time - fetch_state_.start_time); |
539 } | 544 } |
540 } | 545 } |
541 | 546 |
542 } // namespace syncer | 547 } // namespace syncer |
OLD | NEW |