| 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/renderer_host/chrome_resource_dispatcher_host_delegate.
h" | 5 #include "chrome/browser/renderer_host/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 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 return NULL; | 151 return NULL; |
| 152 | 152 |
| 153 content::BrowserContext* browser_context = web_contents->GetBrowserContext(); | 153 content::BrowserContext* browser_context = web_contents->GetBrowserContext(); |
| 154 if (!browser_context) | 154 if (!browser_context) |
| 155 return NULL; | 155 return NULL; |
| 156 | 156 |
| 157 Profile* profile = Profile::FromBrowserContext(browser_context); | 157 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 158 if (!profile) | 158 if (!profile) |
| 159 return NULL; | 159 return NULL; |
| 160 | 160 |
| 161 return prerender::PrerenderManagerFactory::GetForProfile(profile); | 161 return prerender::PrerenderManagerFactory::GetForBrowserContext(profile); |
| 162 } | 162 } |
| 163 | 163 |
| 164 void UpdatePrerenderNetworkBytesCallback(content::WebContents* web_contents, | 164 void UpdatePrerenderNetworkBytesCallback(content::WebContents* web_contents, |
| 165 int64_t bytes) { | 165 int64_t bytes) { |
| 166 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 166 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 167 // PrerenderContents::FromWebContents handles the NULL case. | 167 // PrerenderContents::FromWebContents handles the NULL case. |
| 168 prerender::PrerenderContents* prerender_contents = | 168 prerender::PrerenderContents* prerender_contents = |
| 169 prerender::PrerenderContents::FromWebContents(web_contents); | 169 prerender::PrerenderContents::FromWebContents(web_contents); |
| 170 | 170 |
| 171 if (prerender_contents) | 171 if (prerender_contents) |
| (...skipping 707 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 879 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, | 879 base::Bind(&ChromeResourceDispatcherHostDelegate::OnAbortedFrameLoad, |
| 880 base::Unretained(this), url, request_loading_time)); | 880 base::Unretained(this), url, request_loading_time)); |
| 881 return; | 881 return; |
| 882 } | 882 } |
| 883 | 883 |
| 884 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? | 884 std::string metric_name = (request_loading_time.InMilliseconds() < 100 ? |
| 885 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); | 885 "Net.ErrAborted.Fast" : "Net.ErrAborted.Slow"); |
| 886 rappor::SampleDomainAndRegistryFromGURL( | 886 rappor::SampleDomainAndRegistryFromGURL( |
| 887 g_browser_process->rappor_service(), metric_name, url); | 887 g_browser_process->rappor_service(), metric_name, url); |
| 888 } | 888 } |
| OLD | NEW |