| 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/loader/chrome_resource_dispatcher_host_delegate.h" | 5 #include "chrome/browser/loader/chrome_resource_dispatcher_host_delegate.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } else if (net_error == net::ERR_ABORTED) { | 348 } else if (net_error == net::ERR_ABORTED) { |
| 349 UMA_HISTOGRAM_LONG_TIMES("Net.NTP.Local.RequestTime2.ErrAborted", | 349 UMA_HISTOGRAM_LONG_TIMES("Net.NTP.Local.RequestTime2.ErrAborted", |
| 350 request_loading_time); | 350 request_loading_time); |
| 351 } | 351 } |
| 352 } | 352 } |
| 353 } | 353 } |
| 354 | 354 |
| 355 void NotifyUIThreadOfRequestComplete( | 355 void NotifyUIThreadOfRequestComplete( |
| 356 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, | 356 const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter, |
| 357 const GURL& url, | 357 const GURL& url, |
| 358 content::ResourceType resource_type, | 358 ResourceType resource_type, |
| 359 bool was_cached, | 359 bool was_cached, |
| 360 int net_error, | 360 int net_error, |
| 361 int64_t total_received_bytes, | 361 int64_t total_received_bytes, |
| 362 base::TimeDelta request_loading_time) { | 362 base::TimeDelta request_loading_time) { |
| 363 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 363 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 364 content::WebContents* web_contents = web_contents_getter.Run(); | 364 content::WebContents* web_contents = web_contents_getter.Run(); |
| 365 if (!web_contents) | 365 if (!web_contents) |
| 366 return; | 366 return; |
| 367 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { | 367 if (resource_type == content::RESOURCE_TYPE_MAIN_FRAME) { |
| 368 LogMainFrameMetricsOnUIThread(url, net_error, request_loading_time, | 368 LogMainFrameMetricsOnUIThread(url, net_error, request_loading_time, |
| (...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 888 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 888 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 889 base::Unretained(this), url, request_loading_time)); | 889 base::Unretained(this), url, request_loading_time)); |
| 890 return; | 890 return; |
| 891 } | 891 } |
| 892 | 892 |
| 893 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 893 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 894 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 894 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 895 rappor::SampleDomainAndRegistryFromGURL( | 895 rappor::SampleDomainAndRegistryFromGURL( |
| 896 g_browser_process->rappor_service(), metric_name, url); | 896 g_browser_process->rappor_service(), metric_name, url); |
| 897 } | 897 } |
| OLD | NEW |