OLD | NEW |
---|---|
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "components/page_load_metrics/browser/page_load_metrics_observer.h" | 5 #include "components/page_load_metrics/browser/page_load_metrics_observer.h" |
6 | 6 |
7 namespace page_load_metrics { | 7 namespace page_load_metrics { |
8 | 8 |
9 PageLoadExtraInfo::PageLoadExtraInfo( | 9 PageLoadExtraInfo::PageLoadExtraInfo( |
10 const base::TimeDelta& first_background_time, | 10 const base::TimeDelta& first_background_time, |
11 const base::TimeDelta& first_foreground_time, | 11 const base::TimeDelta& first_foreground_time, |
12 bool started_in_foreground) | 12 bool started_in_foreground, |
13 bool has_commit) | |
13 : first_background_time(first_background_time), | 14 : first_background_time(first_background_time), |
14 first_foreground_time(first_foreground_time), | 15 first_foreground_time(first_foreground_time), |
15 started_in_foreground(started_in_foreground) {} | 16 started_in_foreground(started_in_foreground), |
17 has_commit(has_commit) {} | |
18 | |
19 PageLoadMetricsObserver::PageLoadMetricsObserver( | |
20 PageLoadMetricsObservable* observable) | |
21 : observable_(observable) { | |
22 observable_->AddObserver(this); | |
23 } | |
24 | |
25 void PageLoadMetricsObserver::OnPageLoadMetricsGoingAway() { | |
26 observable_->RemoveObserver(this); | |
27 delete this; | |
Randy Smith (Not in Mondays)
2015/11/28 22:03:13
I'm concerned about the confusion in ownership imp
Charlie Harrison
2015/11/30 16:39:29
Your suggestion sgtm, I might add a StopObserving(
| |
28 } | |
29 | |
30 void PageLoadMetricsObserver::Observe(PageLoadMetricsObservable* observable) { | |
31 observable_ = observable; | |
32 observable->AddObserver(this); | |
33 } | |
16 | 34 |
17 } // namespace page_load_metrics | 35 } // namespace page_load_metrics |
OLD | NEW |