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

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

Issue 776903002: Cleanup: Remove some unneeded string allocations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win Created 6 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
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_win.h" 5 #include "chrome/browser/safe_browsing/incident_reporting/environment_data_colle ction_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <set> 8 #include <set>
9 9
10 #include "base/i18n/case_conversion.h" 10 #include "base/i18n/case_conversion.h"
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 for (size_t i = 0; i < num_modules_to_verify; ++i) { 117 for (size_t i = 0; i < num_modules_to_verify; ++i) {
118 std::set<std::string> modified_exports; 118 std::set<std::string> modified_exports;
119 int modified = VerifyModule(modules_to_verify[i], &modified_exports); 119 int modified = VerifyModule(modules_to_verify[i], &modified_exports);
120 120
121 if (modified == MODULE_STATE_UNMODIFIED) 121 if (modified == MODULE_STATE_UNMODIFIED)
122 continue; 122 continue;
123 123
124 ClientIncidentReport_EnvironmentData_Process_ModuleState* module_state = 124 ClientIncidentReport_EnvironmentData_Process_ModuleState* module_state =
125 process->add_module_state(); 125 process->add_module_state();
126 126
127 module_state->set_name( 127 module_state->set_name(base::WideToUTF8(modules_to_verify[i]));
brettw 2014/12/03 21:12:21 Note that this is the same since there's no wide s
128 base::WideToUTF8(std::wstring(modules_to_verify[i])));
129 // Add 1 to the ModuleState enum to get the corresponding value in the 128 // Add 1 to the ModuleState enum to get the corresponding value in the
130 // protobuf's ModuleState enum. 129 // protobuf's ModuleState enum.
131 module_state->set_modified_state(static_cast< 130 module_state->set_modified_state(static_cast<
132 ClientIncidentReport_EnvironmentData_Process_ModuleState_ModifiedState>( 131 ClientIncidentReport_EnvironmentData_Process_ModuleState_ModifiedState>(
133 modified + 1)); 132 modified + 1));
134 for (std::set<std::string>::iterator it = modified_exports.begin(); 133 for (std::set<std::string>::iterator it = modified_exports.begin();
135 it != modified_exports.end(); 134 it != modified_exports.end();
136 ++it) { 135 ++it) {
137 module_state->add_modified_export(*it); 136 module_state->add_modified_export(*it);
138 } 137 }
139 } 138 }
140 } 139 }
141 140
142 void CollectPlatformProcessData( 141 void CollectPlatformProcessData(
143 ClientIncidentReport_EnvironmentData_Process* process) { 142 ClientIncidentReport_EnvironmentData_Process* process) {
144 CollectDlls(process); 143 CollectDlls(process);
145 RecordLspFeature(process); 144 RecordLspFeature(process);
146 CollectDllBlacklistData(process); 145 CollectDllBlacklistData(process);
147 CollectModuleVerificationData( 146 CollectModuleVerificationData(
148 kModulesToVerify, arraysize(kModulesToVerify), process); 147 kModulesToVerify, arraysize(kModulesToVerify), process);
149 } 148 }
150 149
151 } // namespace safe_browsing 150 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698