Chromium Code Reviews| Index: chrome/browser/ui/app_list/app_list_service_impl.cc |
| diff --git a/chrome/browser/ui/app_list/app_list_service_impl.cc b/chrome/browser/ui/app_list/app_list_service_impl.cc |
| index 171c8a68209d7a7dabcb19fbd63f660333b6443e..56c71d22f93771650e1a4a9420d655399bf878ff 100644 |
| --- a/chrome/browser/ui/app_list/app_list_service_impl.cc |
| +++ b/chrome/browser/ui/app_list/app_list_service_impl.cc |
| @@ -8,9 +8,12 @@ |
| #include "base/bind.h" |
| #include "base/command_line.h" |
| +#include "base/location.h" |
| #include "base/metrics/histogram.h" |
| #include "base/prefs/pref_service.h" |
| +#include "base/single_thread_task_runner.h" |
| #include "base/strings/string16.h" |
| +#include "base/thread_task_runner_handle.h" |
| #include "base/time/time.h" |
| #include "chrome/browser/browser_process.h" |
| #include "chrome/browser/browser_shutdown.h" |
| @@ -177,11 +180,9 @@ void RecordAppListDiscoverability(PrefService* local_state, |
| base::TimeDelta::FromMinutes(kDiscoverabilityTimeoutMinutes) - |
| base::Time::Now(); |
| if (time_remaining > base::TimeDelta()) { |
| - base::MessageLoop::current()->PostDelayedTask( |
| - FROM_HERE, |
| - base::Bind(&RecordAppListDiscoverability, |
| - base::Unretained(local_state), |
| - false), |
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| + FROM_HERE, base::Bind(&RecordAppListDiscoverability, |
| + base::Unretained(local_state), false), |
| time_remaining); |
| return; |
| } |
| @@ -420,11 +421,9 @@ void AppListServiceImpl::EnableAppList(Profile* initial_profile, |
| if (base::MessageLoop::current()) { |
|
msw
2015/06/09 00:51:56
Shouldn't this now check base::ThreadTaskRunnerHan
Sami
2015/06/09 10:20:08
Well spotted, thanks. Fixed here, below and in app
|
| // Ensure a value is recorded if the user "never" shows the app list. Note |
| // there is no message loop in unit tests. |
| - base::MessageLoop::current()->PostDelayedTask( |
| - FROM_HERE, |
| - base::Bind(&RecordAppListDiscoverability, |
| - base::Unretained(local_state_), |
| - false), |
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| + FROM_HERE, base::Bind(&RecordAppListDiscoverability, |
| + base::Unretained(local_state_), false), |
| base::TimeDelta::FromMinutes(kDiscoverabilityTimeoutMinutes)); |
| } |
| } |
| @@ -449,8 +448,7 @@ void AppListServiceImpl::PerformStartupChecks(Profile* initial_profile) { |
| // Send app list usage stats after a delay. |
| const int kSendUsageStatsDelay = 5; |
| - base::MessageLoop::current()->PostDelayedTask( |
| - FROM_HERE, |
| - base::Bind(&AppListServiceImpl::SendAppListStats), |
| + base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| + FROM_HERE, base::Bind(&AppListServiceImpl::SendAppListStats), |
| base::TimeDelta::FromSeconds(kSendUsageStatsDelay)); |
| } |