Chromium Code Reviews| Index: chrome/browser/chrome_browser_field_trials_desktop.cc |
| diff --git a/chrome/browser/chrome_browser_field_trials_desktop.cc b/chrome/browser/chrome_browser_field_trials_desktop.cc |
| index 03dc9668865178c351c9ef859f157a38f4f957af..6a6396fc533faed92f0775f995479d311fde7892 100644 |
| --- a/chrome/browser/chrome_browser_field_trials_desktop.cc |
| +++ b/chrome/browser/chrome_browser_field_trials_desktop.cc |
| @@ -29,10 +29,16 @@ |
| #include "media/media_features.h" |
| #if defined(OS_WIN) |
| +#include "base/win/pe_image.h" |
| #include "chrome/install_static/install_util.h" |
| #include "components/browser_watcher/stability_data_names.h" |
| #endif |
| +#if defined(OS_WIN) |
| +// http://blogs.msdn.com/oldnewthing/archive/2004/10/25/247180.aspx |
| +extern "C" IMAGE_DOS_HEADER __ImageBase; |
| +#endif |
| + |
| namespace chrome { |
| namespace { |
| @@ -109,11 +115,11 @@ void SetupStabilityDebugging() { |
| stability_file, kMemorySize, kAllocatorId, |
| browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); |
| - // Record basic information: product, version, channel, special build and |
| - // platform. |
| + // Record basic information. |
| base::debug::GlobalActivityTracker* global_tracker = |
| base::debug::GlobalActivityTracker::Get(); |
| if (global_tracker) { |
| + // Record product, version, channel, special build and platform. |
| wchar_t exe_file[MAX_PATH] = {}; |
| CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); |
| @@ -136,6 +142,19 @@ void SetupStabilityDebugging() { |
| #elif defined(ARCH_CPU_X86_64) |
| global_data.SetString(browser_watcher::kStabilityPlatform, "Win64"); |
| #endif |
| + |
| + // Record information about chrome's module. |
| + global_data.SetUint(browser_watcher::kStabilityModuleAddress, |
| + reinterpret_cast<uint64_t>(&__ImageBase)); |
| + |
| + base::win::PEImage pe(&__ImageBase); |
| + PIMAGE_NT_HEADERS headers = pe.GetNTHeaders(); |
| + if (headers) { |
|
Sigurður Ásgeirsson
2017/01/10 21:32:30
this can never be NULL. Sane to CHECK or DCHECK, b
manzagop (departed)
2017/01/11 14:52:47
Done.
|
| + global_data.SetUint(browser_watcher::kStabilityModuleTimestamp, |
| + headers->FileHeader.TimeDateStamp); |
| + global_data.SetUint(browser_watcher::kStabilityModuleSize, |
| + headers->OptionalHeader.SizeOfImage); |
| + } |
| } |
| } |
| #endif // defined(OS_WIN) |