This source file includes following definitions.
- SetCrashKeyValueTrampoline
- ClearCrashKeyValueTrampoline
- Init
#include "chrome/common/child_process_logging.h"
#include <windows.h>
#include "base/debug/crash_logging.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/crash_keys.h"
namespace child_process_logging {
namespace {
typedef void (__cdecl *SetCrashKeyValue)(const wchar_t*, const wchar_t*);
typedef void (__cdecl *ClearCrashKeyValue)(const wchar_t*);
void SetCrashKeyValueTrampoline(const base::StringPiece& key,
const base::StringPiece& value) {
static SetCrashKeyValue set_crash_key = NULL;
if (!set_crash_key) {
HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
if (!exe_module)
return;
set_crash_key = reinterpret_cast<SetCrashKeyValue>(
GetProcAddress(exe_module, "SetCrashKeyValueImpl"));
}
if (set_crash_key) {
(set_crash_key)(base::UTF8ToWide(key).data(),
base::UTF8ToWide(value).data());
}
}
void ClearCrashKeyValueTrampoline(const base::StringPiece& key) {
static ClearCrashKeyValue clear_crash_key = NULL;
if (!clear_crash_key) {
HMODULE exe_module = GetModuleHandle(chrome::kBrowserProcessExecutableName);
if (!exe_module)
return;
clear_crash_key = reinterpret_cast<ClearCrashKeyValue>(
GetProcAddress(exe_module, "ClearCrashKeyValueImpl"));
}
if (clear_crash_key)
(clear_crash_key)(base::UTF8ToWide(key).data());
}
}
void Init() {
crash_keys::RegisterChromeCrashKeys();
base::debug::SetCrashKeyReportingFunctions(
&SetCrashKeyValueTrampoline, &ClearCrashKeyValueTrampoline);
}
}