Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 41 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*); | 41 typedef void (__cdecl *MainSetPrinterInfo)(const wchar_t*); |
| 42 | 42 |
| 43 // exported in breakpad_win.cc: | 43 // exported in breakpad_win.cc: |
| 44 // void __declspec(dllexport) __cdecl SetNumberOfViews. | 44 // void __declspec(dllexport) __cdecl SetNumberOfViews. |
| 45 typedef void (__cdecl *MainSetNumberOfViews)(int); | 45 typedef void (__cdecl *MainSetNumberOfViews)(int); |
| 46 | 46 |
| 47 // exported in breakpad_win.cc: | 47 // exported in breakpad_win.cc: |
| 48 // void __declspec(dllexport) __cdecl SetCommandLine | 48 // void __declspec(dllexport) __cdecl SetCommandLine |
| 49 typedef void (__cdecl *MainSetCommandLine)(const CommandLine*); | 49 typedef void (__cdecl *MainSetCommandLine)(const CommandLine*); |
| 50 | 50 |
| 51 // exported in breakpad_field_trial_win.cc: | |
| 52 // void __declspec(dllexport) __cdecl SetExperimentList | |
| 53 typedef void (__cdecl *MainSetExperimentList)(const std::vector<string16>&); | |
| 54 | |
| 51 void SetActiveURL(const GURL& url) { | 55 void SetActiveURL(const GURL& url) { |
| 52 static MainSetActiveURL set_active_url = NULL; | 56 static MainSetActiveURL set_active_url = NULL; |
| 53 // note: benign race condition on set_active_url. | 57 // note: benign race condition on set_active_url. |
| 54 if (!set_active_url) { | 58 if (!set_active_url) { |
| 55 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 59 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 56 if (!exe_module) | 60 if (!exe_module) |
| 57 return; | 61 return; |
| 58 set_active_url = reinterpret_cast<MainSetActiveURL>( | 62 set_active_url = reinterpret_cast<MainSetActiveURL>( |
| 59 GetProcAddress(exe_module, "SetActiveURL")); | 63 GetProcAddress(exe_module, "SetActiveURL")); |
| 60 if (!set_active_url) | 64 if (!set_active_url) |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 175 if (!exe_module) | 179 if (!exe_module) |
| 176 return; | 180 return; |
| 177 set_command_line = reinterpret_cast<MainSetCommandLine>( | 181 set_command_line = reinterpret_cast<MainSetCommandLine>( |
| 178 GetProcAddress(exe_module, "SetCommandLine")); | 182 GetProcAddress(exe_module, "SetCommandLine")); |
| 179 if (!set_command_line) | 183 if (!set_command_line) |
| 180 return; | 184 return; |
| 181 } | 185 } |
| 182 (set_command_line)(command_line); | 186 (set_command_line)(command_line); |
| 183 } | 187 } |
| 184 | 188 |
| 189 void SetExperimentList(const std::vector<string16>& state) { | |
| 190 static MainSetExperimentList init_experiment_list = NULL; | |
|
robertshield
2012/04/05 00:36:41
Note that this is not thread safe, which probably
MAD
2012/04/05 02:31:12
Done.
| |
| 191 if (!init_experiment_list) { | |
| 192 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | |
| 193 if (!exe_module) | |
| 194 return; | |
| 195 init_experiment_list = reinterpret_cast<MainSetExperimentList>( | |
| 196 GetProcAddress(exe_module, "SetExperimentList")); | |
| 197 if (!init_experiment_list) | |
| 198 return; | |
| 199 } | |
| 200 (init_experiment_list)(state); | |
| 201 } | |
| 202 | |
| 185 void SetNumberOfViews(int number_of_views) { | 203 void SetNumberOfViews(int number_of_views) { |
| 186 static MainSetNumberOfViews set_number_of_views = NULL; | 204 static MainSetNumberOfViews set_number_of_views = NULL; |
| 187 if (!set_number_of_views) { | 205 if (!set_number_of_views) { |
| 188 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 206 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 189 if (!exe_module) | 207 if (!exe_module) |
| 190 return; | 208 return; |
| 191 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( | 209 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( |
| 192 GetProcAddress(exe_module, "SetNumberOfViews")); | 210 GetProcAddress(exe_module, "SetNumberOfViews")); |
| 193 if (!set_number_of_views) | 211 if (!set_number_of_views) |
| 194 return; | 212 return; |
| 195 } | 213 } |
| 196 (set_number_of_views)(number_of_views); | 214 (set_number_of_views)(number_of_views); |
| 197 } | 215 } |
| 198 | 216 |
| 199 } // namespace child_process_logging | 217 } // namespace child_process_logging |
| OLD | NEW |