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

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

Issue 1961363003: Log an immediate variant of FirstContentfulPaint. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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 "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 <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
344 timing_.navigation_start.is_null() || 344 timing_.navigation_start.is_null() ||
345 timing_.navigation_start == new_timing.navigation_start; 345 timing_.navigation_start == new_timing.navigation_start;
346 // Ensure flags sent previously are still present in the new metadata fields. 346 // Ensure flags sent previously are still present in the new metadata fields.
347 bool valid_behavior_descendent = 347 bool valid_behavior_descendent =
348 (metadata_.behavior_flags & new_metadata.behavior_flags) == 348 (metadata_.behavior_flags & new_metadata.behavior_flags) ==
349 metadata_.behavior_flags; 349 metadata_.behavior_flags;
350 if (IsValidPageLoadTiming(new_timing) && valid_timing_descendent && 350 if (IsValidPageLoadTiming(new_timing) && valid_timing_descendent &&
351 valid_behavior_descendent) { 351 valid_behavior_descendent) {
352 timing_ = new_timing; 352 timing_ = new_timing;
353 metadata_ = new_metadata; 353 metadata_ = new_metadata;
354 const PageLoadExtraInfo info = GetPageLoadMetricsInfo();
355 for (const auto& observer : observers_) {
356 observer->OnTimingUpdate(timing_, info);
357 }
354 return true; 358 return true;
355 } 359 }
356 return false; 360 return false;
357 } 361 }
358 362
359 void PageLoadTracker::set_renderer_tracked(bool renderer_tracked) { 363 void PageLoadTracker::set_renderer_tracked(bool renderer_tracked) {
360 renderer_tracked_ = renderer_tracked; 364 renderer_tracked_ = renderer_tracked;
361 } 365 }
362 366
363 void PageLoadTracker::AddObserver( 367 void PageLoadTracker::AddObserver(
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 742
739 if (!committed_load_->UpdateTiming(timing, metadata)) { 743 if (!committed_load_->UpdateTiming(timing, metadata)) {
740 // If the page load tracker cannot update its timing, something is wrong 744 // If the page load tracker cannot update its timing, something is wrong
741 // with the IPC (it's from another load, or it's invalid in some other way). 745 // with the IPC (it's from another load, or it's invalid in some other way).
742 // We expect this to be a rare occurrence. 746 // We expect this to be a rare occurrence.
743 RecordInternalError(ERR_BAD_TIMING_IPC); 747 RecordInternalError(ERR_BAD_TIMING_IPC);
744 } 748 }
745 } 749 }
746 750
747 } // namespace page_load_metrics 751 } // namespace page_load_metrics
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698