Index: chrome/browser/metrics/first_web_contents_profiler.h |
diff --git a/chrome/browser/metrics/first_web_contents_profiler.h b/chrome/browser/metrics/first_web_contents_profiler.h |
index d35c98a75ab89d59505a37d738b2e526b32ddc5b..2cace6a8a4111edfc16cc40c97b99505dc897c78 100644 |
--- a/chrome/browser/metrics/first_web_contents_profiler.h |
+++ b/chrome/browser/metrics/first_web_contents_profiler.h |
@@ -18,19 +18,10 @@ class WebContents; |
// class. |
class FirstWebContentsProfiler : public content::WebContentsObserver { |
public: |
- class Delegate { |
- public: |
- // Called by the FirstWebContentsProfiler when it is finished collecting |
- // metrics. The delegate should take this opportunity to destroy the |
- // FirstWebContentsProfiler. |
- virtual void ProfilerFinishedCollectingMetrics() = 0; |
- }; |
- |
// Creates a profiler for the active web contents. If there are multiple |
- // browsers, the first one is chosen. If there are no browsers, returns |
- // nullptr. |
- static scoped_ptr<FirstWebContentsProfiler> CreateProfilerForFirstWebContents( |
- Delegate* delegate); |
+ // browsers, the first one is chosen. The resulting FirstWebContentsProfiler |
+ // owns itself. |
+ static void Start(); |
private: |
// Reasons for which profiling is deemed complete. Logged in UMA (do not re- |
@@ -51,8 +42,8 @@ class FirstWebContentsProfiler : public content::WebContentsObserver { |
ENUM_MAX |
}; |
- FirstWebContentsProfiler(content::WebContents* web_contents, |
- Delegate* delegate); |
+ explicit FirstWebContentsProfiler(content::WebContents* web_contents); |
+ ~FirstWebContentsProfiler() override = default; |
// content::WebContentsObserver: |
void DidFirstVisuallyNonEmptyPaint() override; |
@@ -69,8 +60,7 @@ class FirstWebContentsProfiler : public content::WebContentsObserver { |
// prevent the FirstWebContentsProfiler from calling it). |
bool IsFinishedCollectingMetrics(); |
- // Informs the delegate that this instance has finished collecting all of its |
- // metrics. Logs |finish_reason| to UMA. |
+ // Logs |finish_reason| to UMA and deletes this FirstWebContentsProfiler. |
void FinishedCollectingMetrics(FinishReason finish_reason); |
// Whether an attempt was made to collect the "NonEmptyPaint" metric. |
@@ -90,9 +80,6 @@ class FirstWebContentsProfiler : public content::WebContentsObserver { |
// between the old and new stats. TODO(gab): Remove this in M49. |
bool finished_; |
- // |delegate_| owns |this|. |
- Delegate* delegate_; |
- |
DISALLOW_COPY_AND_ASSIGN(FirstWebContentsProfiler); |
}; |