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

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

Issue 2859393002: Report page load timing information for child frames. (Closed)
Patch Set: cleanup Created 3 years, 7 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 <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
319 timing.document_timing.first_layout.value()); 319 timing.document_timing.first_layout.value());
320 } else { 320 } else {
321 PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstLayout, 321 PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstLayout,
322 timing.document_timing.first_layout.value()); 322 timing.document_timing.first_layout.value());
323 } 323 }
324 } 324 }
325 325
326 void CorePageLoadMetricsObserver::OnFirstPaint( 326 void CorePageLoadMetricsObserver::OnFirstPaint(
327 const page_load_metrics::PageLoadTiming& timing, 327 const page_load_metrics::PageLoadTiming& timing,
328 const page_load_metrics::PageLoadExtraInfo& info) { 328 const page_load_metrics::PageLoadExtraInfo& info) {
329 if (!first_paint_.is_null())
330 return;
331
329 first_paint_ = 332 first_paint_ =
330 info.navigation_start + timing.paint_timing.first_paint.value(); 333 info.navigation_start + timing.paint_timing.first_paint.value();
331 if (WasStartedInForegroundOptionalEventInForeground( 334 if (WasStartedInForegroundOptionalEventInForeground(
332 timing.paint_timing.first_paint, info)) { 335 timing.paint_timing.first_paint, info)) {
333 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstPaint, 336 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstPaint,
334 timing.paint_timing.first_paint.value()); 337 timing.paint_timing.first_paint.value());
335 } else { 338 } else {
336 PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstPaint, 339 PAGE_LOAD_HISTOGRAM(internal::kBackgroundHistogramFirstPaint,
337 timing.paint_timing.first_paint.value()); 340 timing.paint_timing.first_paint.value());
338 } 341 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
677 extra_request_complete_info) { 680 extra_request_complete_info) {
678 if (extra_request_complete_info.was_cached) { 681 if (extra_request_complete_info.was_cached) {
679 ++num_cache_resources_; 682 ++num_cache_resources_;
680 cache_bytes_ += extra_request_complete_info.raw_body_bytes; 683 cache_bytes_ += extra_request_complete_info.raw_body_bytes;
681 } else { 684 } else {
682 ++num_network_resources_; 685 ++num_network_resources_;
683 network_bytes_ += extra_request_complete_info.raw_body_bytes; 686 network_bytes_ += extra_request_complete_info.raw_body_bytes;
684 } 687 }
685 } 688 }
686 689
690 void CorePageLoadMetricsObserver::OnSubFrameTimingUpdate(
691 FrameTreeNodeId child_frame_id,
692 base::TimeDelta child_navigation_start_offset,
693 const page_load_metrics::PageLoadTiming& child_timing,
694 const page_load_metrics::PageLoadMetadata& child_metadata,
695 const page_load_metrics::PageLoadExtraInfo& extra_info) {
696 // TODO(bmcquade): factor core FP/FCP logic across all frames into
697 // PageLoadTracker. This is just an initial implementation for demonstration
698 // purposes.
699 if (child_timing.paint_timing.first_paint && first_paint_.is_null()) {
700 base::TimeDelta first_paint_since_main_frame_navigation_start =
701 child_navigation_start_offset +
702 child_timing.paint_timing.first_paint.value();
703 first_paint_ = extra_info.navigation_start +
704 first_paint_since_main_frame_navigation_start;
705
706 if (WasStartedInForegroundOptionalEventInForeground(
707 first_paint_since_main_frame_navigation_start, extra_info)) {
708 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstPaint,
709 first_paint_since_main_frame_navigation_start);
710 }
711 }
712 }
713
687 void CorePageLoadMetricsObserver::RecordTimingHistograms( 714 void CorePageLoadMetricsObserver::RecordTimingHistograms(
688 const page_load_metrics::PageLoadTiming& timing, 715 const page_load_metrics::PageLoadTiming& timing,
689 const page_load_metrics::PageLoadExtraInfo& info) { 716 const page_load_metrics::PageLoadExtraInfo& info) {
690 // Log time to first foreground / time to first background. Log counts that we 717 // Log time to first foreground / time to first background. Log counts that we
691 // started a relevant page load in the foreground / background. 718 // started a relevant page load in the foreground / background.
692 if (!info.started_in_foreground && info.first_foreground_time) { 719 if (!info.started_in_foreground && info.first_foreground_time) {
693 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstForeground, 720 PAGE_LOAD_HISTOGRAM(internal::kHistogramFirstForeground,
694 info.first_foreground_time.value()); 721 info.first_foreground_time.value());
695 } 722 }
696 723
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
849 } 876 }
850 877
851 // Log the eTLD+1 of sites that did not report first meaningful paint. 878 // Log the eTLD+1 of sites that did not report first meaningful paint.
852 if (timing.paint_timing.first_paint && 879 if (timing.paint_timing.first_paint &&
853 !timing.paint_timing.first_meaningful_paint) { 880 !timing.paint_timing.first_meaningful_paint) {
854 rappor::SampleDomainAndRegistryFromGURL( 881 rappor::SampleDomainAndRegistryFromGURL(
855 rappor_service, 882 rappor_service,
856 internal::kRapporMetricsNameFirstMeaningfulPaintNotRecorded, info.url); 883 internal::kRapporMetricsNameFirstMeaningfulPaintNotRecorded, info.url);
857 } 884 }
858 } 885 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698