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

Unified Diff: components/page_load_metrics/browser/metrics_web_contents_observer.cc

Issue 1900343003: Provide currently_committed_url to PageLoadMetricsObservers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
Patch Set: Created 4 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 side-by-side diff with in-line comments
Download patch
Index: components/page_load_metrics/browser/metrics_web_contents_observer.cc
diff --git a/components/page_load_metrics/browser/metrics_web_contents_observer.cc b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
index e1cc10d9451f1870f0929bd2c4c9f3ab61b24851..c5705732f61144dcebb8424f6531183a7ea0638a 100644
--- a/components/page_load_metrics/browser/metrics_web_contents_observer.cc
+++ b/components/page_load_metrics/browser/metrics_web_contents_observer.cc
@@ -207,6 +207,7 @@ void LogAbortChainSameURLHistogram(int aborted_chain_size_same_url) {
PageLoadTracker::PageLoadTracker(
bool in_foreground,
PageLoadMetricsEmbedderInterface* embedder_interface,
+ PageLoadTracker* const currently_committed_load_or_null,
content::NavigationHandle* navigation_handle,
int aborted_chain_size,
int aborted_chain_size_same_url)
@@ -220,8 +221,12 @@ PageLoadTracker::PageLoadTracker(
embedder_interface_(embedder_interface) {
DCHECK(!navigation_handle->HasCommitted());
embedder_interface_->RegisterObservers(this);
+ const GURL& currently_committed_url =
+ currently_committed_load_or_null
+ ? currently_committed_load_or_null->committed_url()
+ : GURL::EmptyGURL();
for (const auto& observer : observers_) {
- observer->OnStart(navigation_handle);
+ observer->OnStart(navigation_handle, currently_committed_url);
}
}
@@ -355,10 +360,6 @@ bool PageLoadTracker::UpdateTiming(const PageLoadTiming& new_timing,
return false;
}
-bool PageLoadTracker::HasBackgrounded() {
- return !started_in_foreground_ || !background_time_.is_null();
-}
-
void PageLoadTracker::set_renderer_tracked(bool renderer_tracked) {
renderer_tracked_ = renderer_tracked;
}
@@ -521,12 +522,13 @@ void MetricsWebContentsObserver::DidStartNavigation(
DCHECK_GT(2ul, provisional_loads_.size());
// Passing raw pointers to observers_ and embedder_interface_ is safe because
// the MetricsWebContentsObserver owns them both list and they are torn down
- // after the PageLoadTracker.
- provisional_loads_.insert(
- std::make_pair(navigation_handle,
- make_scoped_ptr(new PageLoadTracker(
- in_foreground_, embedder_interface_.get(),
- navigation_handle, chain_size, chain_size_same_url))));
+ // after the PageLoadTracker. The PageLoadTracker does not hold on to
+ // committed_load_ or navigation_handle beyond the scope of the constructor.
+ provisional_loads_.insert(std::make_pair(
+ navigation_handle,
+ make_scoped_ptr(new PageLoadTracker(
+ in_foreground_, embedder_interface_.get(), committed_load_.get(),
+ navigation_handle, chain_size, chain_size_same_url))));
}
void MetricsWebContentsObserver::DidFinishNavigation(

Powered by Google App Engine
This is Rietveld 408576698