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/debug/crash_logging.h" | 9 #include "base/debug/crash_logging.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 16 matching lines...) Expand all Loading... |
27 const base::StringPiece& value) { | 27 const base::StringPiece& value) { |
28 static SetCrashKeyValue set_crash_key = NULL; | 28 static SetCrashKeyValue set_crash_key = NULL; |
29 if (!set_crash_key) { | 29 if (!set_crash_key) { |
30 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 30 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
31 if (!exe_module) | 31 if (!exe_module) |
32 return; | 32 return; |
33 set_crash_key = reinterpret_cast<SetCrashKeyValue>( | 33 set_crash_key = reinterpret_cast<SetCrashKeyValue>( |
34 GetProcAddress(exe_module, "SetCrashKeyValueImpl")); | 34 GetProcAddress(exe_module, "SetCrashKeyValueImpl")); |
35 } | 35 } |
36 | 36 |
37 if (set_crash_key) | 37 if (set_crash_key) { |
38 (set_crash_key)(UTF8ToWide(key).data(), UTF8ToWide(value).data()); | 38 (set_crash_key)(base::UTF8ToWide(key).data(), |
| 39 base::UTF8ToWide(value).data()); |
| 40 } |
39 } | 41 } |
40 | 42 |
41 void ClearCrashKeyValueTrampoline(const base::StringPiece& key) { | 43 void ClearCrashKeyValueTrampoline(const base::StringPiece& key) { |
42 static ClearCrashKeyValue clear_crash_key = NULL; | 44 static ClearCrashKeyValue clear_crash_key = NULL; |
43 if (!clear_crash_key) { | 45 if (!clear_crash_key) { |
44 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); | 46 HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName); |
45 if (!exe_module) | 47 if (!exe_module) |
46 return; | 48 return; |
47 clear_crash_key = reinterpret_cast<ClearCrashKeyValue>( | 49 clear_crash_key = reinterpret_cast<ClearCrashKeyValue>( |
48 GetProcAddress(exe_module, "ClearCrashKeyValueImpl")); | 50 GetProcAddress(exe_module, "ClearCrashKeyValueImpl")); |
49 } | 51 } |
50 | 52 |
51 if (clear_crash_key) | 53 if (clear_crash_key) |
52 (clear_crash_key)(UTF8ToWide(key).data()); | 54 (clear_crash_key)(base::UTF8ToWide(key).data()); |
53 } | 55 } |
54 | 56 |
55 } // namespace | 57 } // namespace |
56 | 58 |
57 void Init() { | 59 void Init() { |
58 // Note: on other platforms, this is set up during Breakpad initialization, | 60 // Note: on other platforms, this is set up during Breakpad initialization, |
59 // in ChromeBreakpadClient. But on Windows, that is before the DLL module is | 61 // in ChromeBreakpadClient. But on Windows, that is before the DLL module is |
60 // loaded, which is a prerequisite of the crash key system. | 62 // loaded, which is a prerequisite of the crash key system. |
61 crash_keys::RegisterChromeCrashKeys(); | 63 crash_keys::RegisterChromeCrashKeys(); |
62 base::debug::SetCrashKeyReportingFunctions( | 64 base::debug::SetCrashKeyReportingFunctions( |
63 &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline); | 65 &SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline); |
64 } | 66 } |
65 | 67 |
66 } // namespace child_process_logging | 68 } // namespace child_process_logging |
OLD | NEW |