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

Side by Side Diff: chrome/common/child_process_logging_win.cc

Issue 10422019: Rename some chrome.exe exports: SetCommandLine --> SetCommandLine2, SetExperimentList --> SetExperi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add comments on why the new name Created 8 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/app/breakpad_win.cc ('k') | 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/common/child_process_logging.h" 5 #include "chrome/common/child_process_logging.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 30 matching lines...) Expand all
41 41
42 // exported in breakpad_win.cc: 42 // exported in breakpad_win.cc:
43 // void __declspec(dllexport) __cdecl SetPrinterInfo. 43 // void __declspec(dllexport) __cdecl SetPrinterInfo.
44 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*); 44 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*);
45 45
46 // exported in breakpad_win.cc: 46 // exported in breakpad_win.cc:
47 // void __declspec(dllexport) __cdecl SetNumberOfViews. 47 // void __declspec(dllexport) __cdecl SetNumberOfViews.
48 typedef void (__cdecl *MainSetNumberOfViews)(int); 48 typedef void (__cdecl *MainSetNumberOfViews)(int);
49 49
50 // exported in breakpad_win.cc: 50 // exported in breakpad_win.cc:
51 // void __declspec(dllexport) __cdecl SetCommandLine 51 // void __declspec(dllexport) __cdecl SetCommandLine2
52 typedef void (__cdecl *MainSetCommandLine)(const wchar_t**, size_t); 52 typedef void (__cdecl *MainSetCommandLine)(const wchar_t**, size_t);
53 53
54 // exported in breakpad_field_trial_win.cc: 54 // exported in breakpad_field_trial_win.cc:
55 // void __declspec(dllexport) __cdecl SetExperimentList 55 // void __declspec(dllexport) __cdecl SetExperimentList2
56 typedef void (__cdecl *MainSetExperimentList)(const wchar_t**, size_t); 56 typedef void (__cdecl *MainSetExperimentList)(const wchar_t**, size_t);
57 57
58 // Copied from breakpad_win.cc. 58 // Copied from breakpad_win.cc.
59 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings, 59 void StringVectorToCStringVector(const std::vector<std::wstring>& wstrings,
60 std::vector<const wchar_t*>* cstrings) { 60 std::vector<const wchar_t*>* cstrings) {
61 cstrings->clear(); 61 cstrings->clear();
62 cstrings->reserve(wstrings.size()); 62 cstrings->reserve(wstrings.size());
63 for (size_t i = 0; i < wstrings.size(); ++i) 63 for (size_t i = 0; i < wstrings.size(); ++i)
64 cstrings->push_back(wstrings[i].c_str()); 64 cstrings->push_back(wstrings[i].c_str());
65 } 65 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 } 192 }
193 193
194 void SetCommandLine(const CommandLine* command_line) { 194 void SetCommandLine(const CommandLine* command_line) {
195 static MainSetCommandLine set_command_line = NULL; 195 static MainSetCommandLine set_command_line = NULL;
196 // note: benign race condition on set_command_line. 196 // note: benign race condition on set_command_line.
197 if (!set_command_line) { 197 if (!set_command_line) {
198 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); 198 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
199 if (!exe_module) 199 if (!exe_module)
200 return; 200 return;
201 set_command_line = reinterpret_cast<MainSetCommandLine>( 201 set_command_line = reinterpret_cast<MainSetCommandLine>(
202 GetProcAddress(exe_module, "SetCommandLine")); 202 GetProcAddress(exe_module, "SetCommandLine2"));
203 if (!set_command_line) 203 if (!set_command_line)
204 return; 204 return;
205 } 205 }
206 206
207 std::vector<const wchar_t*> cstrings; 207 std::vector<const wchar_t*> cstrings;
208 StringVectorToCStringVector(command_line->argv(), &cstrings); 208 StringVectorToCStringVector(command_line->argv(), &cstrings);
209 (set_command_line)(&cstrings[0], cstrings.size()); 209 (set_command_line)(&cstrings[0], cstrings.size());
210 } 210 }
211 211
212 void SetExperimentList(const std::vector<string16>& state) { 212 void SetExperimentList(const std::vector<string16>& state) {
213 static MainSetExperimentList set_experiment_list = NULL; 213 static MainSetExperimentList set_experiment_list = NULL;
214 // note: benign race condition on set_experiment_list. 214 // note: benign race condition on set_experiment_list.
215 if (!set_experiment_list) { 215 if (!set_experiment_list) {
216 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); 216 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
217 if (!exe_module) 217 if (!exe_module)
218 return; 218 return;
219 set_experiment_list = reinterpret_cast<MainSetExperimentList>( 219 set_experiment_list = reinterpret_cast<MainSetExperimentList>(
220 GetProcAddress(exe_module, "SetExperimentList")); 220 GetProcAddress(exe_module, "SetExperimentList2"));
221 if (!set_experiment_list) 221 if (!set_experiment_list)
222 return; 222 return;
223 } 223 }
224 224
225 std::vector<const wchar_t*> cstrings; 225 std::vector<const wchar_t*> cstrings;
226 StringVectorToCStringVector(state, &cstrings); 226 StringVectorToCStringVector(state, &cstrings);
227 (set_experiment_list)(&cstrings[0], cstrings.size()); 227 (set_experiment_list)(&cstrings[0], cstrings.size());
228 } 228 }
229 229
230 void SetNumberOfViews(int number_of_views) { 230 void SetNumberOfViews(int number_of_views) {
231 static MainSetNumberOfViews set_number_of_views = NULL; 231 static MainSetNumberOfViews set_number_of_views = NULL;
232 // note: benign race condition on set_number_of_views. 232 // note: benign race condition on set_number_of_views.
233 if (!set_number_of_views) { 233 if (!set_number_of_views) {
234 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); 234 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
235 if (!exe_module) 235 if (!exe_module)
236 return; 236 return;
237 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( 237 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>(
238 GetProcAddress(exe_module, "SetNumberOfViews")); 238 GetProcAddress(exe_module, "SetNumberOfViews"));
239 if (!set_number_of_views) 239 if (!set_number_of_views)
240 return; 240 return;
241 } 241 }
242 (set_number_of_views)(number_of_views); 242 (set_number_of_views)(number_of_views);
243 } 243 }
244 244
245 } // namespace child_process_logging 245 } // namespace child_process_logging
OLDNEW
« no previous file with comments | « chrome/app/breakpad_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698