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

Unified Diff: chrome/browser/metrics/first_web_contents_profiler.cc

Issue 1415773004: Refactor ownership model for FirstWebContentsProfiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@a1_more_abandons_and_umabandons
Patch Set: fix compile Created 5 years, 2 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 | « chrome/browser/metrics/first_web_contents_profiler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/metrics/first_web_contents_profiler.cc
diff --git a/chrome/browser/metrics/first_web_contents_profiler.cc b/chrome/browser/metrics/first_web_contents_profiler.cc
index 86fd62067fc4039e35f52940c4372c8bfc2e93db..a95ff37d65df883ea517cd442d3dd8f612f1e33f 100644
--- a/chrome/browser/metrics/first_web_contents_profiler.cc
+++ b/chrome/browser/metrics/first_web_contents_profiler.cc
@@ -97,30 +97,25 @@ void MeasureUIResponsiveness(base::HistogramBase* responsiveness_histogram,
} // namespace
-scoped_ptr<FirstWebContentsProfiler>
-FirstWebContentsProfiler::CreateProfilerForFirstWebContents(
- Delegate* delegate) {
- DCHECK(delegate);
- for (chrome::BrowserIterator iterator; !iterator.done(); iterator.Next()) {
- Browser* browser = *iterator;
+// static
+void FirstWebContentsProfiler::Start() {
+ for (chrome::BrowserIterator browser_it; !browser_it.done();
+ browser_it.Next()) {
content::WebContents* web_contents =
- browser->tab_strip_model()->GetActiveWebContents();
+ browser_it->tab_strip_model()->GetActiveWebContents();
if (web_contents) {
- return scoped_ptr<FirstWebContentsProfiler>(
- new FirstWebContentsProfiler(web_contents, delegate));
+ new FirstWebContentsProfiler(web_contents);
Alexei Svitkine (slow) 2015/11/13 17:29:00 Add a comment about the lifetime here.
gab 2015/11/13 19:22:21 Good point, done.
+ return;
}
}
- return nullptr;
}
FirstWebContentsProfiler::FirstWebContentsProfiler(
- content::WebContents* web_contents,
- Delegate* delegate)
+ content::WebContents* web_contents)
: content::WebContentsObserver(web_contents),
initial_entry_committed_(false),
collected_paint_metric_(false),
collected_load_metric_(false),
- delegate_(delegate),
responsiveness_histogram_(NULL),
responsiveness_1sec_histogram_(NULL),
responsiveness_10sec_histogram_(NULL),
@@ -225,7 +220,7 @@ void FirstWebContentsProfiler::FinishedCollectingMetrics(
UMA_HISTOGRAM_ENUMERATION("Startup.FirstWebContents.FinishReason_NoLoad",
finish_reason, FinishReason::ENUM_MAX);
}
- delegate_->ProfilerFinishedCollectingMetrics();
+ delete this;
}
void FirstWebContentsProfiler::InitHistograms() {
« no previous file with comments | « chrome/browser/metrics/first_web_contents_profiler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698