Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(224)

Side by Side Diff: chrome/app/kasko_client.cc

Issue 981183003: Revert "ScopedCrashKey doesn't appear to be configured to work on Windows. Manually set the crash k… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_crash_logging
Patch Set: Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 #if defined(KASKO) 5 #if defined(KASKO)
6 6
7 #include "chrome/app/kasko_client.h" 7 #include "chrome/app/kasko_client.h"
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/debug/crash_logging.h"
13 #include "base/guid.h" 14 #include "base/guid.h"
14 #include "base/logging.h" 15 #include "base/logging.h"
15 #include "base/process/process_handle.h" 16 #include "base/process/process_handle.h"
16 #include "base/strings/utf_string_conversions.h"
17 #include "base/win/wrapped_window_proc.h" 17 #include "base/win/wrapped_window_proc.h"
18 #include "breakpad/src/client/windows/common/ipc_protocol.h" 18 #include "breakpad/src/client/windows/common/ipc_protocol.h"
19 #include "chrome/app/chrome_watcher_client_win.h" 19 #include "chrome/app/chrome_watcher_client_win.h"
20 #include "chrome/chrome_watcher/chrome_watcher_main_api.h" 20 #include "chrome/chrome_watcher/chrome_watcher_main_api.h"
21 #include "chrome/common/chrome_constants.h" 21 #include "chrome/common/chrome_constants.h"
22 #include "chrome/common/crash_keys.h" 22 #include "chrome/common/crash_keys.h"
23 #include "components/crash/app/crash_keys_win.h" 23 #include "components/crash/app/crash_keys_win.h"
24 #include "syzygy/kasko/api/client.h" 24 #include "syzygy/kasko/api/client.h"
25 25
26 namespace { 26 namespace {
(...skipping 27 matching lines...) Expand all
54 "CrashKey and CustomInfoEntry structs are not compatible."); 54 "CrashKey and CustomInfoEntry structs are not compatible.");
55 static_assert( 55 static_assert(
56 sizeof(reinterpret_cast<kasko::api::CrashKey*>(0)->name) == 56 sizeof(reinterpret_cast<kasko::api::CrashKey*>(0)->name) ==
57 sizeof(reinterpret_cast<google_breakpad::CustomInfoEntry*>(0)->name), 57 sizeof(reinterpret_cast<google_breakpad::CustomInfoEntry*>(0)->name),
58 "CrashKey and CustomInfoEntry structs are not compatible."); 58 "CrashKey and CustomInfoEntry structs are not compatible.");
59 static_assert( 59 static_assert(
60 sizeof(reinterpret_cast<kasko::api::CrashKey*>(0)->value) == 60 sizeof(reinterpret_cast<kasko::api::CrashKey*>(0)->value) ==
61 sizeof(reinterpret_cast<google_breakpad::CustomInfoEntry*>(0)->value), 61 sizeof(reinterpret_cast<google_breakpad::CustomInfoEntry*>(0)->value),
62 "CrashKey and CustomInfoEntry structs are not compatible."); 62 "CrashKey and CustomInfoEntry structs are not compatible.");
63 63
64 breakpad::CrashKeysWin* keeper = breakpad::CrashKeysWin::keeper();
65 if (!keeper)
66 return;
67
68 // Assign a GUID that can be used to correlate the Kasko report to the 64 // Assign a GUID that can be used to correlate the Kasko report to the
69 // Breakpad report, to verify data consistency. 65 // Breakpad report, to verify data consistency.
70 std::string guid = base::GenerateGUID(); 66 std::string guid = base::GenerateGUID();
71 { 67 {
72 keeper->SetCrashKeyValue(base::ASCIIToUTF16(crash_keys::kKaskoGuid).c_str(),
73 base::ASCIIToUTF16(guid).c_str());
74
75 base::debug::ScopedCrashKey kasko_guid(crash_keys::kKaskoGuid, guid); 68 base::debug::ScopedCrashKey kasko_guid(crash_keys::kKaskoGuid, guid);
76 size_t crash_key_count = keeper->custom_info_entries().size(); 69 size_t crash_key_count =
70 breakpad::CrashKeysWin::keeper()->custom_info_entries().size();
77 const kasko::api::CrashKey* crash_keys = 71 const kasko::api::CrashKey* crash_keys =
78 reinterpret_cast<const kasko::api::CrashKey*>( 72 reinterpret_cast<const kasko::api::CrashKey*>(
79 keeper->custom_info_entries().data()); 73 breakpad::CrashKeysWin::keeper()->custom_info_entries().data());
80 74
81 if (g_chrome_watcher_client && 75 if (g_chrome_watcher_client &&
82 g_chrome_watcher_client->EnsureInitialized()) { 76 g_chrome_watcher_client->EnsureInitialized()) {
83 kasko::api::SendReport(info, protobuf, protobuf_length, crash_keys, 77 kasko::api::SendReport(info, protobuf, protobuf_length, crash_keys,
84 crash_key_count); 78 crash_key_count);
85 } 79 }
86
87 keeper->ClearCrashKeyValue(
88 base::ASCIIToUTF16(crash_keys::kKaskoGuid).c_str());
89 } 80 }
90 81
91 { 82 {
92 keeper->SetCrashKeyValue( 83 base::debug::ScopedCrashKey kasko_equivalent_guid(
93 base::ASCIIToUTF16(crash_keys::kKaskoEquivalentGuid).c_str(), 84 crash_keys::kKaskoEquivalentGuid, guid);
94 base::ASCIIToUTF16(guid).c_str());
95 // While Kasko remains experimental, also report via Breakpad. 85 // While Kasko remains experimental, also report via Breakpad.
96 base::win::WinProcExceptionFilter crash_for_exception = 86 base::win::WinProcExceptionFilter crash_for_exception =
97 reinterpret_cast<base::win::WinProcExceptionFilter>(::GetProcAddress( 87 reinterpret_cast<base::win::WinProcExceptionFilter>(::GetProcAddress(
98 ::GetModuleHandle(chrome::kBrowserProcessExecutableName), 88 ::GetModuleHandle(chrome::kBrowserProcessExecutableName),
99 "CrashForException")); 89 "CrashForException"));
100 crash_for_exception(info); 90 crash_for_exception(info);
101 keeper->ClearCrashKeyValue(
102 base::ASCIIToUTF16(crash_keys::kKaskoEquivalentGuid).c_str());
103 } 91 }
104 } 92 }
105 93
106 #endif // defined(KASKO) 94 #endif // defined(KASKO)
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698