Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Side by Side Diff: chrome/browser/safe_browsing/incident_reporting/environment_data_collection.cc

Issue 1505813003: Lower the priority of environment and process data collection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move comment Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
10 #include "base/callback_helpers.h"
9 #include "base/cpu.h" 11 #include "base/cpu.h"
10 #include "base/sys_info.h" 12 #include "base/sys_info.h"
13 #include "base/threading/platform_thread.h"
14 #include "base/threading/sequenced_worker_pool.h"
11 #include "chrome/common/channel_info.h" 15 #include "chrome/common/channel_info.h"
12 #include "chrome/common/safe_browsing/csd.pb.h" 16 #include "chrome/common/safe_browsing/csd.pb.h"
13 #include "components/version_info/version_info.h" 17 #include "components/version_info/version_info.h"
14 18
15 namespace safe_browsing { 19 namespace safe_browsing {
16 20
17 // Populates |process| with platform-specific data related to the chrome browser 21 // Populates |process| with platform-specific data related to the chrome browser
18 // process. 22 // process.
19 void CollectPlatformProcessData( 23 void CollectPlatformProcessData(
20 ClientIncidentReport_EnvironmentData_Process* process); 24 ClientIncidentReport_EnvironmentData_Process* process);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 59
56 process->set_chrome_update_channel( 60 process->set_chrome_update_channel(
57 MapChannelToProtobuf(chrome::GetChannel())); 61 MapChannelToProtobuf(chrome::GetChannel()));
58 62
59 CollectPlatformProcessData(process); 63 CollectPlatformProcessData(process);
60 } 64 }
61 65
62 } // namespace 66 } // namespace
63 67
64 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { 68 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) {
69 // Toggling priority only makes sense in a thread pool.
70 DCHECK(base::SequencedWorkerPool::GetWorkerPoolForCurrentThread());
71 // Reset priority when done with this task.
72 base::ScopedClosureRunner restore_priority(
73 base::Bind(&base::PlatformThread::SetCurrentThreadPriority,
74 base::PlatformThread::GetCurrentThreadPriority()));
75 // Lower priority for this task.
76 base::PlatformThread::SetCurrentThreadPriority(
77 base::ThreadPriority::BACKGROUND);
78
65 // OS 79 // OS
66 { 80 {
67 ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os(); 81 ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os();
68 os->set_os_name(base::SysInfo::OperatingSystemName()); 82 os->set_os_name(base::SysInfo::OperatingSystemName());
69 os->set_os_version(base::SysInfo::OperatingSystemVersion()); 83 os->set_os_version(base::SysInfo::OperatingSystemVersion());
70 CollectPlatformOSData(os); 84 CollectPlatformOSData(os);
71 } 85 }
72 86
73 // Machine 87 // Machine
74 { 88 {
(...skipping 16 matching lines...) Expand all
91 // implementations. 105 // implementations.
92 } 106 }
93 107
94 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) { 108 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) {
95 // Empty implementation for platforms that do not (yet) have their own 109 // Empty implementation for platforms that do not (yet) have their own
96 // implementations. 110 // implementations.
97 } 111 }
98 #endif 112 #endif
99 113
100 } // namespace safe_browsing 114 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698