| 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/prerender/prerender_tab_helper.h" | 5 #include "chrome/browser/prerender/prerender_tab_helper.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/prerender/prerender_histograms.h" | 10 #include "chrome/browser/prerender/prerender_histograms.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 | 98 |
| 99 // Reset the PPLT metric. | 99 // Reset the PPLT metric. |
| 100 pplt_load_start_ = base::TimeTicks(); | 100 pplt_load_start_ = base::TimeTicks(); |
| 101 actual_load_start_ = base::TimeTicks(); | 101 actual_load_start_ = base::TimeTicks(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void PrerenderTabHelper::DidStartProvisionalLoadForFrame( | 104 void PrerenderTabHelper::DidStartProvisionalLoadForFrame( |
| 105 content::RenderFrameHost* render_frame_host, | 105 content::RenderFrameHost* render_frame_host, |
| 106 const GURL& validated_url, | 106 const GURL& validated_url, |
| 107 bool is_error_page, | 107 bool is_error_page) { |
| 108 bool is_iframe_srcdoc) { | |
| 109 if (render_frame_host->GetParent()) | 108 if (render_frame_host->GetParent()) |
| 110 return; | 109 return; |
| 111 | 110 |
| 112 // Record PPLT state for the beginning of a new navigation. | 111 // Record PPLT state for the beginning of a new navigation. |
| 113 pplt_load_start_ = base::TimeTicks::Now(); | 112 pplt_load_start_ = base::TimeTicks::Now(); |
| 114 actual_load_start_ = base::TimeTicks(); | 113 actual_load_start_ = base::TimeTicks(); |
| 115 | 114 |
| 116 if (next_load_is_control_prerender_) { | 115 if (next_load_is_control_prerender_) { |
| 117 DCHECK_EQ(NAVIGATION_TYPE_NORMAL, navigation_type_); | 116 DCHECK_EQ(NAVIGATION_TYPE_NORMAL, navigation_type_); |
| 118 navigation_type_ = NAVIGATION_TYPE_WOULD_HAVE_BEEN_PRERENDERED; | 117 navigation_type_ = NAVIGATION_TYPE_WOULD_HAVE_BEEN_PRERENDERED; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 prerender_manager->RecordPerceivedPageLoadTime( | 175 prerender_manager->RecordPerceivedPageLoadTime( |
| 177 origin_, navigation_type_, perceived_page_load_time, | 176 origin_, navigation_type_, perceived_page_load_time, |
| 178 fraction_plt_elapsed_at_swap_in, url_); | 177 fraction_plt_elapsed_at_swap_in, url_); |
| 179 | 178 |
| 180 // Reset state for the next navigation. | 179 // Reset state for the next navigation. |
| 181 navigation_type_ = NAVIGATION_TYPE_NORMAL; | 180 navigation_type_ = NAVIGATION_TYPE_NORMAL; |
| 182 origin_ = ORIGIN_NONE; | 181 origin_ = ORIGIN_NONE; |
| 183 } | 182 } |
| 184 | 183 |
| 185 } // namespace prerender | 184 } // namespace prerender |
| OLD | NEW |