OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
(...skipping 21 matching lines...) Expand all Loading... | |
32 | 32 |
33 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetGpuInfo. | 33 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetGpuInfo. |
34 typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*, | 34 typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*, |
35 const wchar_t*, const wchar_t*, | 35 const wchar_t*, const wchar_t*, |
36 const wchar_t*); | 36 const wchar_t*); |
37 | 37 |
38 // exported in breakpad_win.cc: | 38 // exported in breakpad_win.cc: |
39 // void __declspec(dllexport) __cdecl SetNumberOfViews. | 39 // void __declspec(dllexport) __cdecl SetNumberOfViews. |
40 typedef void (__cdecl *MainSetNumberOfViews)(int); | 40 typedef void (__cdecl *MainSetNumberOfViews)(int); |
41 | 41 |
42 // exported in breakpad_win.cc: | |
43 // void __declspec(dllexport) __cdecl SetCommandLineFromCurrent | |
44 typedef void (__cdecl *MainSetCommandLineFromCurrent)(void); | |
45 | |
42 void SetActiveURL(const GURL& url) { | 46 void SetActiveURL(const GURL& url) { |
43 static MainSetActiveURL set_active_url = NULL; | 47 static MainSetActiveURL set_active_url = NULL; |
44 // note: benign race condition on set_active_url. | 48 // note: benign race condition on set_active_url. |
45 if (!set_active_url) { | 49 if (!set_active_url) { |
46 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 50 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
47 if (!exe_module) | 51 if (!exe_module) |
48 return; | 52 return; |
49 set_active_url = reinterpret_cast<MainSetActiveURL>( | 53 set_active_url = reinterpret_cast<MainSetActiveURL>( |
50 GetProcAddress(exe_module, "SetActiveURL")); | 54 GetProcAddress(exe_module, "SetActiveURL")); |
51 if (!set_active_url) | 55 if (!set_active_url) |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
138 return; | 142 return; |
139 } | 143 } |
140 (set_gpu_info)( | 144 (set_gpu_info)( |
141 base::StringPrintf(L"0x%04x", gpu_info.vendor_id).c_str(), | 145 base::StringPrintf(L"0x%04x", gpu_info.vendor_id).c_str(), |
142 base::StringPrintf(L"0x%04x", gpu_info.device_id).c_str(), | 146 base::StringPrintf(L"0x%04x", gpu_info.device_id).c_str(), |
143 UTF8ToUTF16(gpu_info.driver_version).c_str(), | 147 UTF8ToUTF16(gpu_info.driver_version).c_str(), |
144 UTF8ToUTF16(gpu_info.pixel_shader_version).c_str(), | 148 UTF8ToUTF16(gpu_info.pixel_shader_version).c_str(), |
145 UTF8ToUTF16(gpu_info.vertex_shader_version).c_str()); | 149 UTF8ToUTF16(gpu_info.vertex_shader_version).c_str()); |
146 } | 150 } |
147 | 151 |
152 void SetCommandLineFromCurrent() { | |
153 static MainSetCommandLineFromCurrent set_command_line = NULL; | |
154 if (!set_command_line) { | |
155 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | |
156 if (!exe_module) | |
Nico
2011/09/13 23:04:41
DCHECK?
eroman
2011/09/13 23:27:32
I just copy-pasted this from the other functions i
| |
157 return; | |
158 set_command_line = reinterpret_cast<MainSetCommandLineFromCurrent>( | |
159 GetProcAddress(exe_module, "SetCommandLineFromCurrent")); | |
160 if (!set_command_line) | |
161 return; | |
162 } | |
163 (set_command_line)(); | |
164 } | |
165 | |
148 void SetNumberOfViews(int number_of_views) { | 166 void SetNumberOfViews(int number_of_views) { |
149 static MainSetNumberOfViews set_number_of_views = NULL; | 167 static MainSetNumberOfViews set_number_of_views = NULL; |
150 if (!set_number_of_views) { | 168 if (!set_number_of_views) { |
151 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 169 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
152 if (!exe_module) | 170 if (!exe_module) |
153 return; | 171 return; |
154 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( | 172 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( |
155 GetProcAddress(exe_module, "SetNumberOfViews")); | 173 GetProcAddress(exe_module, "SetNumberOfViews")); |
156 if (!set_number_of_views) | 174 if (!set_number_of_views) |
157 return; | 175 return; |
158 } | 176 } |
159 (set_number_of_views)(number_of_views); | 177 (set_number_of_views)(number_of_views); |
160 } | 178 } |
161 | 179 |
162 } // namespace child_process_logging | 180 } // namespace child_process_logging |
OLD | NEW |