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

Side by Side Diff: chrome/browser/page_load_metrics/observers/core_page_load_metrics_observer.cc

Issue 2780003003: Send an event to the page load metrics to track resource starting. (Closed)
Patch Set: CR feedback per RyanSturm Created 3 years, 8 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
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 "chrome/browser/page_load_metrics/observers/core_page_load_metrics_obse rver.h" 5 #include "chrome/browser/page_load_metrics/observers/core_page_load_metrics_obse rver.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
651 event.GetType() == blink::WebInputEvent::kGestureScrollBegin) { 651 event.GetType() == blink::WebInputEvent::kGestureScrollBegin) {
652 received_scroll_input_after_first_paint_ = true; 652 received_scroll_input_after_first_paint_ = true;
653 if (now.is_null()) 653 if (now.is_null())
654 now = base::TimeTicks::Now(); 654 now = base::TimeTicks::Now();
655 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstScrollInputAfterFirstPaint, 655 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstScrollInputAfterFirstPaint,
656 now - first_paint_); 656 now - first_paint_);
657 } 657 }
658 } 658 }
659 659
660 void CorePageLoadMetricsObserver::OnLoadedResource( 660 void CorePageLoadMetricsObserver::OnLoadedResource(
661 const page_load_metrics::ExtraRequestInfo& extra_request_info) { 661 const page_load_metrics::ExtraRequestCompleteInfo&
662 if (extra_request_info.was_cached) { 662 extra_request_complete_info) {
663 if (extra_request_complete_info.was_cached) {
663 ++num_cache_resources_; 664 ++num_cache_resources_;
664 cache_bytes_ += extra_request_info.raw_body_bytes; 665 cache_bytes_ += extra_request_complete_info.raw_body_bytes;
665 } else { 666 } else {
666 ++num_network_resources_; 667 ++num_network_resources_;
667 network_bytes_ += extra_request_info.raw_body_bytes; 668 network_bytes_ += extra_request_complete_info.raw_body_bytes;
668 } 669 }
669 } 670 }
670 671
671 void CorePageLoadMetricsObserver::RecordTimingHistograms( 672 void CorePageLoadMetricsObserver::RecordTimingHistograms(
672 const page_load_metrics::PageLoadTiming& timing, 673 const page_load_metrics::PageLoadTiming& timing,
673 const page_load_metrics::PageLoadExtraInfo& info) { 674 const page_load_metrics::PageLoadExtraInfo& info) {
674 // Log time to first foreground / time to first background. Log counts that we 675 // Log time to first foreground / time to first background. Log counts that we
675 // started a relevant page load in the foreground / background. 676 // started a relevant page load in the foreground / background.
676 if (!info.started_in_foreground && info.first_foreground_time) { 677 if (!info.started_in_foreground && info.first_foreground_time) {
677 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstForeground, 678 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstForeground,
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 } 827 }
827 828
828 // Log the eTLD+1 of sites that did not report first meaningful paint. 829 // Log the eTLD+1 of sites that did not report first meaningful paint.
829 if (timing.paint_timing.first_paint && 830 if (timing.paint_timing.first_paint &&
830 !timing.paint_timing.first_meaningful_paint) { 831 !timing.paint_timing.first_meaningful_paint) {
831 rappor::SampleDomainAndRegistryFromGURL( 832 rappor::SampleDomainAndRegistryFromGURL(
832 rappor_service, 833 rappor_service,
833 internal::kRapporMetricsNameFirstMeaningfulPaintNotRecorded, info.url); 834 internal::kRapporMetricsNameFirstMeaningfulPaintNotRecorded, info.url);
834 } 835 }
835 } 836 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698