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

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

Issue 2859393002: Report page load timing information for child frames. (Closed)
Patch Set: rebase 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
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc » ('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 "chrome/browser/page_load_metrics/metrics_web_contents_observer.h" 5 #include "chrome/browser/page_load_metrics/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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 } 592 }
593 593
594 if (!web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) { 594 if (!web_contents()->GetLastCommittedURL().SchemeIsHTTPOrHTTPS()) {
595 RecordInternalError(ERR_IPC_FROM_BAD_URL_SCHEME); 595 RecordInternalError(ERR_IPC_FROM_BAD_URL_SCHEME);
596 error = true; 596 error = true;
597 } 597 }
598 598
599 if (error) 599 if (error)
600 return; 600 return;
601 601
602 if (render_frame_host->GetParent() != nullptr) { 602 const bool is_main_frame = (render_frame_host->GetParent() == nullptr);
603 // Child frames may send PageLoadMetadata updates, but not PageLoadTiming 603 if (is_main_frame) {
604 // updates. 604 committed_load_->UpdateTiming(timing, metadata);
605 if (!timing.IsEmpty()) 605 } else {
606 RecordInternalError(ERR_TIMING_IPC_FROM_SUBFRAME); 606 committed_load_->UpdateSubFrameTiming(render_frame_host, timing, metadata);
607 committed_load_->UpdateChildFrameMetadata(metadata);
608 return;
609 } 607 }
610 608
611 committed_load_->UpdateTiming(timing, metadata);
612
613 for (auto& observer : testing_observers_) 609 for (auto& observer : testing_observers_)
614 observer.OnTimingUpdated(true /* is_main_frame */, timing, metadata); 610 observer.OnTimingUpdated(is_main_frame, timing, metadata);
615 } 611 }
616 612
617 bool MetricsWebContentsObserver::ShouldTrackNavigation( 613 bool MetricsWebContentsObserver::ShouldTrackNavigation(
618 content::NavigationHandle* navigation_handle) const { 614 content::NavigationHandle* navigation_handle) const {
619 DCHECK(navigation_handle->IsInMainFrame()); 615 DCHECK(navigation_handle->IsInMainFrame());
620 DCHECK(!navigation_handle->HasCommitted() || 616 DCHECK(!navigation_handle->HasCommitted() ||
621 !navigation_handle->IsSameDocument()); 617 !navigation_handle->IsSameDocument());
622 618
623 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(), 619 return BrowserPageTrackDecider(embedder_interface_.get(), web_contents(),
624 navigation_handle).ShouldTrack(); 620 navigation_handle).ShouldTrack();
(...skipping 21 matching lines...) Expand all
646 observer_->RemoveTestingObserver(this); 642 observer_->RemoveTestingObserver(this);
647 observer_ = nullptr; 643 observer_ = nullptr;
648 } 644 }
649 } 645 }
650 646
651 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() { 647 void MetricsWebContentsObserver::TestingObserver::OnGoingAway() {
652 observer_ = nullptr; 648 observer_ = nullptr;
653 } 649 }
654 650
655 } // namespace page_load_metrics 651 } // namespace page_load_metrics
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/page_load_metrics/metrics_web_contents_observer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698