Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 2151363003: Split redirect delay metrics into separate histograms. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/page_load_metrics/browser/metrics_web_contents_observer.h" 5 #include "components/page_load_metrics/browser/metrics_web_contents_observer.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
(...skipping 29 matching lines...) Expand all
40 const char kAbortChainSizeReload[] = 40 const char kAbortChainSizeReload[] =
41 "PageLoad.Internal.ProvisionalAbortChainSize.Reload"; 41 "PageLoad.Internal.ProvisionalAbortChainSize.Reload";
42 const char kAbortChainSizeForwardBack[] = 42 const char kAbortChainSizeForwardBack[] =
43 "PageLoad.Internal.ProvisionalAbortChainSize.ForwardBack"; 43 "PageLoad.Internal.ProvisionalAbortChainSize.ForwardBack";
44 const char kAbortChainSizeNewNavigation[] = 44 const char kAbortChainSizeNewNavigation[] =
45 "PageLoad.Internal.ProvisionalAbortChainSize.NewNavigation"; 45 "PageLoad.Internal.ProvisionalAbortChainSize.NewNavigation";
46 const char kAbortChainSizeSameURL[] = 46 const char kAbortChainSizeSameURL[] =
47 "PageLoad.Internal.ProvisionalAbortChainSize.SameURL"; 47 "PageLoad.Internal.ProvisionalAbortChainSize.SameURL";
48 const char kAbortChainSizeNoCommit[] = 48 const char kAbortChainSizeNoCommit[] =
49 "PageLoad.Internal.ProvisionalAbortChainSize.NoCommit"; 49 "PageLoad.Internal.ProvisionalAbortChainSize.NoCommit";
50 const char kClientRedirectDelayAfterPaint[] = 50 const char kClientRedirectFirstPaintToNavigation[] =
51 "PageLoad.Internal.ClientRedirectDelayAfterPaint"; 51 "PageLoad.Internal.ClientRedirect.FirstPaintToNavigation";
52 const char kClientRedirectWithoutPaint[] =
53 "PageLoad.Internal.ClientRedirect.NavigationWithoutPaint";
52 54
53 } // namespace internal 55 } // namespace internal
54 56
55 namespace { 57 namespace {
56 58
57 // Helper to allow use of Optional<> values in LOG() messages. 59 // Helper to allow use of Optional<> values in LOG() messages.
58 std::ostream& operator<<(std::ostream& os, 60 std::ostream& operator<<(std::ostream& os,
59 const base::Optional<base::TimeDelta>& opt) { 61 const base::Optional<base::TimeDelta>& opt) {
60 if (opt) 62 if (opt)
61 os << opt.value(); 63 os << opt.value();
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 } 381 }
380 382
381 void PageLoadTracker::OnInputEvent(const blink::WebInputEvent& event) { 383 void PageLoadTracker::OnInputEvent(const blink::WebInputEvent& event) {
382 for (const auto& observer : observers_) { 384 for (const auto& observer : observers_) {
383 observer->OnUserInput(event); 385 observer->OnUserInput(event);
384 } 386 }
385 } 387 }
386 388
387 void PageLoadTracker::NotifyClientRedirectTo( 389 void PageLoadTracker::NotifyClientRedirectTo(
388 const PageLoadTracker& destination) { 390 const PageLoadTracker& destination) {
389 base::TimeDelta redirect_delay_after_paint;
390 if (timing_.first_paint) { 391 if (timing_.first_paint) {
391 base::TimeTicks first_paint_time = 392 base::TimeTicks first_paint_time =
392 navigation_start() + timing_.first_paint.value(); 393 navigation_start() + timing_.first_paint.value();
394 base::TimeDelta first_paint_to_navigation;
393 if (destination.navigation_start() > first_paint_time) 395 if (destination.navigation_start() > first_paint_time)
394 redirect_delay_after_paint = 396 first_paint_to_navigation =
395 destination.navigation_start() - first_paint_time; 397 destination.navigation_start() - first_paint_time;
398 PAGE_LOAD_HISTOGRAM(internal::kClientRedirectFirstPaintToNavigation,
399 first_paint_to_navigation);
400 } else {
401 UMA_HISTOGRAM_BOOLEAN(internal::kClientRedirectWithoutPaint, true);
396 } 402 }
397 PAGE_LOAD_HISTOGRAM(internal::kClientRedirectDelayAfterPaint,
398 redirect_delay_after_paint);
399 } 403 }
400 404
401 bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing, 405 bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing,
402 const PageLoadMetadata& new_metadata) { 406 const PageLoadMetadata& new_metadata) {
403 // Throw away IPCs that are not relevant to the current navigation. 407 // Throw away IPCs that are not relevant to the current navigation.
404 // Two timing structures cannot refer to the same navigation if they indicate 408 // Two timing structures cannot refer to the same navigation if they indicate
405 // that a navigation started at different times, so a new timing struct with a 409 // that a navigation started at different times, so a new timing struct with a
406 // different start time from an earlier struct is considered invalid. 410 // different start time from an earlier struct is considered invalid.
407 bool valid_timing_descendent = 411 bool valid_timing_descendent =
408 timing_.navigation_start.is_null() || 412 timing_.navigation_start.is_null() ||
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage()) 939 if (navigation_handle->IsSamePage() || navigation_handle->IsErrorPage())
936 return false; 940 return false;
937 const std::string& mime_type = web_contents()->GetContentsMimeType(); 941 const std::string& mime_type = web_contents()->GetContentsMimeType();
938 if (mime_type != "text/html" && mime_type != "application/xhtml+xml") 942 if (mime_type != "text/html" && mime_type != "application/xhtml+xml")
939 return false; 943 return false;
940 } 944 }
941 return true; 945 return true;
942 } 946 }
943 947
944 } // namespace page_load_metrics 948 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698