diff options
author | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-19 07:51:33 +0000 |
---|---|---|
committer | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-19 07:51:33 +0000 |
commit | a110dd1ff6a3b8507ee164ababea537df52642cb (patch) | |
tree | 46853998912416850c21a7e944777065fdbbbc73 /chrome | |
parent | 52de9b3eb755b02c6ac52b741daa7ad7f333cd91 (diff) | |
download | chromium_src-a110dd1ff6a3b8507ee164ababea537df52642cb.zip chromium_src-a110dd1ff6a3b8507ee164ababea537df52642cb.tar.gz chromium_src-a110dd1ff6a3b8507ee164ababea537df52642cb.tar.bz2 |
Adding gpu_info to the breakpad info collection before sending off a crash.
BUG=38737
TEST=none
Review URL: http://codereview.chromium.org/3034004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@52884 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/app/breakpad_win.cc | 36 | ||||
-rw-r--r-- | chrome/browser/gpu_process_host.cc | 2 | ||||
-rw-r--r-- | chrome/common/child_process_logging.h | 4 | ||||
-rw-r--r-- | chrome/common/child_process_logging_linux.cc | 6 | ||||
-rw-r--r-- | chrome/common/child_process_logging_mac.mm | 37 | ||||
-rw-r--r-- | chrome/common/child_process_logging_win.cc | 23 |
6 files changed, 107 insertions, 1 deletions
diff --git a/chrome/app/breakpad_win.cc b/chrome/app/breakpad_win.cc index 07da749..ff0a0d9 100644 --- a/chrome/app/breakpad_win.cc +++ b/chrome/app/breakpad_win.cc @@ -62,6 +62,7 @@ static std::vector<google_breakpad::CustomInfoEntry>* g_custom_entries = NULL; static size_t g_url_chunks_offset; static size_t g_extension_ids_offset; static size_t g_client_id_offset; +static size_t g_gpu_info_offset; // Dumps the current process memory. extern "C" void __declspec(dllexport) __cdecl DumpProcess() { @@ -118,6 +119,18 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& dll_path, StringPrintf(L"extension-%i", i + 1).c_str(), L"")); } + // Add empty values for the gpu_info. We'll put the actual values + // when we collect them at this location. + g_gpu_info_offset = g_custom_entries->size(); + g_custom_entries->push_back(google_breakpad::CustomInfoEntry(L"venid", L"")); + g_custom_entries->push_back(google_breakpad::CustomInfoEntry(L"devid", L"")); + g_custom_entries->push_back( + google_breakpad::CustomInfoEntry(L"driver", L"")); + g_custom_entries->push_back( + google_breakpad::CustomInfoEntry(L"psver", L"")); + g_custom_entries->push_back( + google_breakpad::CustomInfoEntry(L"vsver", L"")); + // Read the id from registry. If reporting has never been enabled // the result will be empty string. Its OK since when user enables reporting // we will insert the new value at this location. @@ -127,7 +140,7 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const std::wstring& dll_path, g_custom_entries->push_back( google_breakpad::CustomInfoEntry(L"guid", guid.c_str())); - if (type == L"renderer" || type == L"plugin") { + if (type == L"renderer" || type == L"plugin" || type == L"gpu-process") { // Create entries for the URL. Currently we only allow each chunk to be 64 // characters, which isn't enough for a URL. As a hack we create 8 entries // and split the URL across the g_custom_entries. @@ -286,6 +299,27 @@ extern "C" void __declspec(dllexport) __cdecl SetExtensionID( id); } +extern "C" void __declspec(dllexport) __cdecl SetGpuInfo( + const wchar_t* vendor_id, const wchar_t* device_id, + const wchar_t* driver_version, const wchar_t* pixel_shader_version, + const wchar_t* vertex_shader_version) { + wcscpy_s((*g_custom_entries)[g_client_id_offset].value, + google_breakpad::CustomInfoEntry::kValueMaxLength, + vendor_id); + wcscpy_s((*g_custom_entries)[g_client_id_offset+1].value, + google_breakpad::CustomInfoEntry::kValueMaxLength, + device_id); + wcscpy_s((*g_custom_entries)[g_client_id_offset+2].value, + google_breakpad::CustomInfoEntry::kValueMaxLength, + driver_version); + wcscpy_s((*g_custom_entries)[g_client_id_offset+3].value, + google_breakpad::CustomInfoEntry::kValueMaxLength, + pixel_shader_version); + wcscpy_s((*g_custom_entries)[g_client_id_offset+4].value, + google_breakpad::CustomInfoEntry::kValueMaxLength, + vertex_shader_version); +} + } // namespace bool WrapMessageBoxWithSEH(const wchar_t* text, const wchar_t* caption, diff --git a/chrome/browser/gpu_process_host.cc b/chrome/browser/gpu_process_host.cc index 883f9be..cdf1102 100644 --- a/chrome/browser/gpu_process_host.cc +++ b/chrome/browser/gpu_process_host.cc @@ -10,6 +10,7 @@ #include "chrome/browser/browser_process.h" #include "chrome/browser/chrome_thread.h" #include "chrome/browser/gpu_process_host_ui_shim.h" +#include "chrome/common/child_process_logging.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/gpu_messages.h" #include "chrome/common/render_messages.h" @@ -182,6 +183,7 @@ void GpuProcessHost::OnChannelEstablished( ReplyToRenderer(channel_handle, request.filter); sent_requests_.pop(); gpu_info_ = gpu_info; + child_process_logging::SetGpuInfo(gpu_info); } void GpuProcessHost::OnSynchronizeReply() { diff --git a/chrome/common/child_process_logging.h b/chrome/common/child_process_logging.h index edf4517..84a288c 100644 --- a/chrome/common/child_process_logging.h +++ b/chrome/common/child_process_logging.h @@ -9,6 +9,7 @@ #include <string> #include "base/basictypes.h" +#include "chrome/common/gpu_info.h" #include "googleurl/src/gurl.h" #if defined(OS_WIN) @@ -35,6 +36,9 @@ void SetClientId(const std::string& client_id); // multiple because of process collapsing). void SetActiveExtensions(const std::set<std::string>& extension_ids); +// Sets the data on the gpu to send along with crash reports. +void SetGpuInfo(const GPUInfo& gpu_info); + // Simple wrapper class that sets the active URL in it's constructor and clears // the active URL in the destructor. class ScopedActiveURLSetter { diff --git a/chrome/common/child_process_logging_linux.cc b/chrome/common/child_process_logging_linux.cc index 06e20c2..94cb34b 100644 --- a/chrome/common/child_process_logging_linux.cc +++ b/chrome/common/child_process_logging_linux.cc @@ -6,6 +6,7 @@ #include "base/logging.h" #include "base/string_util.h" +#include "chrome/common/gpu_info.h" #include "chrome/installer/util/google_update_settings.h" #include "googleurl/src/gurl.h" @@ -33,4 +34,9 @@ void SetClientId(const std::string& client_id) { void SetActiveExtensions(const std::set<std::string>& extension_ids) { // TODO(port) } + +void SetGpuInfo(const GPUInfo& gpu_info) { + // TODO(rlp): Bug 38737. +} + } // namespace child_process_logging diff --git a/chrome/common/child_process_logging_mac.mm b/chrome/common/child_process_logging_mac.mm index c0c93e41..f0356cd 100644 --- a/chrome/common/child_process_logging_mac.mm +++ b/chrome/common/child_process_logging_mac.mm @@ -7,6 +7,7 @@ #import <Foundation/Foundation.h> #include "base/string_util.h" +#include "chrome/common/gpu_info.h" #include "chrome/installer/util/google_update_settings.h" #include "googleurl/src/gurl.h" @@ -16,6 +17,11 @@ const int kMaxNumCrashURLChunks = 8; const int kMaxNumURLChunkValueLength = 255; const char *kUrlChunkFormatStr = "url-chunk-%d"; const char *kGuidParamName = "guid"; +const char *kGPUVendorIdParamName = "vendid"; +const char *kGPUDeviceIdParamName = "devid"; +const char *kGPUDriverVersionParamName = "driver"; +const char *kGPUPixelShaderVersionParamName = "psver"; +const char *kGPUVertexShaderVersionParamName = "vsver"; static SetCrashKeyValueFuncPtr g_set_key_func; static ClearCrashKeyValueFuncPtr g_clear_key_func; @@ -96,4 +102,35 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids) { // TODO(port) } +void SetGpuKeyValue(const char* param_name, const std::string& value_str, + SetCrashKeyValueFuncPtr set_key_func) { + NSString *key = [NSString stringWithUTF8String:param_name]; + NSString *value = [NSString stringWithUTF8String:value_str.c_str()]; + set_key_func(key, value); +} + +void SetGpuInfoImpl(const GPUInfo& gpu_info, + SetCrashKeyValueFuncPtr set_key_func) { + SetGpuKeyValue(kGPUVendorIdParamName, + UintToString(gpu_info.vendor_id()), + set_key_func); + SetGpuKeyValue(kGPUDeviceIdParamName, + UintToString(gpu_info.device_id()), + set_key_func); + SetGpuKeyValue(kGPUDriverVersionParamName, + WideToASCII(gpu_info.driver_version()), + set_key_func); + SetGpuKeyValue(kGPUPixelShaderVersionParamName, + UintToString(gpu_info.pixel_shader_version()), + set_key_func); + SetGpuKeyValue(kGPUVertexShaderVersionParamName, + UintToString(gpu_info.vertex_shader_version()), + set_key_func); +} + +void SetGpuInfo(const GPUInfo& gpu_info) { + if (g_set_key_func) + SetGpuInfoImpl(gpu_info, g_set_key_func); +} + } // namespace child_process_logging diff --git a/chrome/common/child_process_logging_win.cc b/chrome/common/child_process_logging_win.cc index 3513a93..1b18e6e 100644 --- a/chrome/common/child_process_logging_win.cc +++ b/chrome/common/child_process_logging_win.cc @@ -23,6 +23,11 @@ typedef void (__cdecl *MainSetClientId)(const wchar_t*); // void __declspec(dllexport) __cdecl SetExtensionID. typedef void (__cdecl *MainSetExtensionID)(size_t, const wchar_t*); +// exported in breakpad_win.cc: void __declspec(dllexport) __cdecl SetGpuInfo. +typedef void (__cdecl *MainSetGpuInfo)(const wchar_t*, const wchar_t*, + const wchar_t*, const wchar_t*, + const wchar_t*); + void SetActiveURL(const GURL& url) { static MainSetActiveURL set_active_url = NULL; // note: benign race condition on set_active_url. @@ -89,4 +94,22 @@ void SetActiveExtensions(const std::set<std::string>& extension_ids) { } } +void SetGpuInfo(const GPUInfo& gpu_info) { + static MainSetGpuInfo set_gpu_info = NULL; + if (!set_gpu_info) { + HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); + if (!exe_module) + return; + set_gpu_info = reinterpret_cast<MainSetGpuInfo>( + GetProcAddress(exe_module, "SetGpuInfo")); + if (!set_gpu_info) + return; + } + (set_gpu_info)(UintToWString(gpu_info.vendor_id()).c_str(), + UintToWString(gpu_info.device_id()).c_str(), + gpu_info.driver_version().c_str(), + UintToWString(gpu_info.pixel_shader_version()).c_str(), + UintToWString(gpu_info.vertex_shader_version()).c_str()); +} + } // namespace child_process_logging |