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 0c024231189deae3f1a36d11761dc614ac10ae6f..376e4f6f9cbe40c48a2211897facff95e442caaa 100644 |
--- a/chrome/browser/metrics/first_web_contents_profiler.h |
+++ b/chrome/browser/metrics/first_web_contents_profiler.h |
@@ -19,19 +19,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- |
@@ -50,8 +41,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; |
@@ -64,8 +55,7 @@ class FirstWebContentsProfiler : public content::WebContentsObserver { |
// Whether this instance has finished collecting all of its metrics. |
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); |
// Initialize histograms for unresponsiveness metrics. |
@@ -82,9 +72,6 @@ class FirstWebContentsProfiler : public content::WebContentsObserver { |
// Whether an attempt was made to collect the "MainFrameLoad" metric. |
bool collected_load_metric_; |
- // |delegate_| owns |this|. |
- Delegate* delegate_; |
- |
// Histogram that keeps track of response times for the watched thread. |
base::HistogramBase* responsiveness_histogram_; |