Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
|
robertshield
2012/03/14 13:51:48
2012
MAD
2012/03/15 22:37:36
Done.
| |
| 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" |
| 11 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| (...skipping 25 matching lines...) Expand all Loading... | |
| 37 const wchar_t*); | 37 const wchar_t*); |
| 38 | 38 |
| 39 // exported in breakpad_win.cc: | 39 // exported in breakpad_win.cc: |
| 40 // void __declspec(dllexport) __cdecl SetNumberOfViews. | 40 // void __declspec(dllexport) __cdecl SetNumberOfViews. |
| 41 typedef void (__cdecl *MainSetNumberOfViews)(int); | 41 typedef void (__cdecl *MainSetNumberOfViews)(int); |
| 42 | 42 |
| 43 // exported in breakpad_win.cc: | 43 // exported in breakpad_win.cc: |
| 44 // void __declspec(dllexport) __cdecl SetCommandLine | 44 // void __declspec(dllexport) __cdecl SetCommandLine |
| 45 typedef void (__cdecl *MainSetCommandLine)(const CommandLine*); | 45 typedef void (__cdecl *MainSetCommandLine)(const CommandLine*); |
| 46 | 46 |
| 47 // exported in breakpad_win.cc: | |
| 48 // void __declspec(dllexport) __cdecl InitExperimentList | |
| 49 typedef void (__cdecl *MainInitExperimentList)(); | |
| 50 | |
| 51 // exported in breakpad_win.cc: | |
| 52 // void __declspec(dllexport) __cdecl AddFieldTrialGroup | |
| 53 typedef void (__cdecl *MainAddFieldTrialGroup)(const std::string&, | |
| 54 const std::string&); | |
| 55 | |
| 47 void SetActiveURL(const GURL& url) { | 56 void SetActiveURL(const GURL& url) { |
| 48 static MainSetActiveURL set_active_url = NULL; | 57 static MainSetActiveURL set_active_url = NULL; |
| 49 // note: benign race condition on set_active_url. | 58 // note: benign race condition on set_active_url. |
| 50 if (!set_active_url) { | 59 if (!set_active_url) { |
| 51 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 60 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 52 if (!exe_module) | 61 if (!exe_module) |
| 53 return; | 62 return; |
| 54 set_active_url = reinterpret_cast<MainSetActiveURL>( | 63 set_active_url = reinterpret_cast<MainSetActiveURL>( |
| 55 GetProcAddress(exe_module, "SetActiveURL")); | 64 GetProcAddress(exe_module, "SetActiveURL")); |
| 56 if (!set_active_url) | 65 if (!set_active_url) |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 if (!exe_module) | 166 if (!exe_module) |
| 158 return; | 167 return; |
| 159 set_command_line = reinterpret_cast<MainSetCommandLine>( | 168 set_command_line = reinterpret_cast<MainSetCommandLine>( |
| 160 GetProcAddress(exe_module, "SetCommandLine")); | 169 GetProcAddress(exe_module, "SetCommandLine")); |
| 161 if (!set_command_line) | 170 if (!set_command_line) |
| 162 return; | 171 return; |
| 163 } | 172 } |
| 164 (set_command_line)(command_line); | 173 (set_command_line)(command_line); |
| 165 } | 174 } |
| 166 | 175 |
| 176 void InitExperimentList() { | |
| 177 static MainInitExperimentList init_experiment_list = NULL; | |
| 178 if (!init_experiment_list) { | |
| 179 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | |
| 180 if (!exe_module) | |
| 181 return; | |
| 182 init_experiment_list = reinterpret_cast<MainInitExperimentList>( | |
| 183 GetProcAddress(exe_module, "InitExperimentList")); | |
| 184 if (!init_experiment_list) | |
| 185 return; | |
| 186 } | |
| 187 (init_experiment_list)(); | |
| 188 } | |
| 189 | |
| 190 void AddFieldTrialGroup(const std::string& field_trial_name, | |
| 191 const std::string& group_name) { | |
| 192 static MainAddFieldTrialGroup add_field_trial_group = NULL; | |
| 193 if (!add_field_trial_group) { | |
| 194 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | |
| 195 if (!exe_module) | |
| 196 return; | |
| 197 add_field_trial_group = reinterpret_cast<MainAddFieldTrialGroup>( | |
| 198 GetProcAddress(exe_module, "AddFieldTrialGroup")); | |
| 199 if (!add_field_trial_group) | |
| 200 return; | |
| 201 } | |
| 202 (add_field_trial_group)(field_trial_name, group_name); | |
| 203 } | |
| 204 | |
| 167 void SetNumberOfViews(int number_of_views) { | 205 void SetNumberOfViews(int number_of_views) { |
| 168 static MainSetNumberOfViews set_number_of_views = NULL; | 206 static MainSetNumberOfViews set_number_of_views = NULL; |
| 169 if (!set_number_of_views) { | 207 if (!set_number_of_views) { |
| 170 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 208 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 171 if (!exe_module) | 209 if (!exe_module) |
| 172 return; | 210 return; |
| 173 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( | 211 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( |
| 174 GetProcAddress(exe_module, "SetNumberOfViews")); | 212 GetProcAddress(exe_module, "SetNumberOfViews")); |
| 175 if (!set_number_of_views) | 213 if (!set_number_of_views) |
| 176 return; | 214 return; |
| 177 } | 215 } |
| 178 (set_number_of_views)(number_of_views); | 216 (set_number_of_views)(number_of_views); |
| 179 } | 217 } |
| 180 | 218 |
| 181 } // namespace child_process_logging | 219 } // namespace child_process_logging |
| OLD | NEW |