| 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_histograms.h" | 5 #include "chrome/browser/prerender/prerender_histograms.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 // FirstAfterMissNonOverlapping but NOT FirstAfterMiss | 234 // FirstAfterMissNonOverlapping but NOT FirstAfterMiss |
| 235 | 235 |
| 236 void PrerenderHistograms::RecordPerceivedPageLoadTime( | 236 void PrerenderHistograms::RecordPerceivedPageLoadTime( |
| 237 Origin origin, | 237 Origin origin, |
| 238 base::TimeDelta perceived_page_load_time, | 238 base::TimeDelta perceived_page_load_time, |
| 239 NavigationType navigation_type, | 239 NavigationType navigation_type, |
| 240 const GURL& url) { | 240 const GURL& url) { |
| 241 if (!url.SchemeIsHTTPOrHTTPS()) | 241 if (!url.SchemeIsHTTPOrHTTPS()) |
| 242 return; | 242 return; |
| 243 bool within_window = WithinWindow(); | 243 bool within_window = WithinWindow(); |
| 244 bool is_google_url = | |
| 245 google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN, | |
| 246 google_util::ALLOW_NON_STANDARD_PORTS); | |
| 247 RECORD_PLT("PerceivedPLT", perceived_page_load_time); | 244 RECORD_PLT("PerceivedPLT", perceived_page_load_time); |
| 248 if (within_window) | 245 if (within_window) |
| 249 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time); | 246 RECORD_PLT("PerceivedPLTWindowed", perceived_page_load_time); |
| 250 if (navigation_type != NAVIGATION_TYPE_NORMAL) { | 247 if (navigation_type != NAVIGATION_TYPE_NORMAL) { |
| 251 DCHECK(navigation_type == NAVIGATION_TYPE_PRERENDERED); | 248 DCHECK(navigation_type == NAVIGATION_TYPE_PRERENDERED); |
| 252 seen_any_pageload_ = true; | 249 seen_any_pageload_ = true; |
| 253 seen_pageload_started_after_prerender_ = true; | 250 seen_pageload_started_after_prerender_ = true; |
| 254 } else if (within_window) { | 251 } else if (within_window) { |
| 252 bool is_google_url = google_util::IsGoogleDomainUrl( |
| 253 url, google_util::DISALLOW_SUBDOMAIN, |
| 254 google_util::DISALLOW_NON_STANDARD_PORTS); |
| 255 if (!is_google_url) { | 255 if (!is_google_url) { |
| 256 bool recorded_any = false; | 256 bool recorded_any = false; |
| 257 bool recorded_non_overlapping = false; | 257 bool recorded_non_overlapping = false; |
| 258 if (!seen_any_pageload_) { | 258 if (!seen_any_pageload_) { |
| 259 seen_any_pageload_ = true; | 259 seen_any_pageload_ = true; |
| 260 RECORD_PLT("PerceivedPLTFirstAfterMiss", perceived_page_load_time); | 260 RECORD_PLT("PerceivedPLTFirstAfterMiss", perceived_page_load_time); |
| 261 recorded_any = true; | 261 recorded_any = true; |
| 262 } | 262 } |
| 263 if (!seen_pageload_started_after_prerender_ && | 263 if (!seen_pageload_started_after_prerender_ && |
| 264 perceived_page_load_time <= GetTimeSinceLastPrerender()) { | 264 perceived_page_load_time <= GetTimeSinceLastPrerender()) { |
| (...skipping 28 matching lines...) Expand all Loading... |
| 293 successful); | 293 successful); |
| 294 } | 294 } |
| 295 | 295 |
| 296 void PrerenderHistograms::RecordPageLoadTimeNotSwappedIn( | 296 void PrerenderHistograms::RecordPageLoadTimeNotSwappedIn( |
| 297 Origin origin, | 297 Origin origin, |
| 298 base::TimeDelta page_load_time, | 298 base::TimeDelta page_load_time, |
| 299 const GURL& url) const { | 299 const GURL& url) const { |
| 300 // If the URL to be prerendered is not a http[s] URL, or is a Google URL, | 300 // If the URL to be prerendered is not a http[s] URL, or is a Google URL, |
| 301 // do not record. | 301 // do not record. |
| 302 if (!url.SchemeIsHTTPOrHTTPS() || | 302 if (!url.SchemeIsHTTPOrHTTPS() || |
| 303 google_util::IsGoogleDomainUrl(url, google_util::DISALLOW_SUBDOMAIN, | 303 google_util::IsGoogleDomainUrl( |
| 304 google_util::ALLOW_NON_STANDARD_PORTS)) { | 304 url, google_util::DISALLOW_SUBDOMAIN, |
| 305 google_util::DISALLOW_NON_STANDARD_PORTS)) { |
| 305 return; | 306 return; |
| 306 } | 307 } |
| 307 RECORD_PLT("PrerenderNotSwappedInPLT", page_load_time); | 308 RECORD_PLT("PrerenderNotSwappedInPLT", page_load_time); |
| 308 } | 309 } |
| 309 | 310 |
| 310 void PrerenderHistograms::RecordPercentLoadDoneAtSwapin(Origin origin, | 311 void PrerenderHistograms::RecordPercentLoadDoneAtSwapin(Origin origin, |
| 311 double fraction) const { | 312 double fraction) const { |
| 312 if (fraction < 0.0 || fraction > 1.0) | 313 if (fraction < 0.0 || fraction > 1.0) |
| 313 return; | 314 return; |
| 314 int percentage = static_cast<int>(fraction * 100); | 315 int percentage = static_cast<int>(fraction * 100); |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 base::TimeDelta::FromMinutes(2), 50); | 476 base::TimeDelta::FromMinutes(2), 50); |
| 476 } | 477 } |
| 477 | 478 |
| 478 bool PrerenderHistograms::IsOriginWash() const { | 479 bool PrerenderHistograms::IsOriginWash() const { |
| 479 if (!WithinWindow()) | 480 if (!WithinWindow()) |
| 480 return false; | 481 return false; |
| 481 return origin_wash_; | 482 return origin_wash_; |
| 482 } | 483 } |
| 483 | 484 |
| 484 } // namespace prerender | 485 } // namespace prerender |
| OLD | NEW |