| 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/command_line.h" |
| 9 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| 10 #include "base/string_number_conversions.h" | 11 #include "base/string_number_conversions.h" |
| 11 #include "base/stringprintf.h" | 12 #include "base/stringprintf.h" |
| 12 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/common/chrome_constants.h" | 14 #include "chrome/common/chrome_constants.h" |
| 14 #include "chrome/installer/util/google_update_settings.h" | 15 #include "chrome/installer/util/google_update_settings.h" |
| 15 #include "content/common/gpu/gpu_info.h" | 16 #include "content/common/gpu/gpu_info.h" |
| 16 #include "googleurl/src/gurl.h" | 17 #include "googleurl/src/gurl.h" |
| 17 | 18 |
| 18 namespace child_process_logging { | 19 namespace child_process_logging { |
| (...skipping 13 matching lines...) Expand all Loading... |
| 32 | 33 |
| 33 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetGpuInfo. | 34 // exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetGpuInfo. |
| 34 typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*, | 35 typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*, |
| 35 const wchar_t*, const wchar_t*, | 36 const wchar_t*, const wchar_t*, |
| 36 const wchar_t*); | 37 const wchar_t*); |
| 37 | 38 |
| 38 // exported in breakpad_win.cc: | 39 // exported in breakpad_win.cc: |
| 39 // void __declspec(dllexport) __cdecl SetNumberOfViews. | 40 // void __declspec(dllexport) __cdecl SetNumberOfViews. |
| 40 typedef void (__cdecl *MainSetNumberOfViews)(int); | 41 typedef void (__cdecl *MainSetNumberOfViews)(int); |
| 41 | 42 |
| 43 // exported in breakpad_win.cc: |
| 44 // void __declspec(dllexport) __cdecl SetCommandLine |
| 45 typedef void (__cdecl *MainSetCommandLine)(const CommandLine*); |
| 46 |
| 42 void SetActiveURL(const GURL& url) { | 47 void SetActiveURL(const GURL& url) { |
| 43 static MainSetActiveURL set_active_url = NULL; | 48 static MainSetActiveURL set_active_url = NULL; |
| 44 // note: benign race condition on set_active_url. | 49 // note: benign race condition on set_active_url. |
| 45 if (!set_active_url) { | 50 if (!set_active_url) { |
| 46 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 51 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 47 if (!exe_module) | 52 if (!exe_module) |
| 48 return; | 53 return; |
| 49 set_active_url = reinterpret_cast<MainSetActiveURL>( | 54 set_active_url = reinterpret_cast<MainSetActiveURL>( |
| 50 GetProcAddress(exe_module, "SetActiveURL")); | 55 GetProcAddress(exe_module, "SetActiveURL")); |
| 51 if (!set_active_url) | 56 if (!set_active_url) |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 return; | 143 return; |
| 139 } | 144 } |
| 140 (set_gpu_info)( | 145 (set_gpu_info)( |
| 141 base::StringPrintf(L"0x%04x", gpu_info.vendor_id).c_str(), | 146 base::StringPrintf(L"0x%04x", gpu_info.vendor_id).c_str(), |
| 142 base::StringPrintf(L"0x%04x", gpu_info.device_id).c_str(), | 147 base::StringPrintf(L"0x%04x", gpu_info.device_id).c_str(), |
| 143 UTF8ToUTF16(gpu_info.driver_version).c_str(), | 148 UTF8ToUTF16(gpu_info.driver_version).c_str(), |
| 144 UTF8ToUTF16(gpu_info.pixel_shader_version).c_str(), | 149 UTF8ToUTF16(gpu_info.pixel_shader_version).c_str(), |
| 145 UTF8ToUTF16(gpu_info.vertex_shader_version).c_str()); | 150 UTF8ToUTF16(gpu_info.vertex_shader_version).c_str()); |
| 146 } | 151 } |
| 147 | 152 |
| 153 void SetCommandLine(const CommandLine* command_line) { |
| 154 static MainSetCommandLine set_command_line = NULL; |
| 155 if (!set_command_line) { |
| 156 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 157 if (!exe_module) |
| 158 return; |
| 159 set_command_line = reinterpret_cast<MainSetCommandLine>( |
| 160 GetProcAddress(exe_module, "SetCommandLine")); |
| 161 if (!set_command_line) |
| 162 return; |
| 163 } |
| 164 (set_command_line)(command_line); |
| 165 } |
| 166 |
| 148 void SetNumberOfViews(int number_of_views) { | 167 void SetNumberOfViews(int number_of_views) { |
| 149 static MainSetNumberOfViews set_number_of_views = NULL; | 168 static MainSetNumberOfViews set_number_of_views = NULL; |
| 150 if (!set_number_of_views) { | 169 if (!set_number_of_views) { |
| 151 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 170 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
| 152 if (!exe_module) | 171 if (!exe_module) |
| 153 return; | 172 return; |
| 154 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( | 173 set_number_of_views = reinterpret_cast<MainSetNumberOfViews>( |
| 155 GetProcAddress(exe_module, "SetNumberOfViews")); | 174 GetProcAddress(exe_module, "SetNumberOfViews")); |
| 156 if (!set_number_of_views) | 175 if (!set_number_of_views) |
| 157 return; | 176 return; |
| 158 } | 177 } |
| 159 (set_number_of_views)(number_of_views); | 178 (set_number_of_views)(number_of_views); |
| 160 } | 179 } |
| 161 | 180 |
| 162 } // namespace child_process_logging | 181 } // namespace child_process_logging |
| OLD | NEW |