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

Unified Diff: chrome/browser/ui/webui/extensions/extensions_ui.cc

Issue 2348383004: [Extensions] Fix crash in chrome://extensions metrics (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/extensions/extensions_ui.cc
diff --git a/chrome/browser/ui/webui/extensions/extensions_ui.cc b/chrome/browser/ui/webui/extensions/extensions_ui.cc
index e12444139d8881f8c7d4fce262c77d2fdf1720e7..fad560c61c532a7bb4cdb63d533f7063b9ea121f 100644
--- a/chrome/browser/ui/webui/extensions/extensions_ui.cc
+++ b/chrome/browser/ui/webui/extensions/extensions_ui.cc
@@ -56,8 +56,10 @@ class ExtensionWebUiTimer : public content::WebContentsObserver {
void DocumentLoadedInFrame(
content::RenderFrameHost* render_frame_host) override {
- if (render_frame_host != web_contents()->GetMainFrame())
+ if (render_frame_host != web_contents()->GetMainFrame() ||
+ !timer_) { // See comment in DocumentOnLoadCompletedInMainFrame()
return;
+ }
if (is_md_) {
UMA_HISTOGRAM_TIMES("Extensions.WebUi.DocumentLoadedInMainFrameTime.MD",
timer_->Elapsed());
@@ -68,6 +70,12 @@ class ExtensionWebUiTimer : public content::WebContentsObserver {
}
void DocumentOnLoadCompletedInMainFrame() override {
+ // Sometimes*, DidStartProvisionalLoadForFrame() isn't called before this
+ // or DocumentLoadedInFrame(). Don't log anything in those cases.
+ // *This appears to be for in-page navigations like hash changes.
+ // TODO(devlin): The usefulness of these metrics remains to be seen.
+ if (!timer_)
+ return;
if (is_md_) {
UMA_HISTOGRAM_TIMES("Extensions.WebUi.LoadCompletedInMainFrame.MD",
timer_->Elapsed());
@@ -75,6 +83,7 @@ class ExtensionWebUiTimer : public content::WebContentsObserver {
UMA_HISTOGRAM_TIMES("Extensions.WebUi.LoadCompletedInMainFrame.Uber",
timer_->Elapsed());
}
+ timer_.reset();
}
void WebContentsDestroyed() override { delete this; }
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698