Chromium Code Reviews| Index: chrome/browser/metrics/thread_watcher.cc |
| diff --git a/chrome/browser/metrics/thread_watcher.cc b/chrome/browser/metrics/thread_watcher.cc |
| index 0f9e9acdca01058eda882f56fb5f7a7be549a0fd..8a846140add04b28c7dc03aef1ca7b50ecd44e63 100644 |
| --- a/chrome/browser/metrics/thread_watcher.cc |
| +++ b/chrome/browser/metrics/thread_watcher.cc |
| @@ -688,9 +688,10 @@ void ThreadWatcherObserver::SetupNotifications( |
| observer->registrar_.Add(observer, |
| content::NOTIFICATION_RENDER_WIDGET_HOST_HANG, |
| content::NotificationService::AllSources()); |
| - observer->registrar_.Add(observer, |
| - chrome::NOTIFICATION_OMNIBOX_OPENED_URL, |
| - content::NotificationService::AllSources()); |
| + observer->omnibox_url_opened_subscription_ = |
| + OmniboxEventGlobalTracker::GetInstance()->RegisterCallback( |
| + base::Bind(&ThreadWatcherObserver::OnURLOpenedFromOmnibox, |
| + base::Unretained(observer))); |
| } |
| // static |
| @@ -706,6 +707,13 @@ void ThreadWatcherObserver::Observe( |
| int type, |
| const content::NotificationSource& source, |
| const content::NotificationDetails& details) { |
| + OnUserActivityDetected(); |
| +} |
| + |
| +void ThreadWatcherObserver::OnURLOpenedFromOmnibox(OmniboxLog* log) { |
| + OnUserActivityDetected(); |
| +} |
|
Alexei Svitkine (slow)
2015/08/07 14:57:37
Nit: Add an empty line after this.
blundell
2015/08/17 09:24:01
Done.
|
| +void ThreadWatcherObserver::OnUserActivityDetected() { |
| // There is some user activity, see if thread watchers are to be awakened. |
| base::TimeTicks now = base::TimeTicks::Now(); |
| if ((now - last_wakeup_time_) < wakeup_interval_) |