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

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

Issue 2901383002: Buffer cross frame paint timing updates. (Closed)
Patch Set: fix android build 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
diff --git a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
index 647cf08d1c529b8f09895419a9fef53b6def2b53..2398fc4c5efba79fd64480c599037cf5b8ffea17 100644
--- a/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
+++ b/chrome/browser/page_load_metrics/metrics_web_contents_observer.cc
@@ -93,14 +93,23 @@ MetricsWebContentsObserver* MetricsWebContentsObserver::CreateForWebContents(
return metrics;
}
-MetricsWebContentsObserver::~MetricsWebContentsObserver() {
+MetricsWebContentsObserver::~MetricsWebContentsObserver() {}
+
+void MetricsWebContentsObserver::WebContentsDestroyed() {
// TODO(csharrison): Use a more user-initiated signal for CLOSE.
NotifyPageEndAllLoads(END_CLOSE, UserInitiatedInfo::NotUserInitiated());
+ // We tear down PageLoadTrackers in WebContentsDestroyed, rather than in the
+ // destructor, since |web_contents()| returns nullptr in the destructor, and
+ // PageLoadMetricsObservers can cause code to execute that wants to be able to
Charlie Harrison 2017/05/26 19:31:34 which code? It would be nice to be specific here i
Bryan McQuade 2017/05/26 20:07:32 any access to web_contents() in the context of a W
+ // access the current WebContents.
+ committed_load_ = nullptr;
+ provisional_loads_.clear();
+ aborted_provisional_loads_.clear();
+
for (auto& observer : testing_observers_)
observer.OnGoingAway();
}
-
void MetricsWebContentsObserver::RegisterInputEventObserver(
content::RenderViewHost* host) {
if (host != nullptr)

Powered by Google App Engine
This is Rietveld 408576698