| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/safe_browsing/incident_reporting/environment_data_colle
ction.h" | 5 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle
ction.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
| 11 #include "base/cpu.h" | 11 #include "base/cpu.h" |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
| 15 #include "base/threading/sequenced_worker_pool.h" | 15 #include "base/threading/sequenced_worker_pool.h" |
| 16 #include "base/threading/thread_restrictions.h" |
| 16 #include "build/build_config.h" | 17 #include "build/build_config.h" |
| 17 #include "chrome/common/channel_info.h" | 18 #include "chrome/common/channel_info.h" |
| 18 #include "components/safe_browsing/csd.pb.h" | 19 #include "components/safe_browsing/csd.pb.h" |
| 19 #include "components/version_info/version_info.h" | 20 #include "components/version_info/version_info.h" |
| 20 #include "content/public/browser/browser_thread.h" | 21 #include "content/public/browser/browser_thread.h" |
| 21 | 22 |
| 22 namespace safe_browsing { | 23 namespace safe_browsing { |
| 23 | 24 |
| 24 // Populates |process| with platform-specific data related to the chrome browser | 25 // Populates |process| with platform-specific data related to the chrome browser |
| 25 // process. | 26 // process. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 process->set_chrome_update_channel( | 64 process->set_chrome_update_channel( |
| 64 MapChannelToProtobuf(chrome::GetChannel())); | 65 MapChannelToProtobuf(chrome::GetChannel())); |
| 65 | 66 |
| 66 CollectPlatformProcessData(process); | 67 CollectPlatformProcessData(process); |
| 67 } | 68 } |
| 68 | 69 |
| 69 } // namespace | 70 } // namespace |
| 70 | 71 |
| 71 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { | 72 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { |
| 72 // Toggling priority only makes sense in a thread pool. | 73 // Toggling priority only makes sense in a thread pool. |
| 73 DCHECK(content::BrowserThread::GetBlockingPool()->RunsTasksOnCurrentThread()); | 74 base::ThreadRestrictions::AssertIOAllowed(); |
| 74 // Reset priority when done with this task. | 75 // Reset priority when done with this task. |
| 75 // TODO(fdoray): Post this task to the TaskScheduler with a BACKGROUND | 76 // TODO(fdoray): Post this task to the TaskScheduler with a BACKGROUND |
| 76 // priority instead of toggling the priority within the task. | 77 // priority instead of toggling the priority within the task. |
| 77 base::ScopedClosureRunner restore_priority( | 78 base::ScopedClosureRunner restore_priority( |
| 78 base::Bind(&base::PlatformThread::SetCurrentThreadPriority, | 79 base::Bind(&base::PlatformThread::SetCurrentThreadPriority, |
| 79 base::PlatformThread::GetCurrentThreadPriority())); | 80 base::PlatformThread::GetCurrentThreadPriority())); |
| 80 // Lower priority for this task. | 81 // Lower priority for this task. |
| 81 base::PlatformThread::SetCurrentThreadPriority( | 82 base::PlatformThread::SetCurrentThreadPriority( |
| 82 base::ThreadPriority::BACKGROUND); | 83 base::ThreadPriority::BACKGROUND); |
| 83 | 84 |
| (...skipping 26 matching lines...) Expand all Loading... |
| 110 // implementations. | 111 // implementations. |
| 111 } | 112 } |
| 112 | 113 |
| 113 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) { | 114 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) { |
| 114 // Empty implementation for platforms that do not (yet) have their own | 115 // Empty implementation for platforms that do not (yet) have their own |
| 115 // implementations. | 116 // implementations. |
| 116 } | 117 } |
| 117 #endif | 118 #endif |
| 118 | 119 |
| 119 } // namespace safe_browsing | 120 } // namespace safe_browsing |
| OLD | NEW |