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

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: 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/cpu.h" 9 #include "base/cpu.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
11 #include "base/threading/platform_thread.h"
11 #include "chrome/common/channel_info.h" 12 #include "chrome/common/channel_info.h"
12 #include "chrome/common/safe_browsing/csd.pb.h" 13 #include "chrome/common/safe_browsing/csd.pb.h"
13 #include "components/version_info/version_info.h" 14 #include "components/version_info/version_info.h"
14 15
15 namespace safe_browsing { 16 namespace safe_browsing {
16 17
17 // Populates |process| with platform-specific data related to the chrome browser 18 // Populates |process| with platform-specific data related to the chrome browser
18 // process. 19 // process.
19 void CollectPlatformProcessData( 20 void CollectPlatformProcessData(
20 ClientIncidentReport_EnvironmentData_Process* process); 21 ClientIncidentReport_EnvironmentData_Process* process);
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 56
56 process->set_chrome_update_channel( 57 process->set_chrome_update_channel(
57 MapChannelToProtobuf(chrome::GetChannel())); 58 MapChannelToProtobuf(chrome::GetChannel()));
58 59
59 CollectPlatformProcessData(process); 60 CollectPlatformProcessData(process);
60 } 61 }
61 62
62 } // namespace 63 } // namespace
63 64
64 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) { 65 void CollectEnvironmentData(ClientIncidentReport_EnvironmentData* data) {
66 // Lower priority for this task.
gab 2015/12/08 16:21:33 If we're going to do this I think we should add:
proberge 2015/12/08 16:39:03 Done.
67 auto previous_priority = base::PlatformThread::GetCurrentThreadPriority();
68 base::PlatformThread::SetCurrentThreadPriority(
69 base::ThreadPriority::BACKGROUND);
70
65 // OS 71 // OS
66 { 72 {
67 ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os(); 73 ClientIncidentReport_EnvironmentData_OS* os = data->mutable_os();
68 os->set_os_name(base::SysInfo::OperatingSystemName()); 74 os->set_os_name(base::SysInfo::OperatingSystemName());
69 os->set_os_version(base::SysInfo::OperatingSystemVersion()); 75 os->set_os_version(base::SysInfo::OperatingSystemVersion());
70 CollectPlatformOSData(os); 76 CollectPlatformOSData(os);
71 } 77 }
72 78
73 // Machine 79 // Machine
74 { 80 {
75 base::CPU cpu_info; 81 base::CPU cpu_info;
76 ClientIncidentReport_EnvironmentData_Machine* machine = 82 ClientIncidentReport_EnvironmentData_Machine* machine =
77 data->mutable_machine(); 83 data->mutable_machine();
78 machine->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture()); 84 machine->set_cpu_architecture(base::SysInfo::OperatingSystemArchitecture());
79 machine->set_cpu_vendor(cpu_info.vendor_name()); 85 machine->set_cpu_vendor(cpu_info.vendor_name());
80 machine->set_cpuid(cpu_info.signature()); 86 machine->set_cpuid(cpu_info.signature());
81 } 87 }
82 88
83 // Process 89 // Process
84 CollectProcessData(data->mutable_process()); 90 CollectProcessData(data->mutable_process());
91
92 // Reset the thread priority.
93 base::PlatformThread::SetCurrentThreadPriority(previous_priority);
85 } 94 }
86 95
87 #if !defined(OS_WIN) 96 #if !defined(OS_WIN)
88 void CollectPlatformProcessData( 97 void CollectPlatformProcessData(
89 ClientIncidentReport_EnvironmentData_Process* process) { 98 ClientIncidentReport_EnvironmentData_Process* process) {
90 // Empty implementation for platforms that do not (yet) have their own 99 // Empty implementation for platforms that do not (yet) have their own
91 // implementations. 100 // implementations.
92 } 101 }
93 102
94 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) { 103 void CollectPlatformOSData(ClientIncidentReport_EnvironmentData_OS* os_data) {
95 // Empty implementation for platforms that do not (yet) have their own 104 // Empty implementation for platforms that do not (yet) have their own
96 // implementations. 105 // implementations.
97 } 106 }
98 #endif 107 #endif
99 108
100 } // namespace safe_browsing 109 } // 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