Chromium Code Reviews| Index: chrome/browser/safe_browsing/incident_reporting/environment_data_collection.cc |
| diff --git a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection.cc b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection.cc |
| index f207502a3ac742370b8253646d1c654def211c02..069649e6d8739c317dc791fb4ee01420267ae134 100644 |
| --- a/chrome/browser/safe_browsing/incident_reporting/environment_data_collection.cc |
| +++ b/chrome/browser/safe_browsing/incident_reporting/environment_data_collection.cc |
| @@ -8,9 +8,11 @@ |
| #include "base/cpu.h" |
| #include "base/sys_info.h" |
| +#include "base/threading/platform_thread.h" |
| #include "chrome/common/channel_info.h" |
| #include "chrome/common/safe_browsing/csd.pb.h" |
| #include "components/version_info/version_info.h" |
| +#include "content/public/browser/browser_thread.h" |
| namespace safe_browsing { |
| @@ -62,6 +64,13 @@ void CollectProcessData(ClientIncidentReport_EnvironmentData_Process* process) { |
| } // namespace |
| void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { |
| + // Toggling priority only makes sense in a thread pool. |
| + DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); |
|
grt (UTC plus 2)
2015/12/09 14:35:25
i don't like the dependence on BrowserThread here.
gab
2015/12/09 21:51:01
Yea that works :-) (interestingly this call was re
proberge
2015/12/10 21:00:57
This doesn't run if there's no incident, but most
|
| + // Lower priority for this task. |
| + auto previous_priority = base::PlatformThread::GetCurrentThreadPriority(); |
| + base::PlatformThread::SetCurrentThreadPriority( |
| + base::ThreadPriority::BACKGROUND); |
| + |
| // OS |
| { |
| ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os(); |
| @@ -82,6 +91,9 @@ void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { |
| // Process |
| CollectProcessData(data->mutable_process()); |
| + |
| + // Reset the thread priority. |
| + base::PlatformThread::SetCurrentThreadPriority(previous_priority); |
| } |
| #if !defined(OS_WIN) |