Chromium Code Reviews| 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 "chrome/browser/net/http_pipelining_compatibility_client.h" | 5 #include "chrome/browser/net/http_pipelining_compatibility_client.h" |
| 6 | 6 |
| 7 #include "base/metrics/field_trial.h" | 7 #include "base/metrics/field_trial.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
| 11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
| 12 #include "chrome/browser/io_thread.h" | 12 #include "chrome/browser/io_thread.h" |
| 13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
| 14 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "net/base/load_flags.h" | 15 #include "net/base/load_flags.h" |
| 16 #include "net/base/network_change_notifier.h" | 16 #include "net/base/network_change_notifier.h" |
| 17 #include "net/base/request_priority.h" | 17 #include "net/base/request_priority.h" |
| 18 #include "net/disk_cache/histogram_macros.h" | |
| 19 #include "net/http/http_network_layer.h" | 18 #include "net/http/http_network_layer.h" |
| 20 #include "net/http/http_network_session.h" | 19 #include "net/http/http_network_session.h" |
| 21 #include "net/http/http_response_headers.h" | 20 #include "net/http/http_response_headers.h" |
| 22 #include "net/http/http_version.h" | 21 #include "net/http/http_version.h" |
| 23 #include "net/proxy/proxy_config.h" | 22 #include "net/proxy/proxy_config.h" |
| 24 #include "net/proxy/proxy_service.h" | 23 #include "net/proxy/proxy_service.h" |
| 25 #include "net/url_request/url_request_context.h" | 24 #include "net/url_request/url_request_context.h" |
| 26 #include "net/url_request/url_request_context_getter.h" | 25 #include "net/url_request/url_request_context_getter.h" |
| 27 | 26 |
| 27 | |
| 28 // This is included because the CACHE_HISTOGRAM_* macros allow dynamic metric | |
| 29 // names. | |
| 30 // TODO(gavinp,rvargas): Clean up this dependency by moving the needed | |
|
rvargas (doing something else)
2014/02/11 02:17:15
TODOs reference the person that added the line, no
gavinp
2014/02/11 16:12:45
Done.
However, do note that http://google-stylegu
| |
| 31 // functionality into base/. | |
| 32 #include "net/disk_cache/histogram_macros.h" | |
| 33 | |
| 28 namespace chrome_browser_net { | 34 namespace chrome_browser_net { |
| 29 | 35 |
| 30 static const int kCanaryRequestId = 999; | 36 static const int kCanaryRequestId = 999; |
| 31 | 37 |
| 32 namespace { | 38 namespace { |
| 33 | 39 |
| 34 // There is one Request per RequestInfo passed in to Start() above. | 40 // There is one Request per RequestInfo passed in to Start() above. |
| 35 class Request : public internal::PipelineTestRequest, | 41 class Request : public internal::PipelineTestRequest, |
| 36 public net::URLRequest::Delegate { | 42 public net::URLRequest::Delegate { |
| 37 public: | 43 public: |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 357 UMA_HISTOGRAM_BOOLEAN("NetConnectivity.Pipeline.CanarySuccess", success); | 363 UMA_HISTOGRAM_BOOLEAN("NetConnectivity.Pipeline.CanarySuccess", success); |
| 358 if (success) { | 364 if (success) { |
| 359 StartTestRequests(); | 365 StartTestRequests(); |
| 360 } else { | 366 } else { |
| 361 finished_callback_.Run(0); | 367 finished_callback_.Run(0); |
| 362 } | 368 } |
| 363 } | 369 } |
| 364 | 370 |
| 365 void HttpPipeliningCompatibilityClient::OnRequestFinished( | 371 void HttpPipeliningCompatibilityClient::OnRequestFinished( |
| 366 int request_id, internal::PipelineTestRequest::Status status) { | 372 int request_id, internal::PipelineTestRequest::Status status) { |
| 367 // The CACHE_HISTOGRAM_* macros are used, because they allow dynamic metric | |
| 368 // names. | |
| 369 CACHE_HISTOGRAM_ENUMERATION(GetMetricName(request_id, "Status"), | 373 CACHE_HISTOGRAM_ENUMERATION(GetMetricName(request_id, "Status"), |
| 370 status, | 374 status, |
| 371 internal::PipelineTestRequest::STATUS_MAX); | 375 internal::PipelineTestRequest::STATUS_MAX); |
| 372 | 376 |
| 373 ++num_finished_; | 377 ++num_finished_; |
| 374 if (status == internal::PipelineTestRequest::STATUS_SUCCESS) { | 378 if (status == internal::PipelineTestRequest::STATUS_SUCCESS) { |
| 375 ++num_succeeded_; | 379 ++num_succeeded_; |
| 376 } | 380 } |
| 377 if (num_finished_ == requests_.size()) { | 381 if (num_finished_ == requests_.size()) { |
| 378 UMA_HISTOGRAM_BOOLEAN("NetConnectivity.Pipeline.Success", | 382 UMA_HISTOGRAM_BOOLEAN("NetConnectivity.Pipeline.Success", |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 530 | 534 |
| 531 content::BrowserThread::PostTask( | 535 content::BrowserThread::PostTask( |
| 532 content::BrowserThread::IO, | 536 content::BrowserThread::IO, |
| 533 FROM_HERE, | 537 FROM_HERE, |
| 534 base::Bind(&CollectPipeliningCapabilityStatsOnIOThread, | 538 base::Bind(&CollectPipeliningCapabilityStatsOnIOThread, |
| 535 pipeline_test_server, | 539 pipeline_test_server, |
| 536 io_thread)); | 540 io_thread)); |
| 537 } | 541 } |
| 538 | 542 |
| 539 } // namespace chrome_browser_net | 543 } // namespace chrome_browser_net |
| OLD | NEW |