Index: chrome/browser/process_singleton_win.cc |
diff --git a/chrome/browser/process_singleton_win.cc b/chrome/browser/process_singleton_win.cc |
index 335215680f0d1063b90260fcd4b1e7b9e39a3248..acd028744e121789a042b567edd407cda3d20160 100644 |
--- a/chrome/browser/process_singleton_win.cc |
+++ b/chrome/browser/process_singleton_win.cc |
@@ -26,14 +26,18 @@ |
#include "chrome/browser/chrome_process_finder_win.h" |
#include "chrome/browser/shell_integration.h" |
#include "chrome/browser/ui/simple_message_box.h" |
+#include "chrome/chrome_watcher/kasko_util.h" |
#include "chrome/common/chrome_constants.h" |
#include "chrome/common/chrome_paths.h" |
#include "chrome/common/chrome_paths_internal.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/grit/chromium_strings.h" |
+#include "chrome/installer/util/browser_distribution.h" |
+#include "chrome/installer/util/util_constants.h" |
#include "chrome/installer/util/wmi.h" |
#include "content/public/common/result_codes.h" |
#include "net/base/escape.h" |
+#include "third_party/kasko/kasko_features.h" |
#include "ui/base/l10n/l10n_util.h" |
#include "ui/gfx/win/hwnd_util.h" |
@@ -249,6 +253,7 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { |
break; |
} |
+ // The window is hung. |
DWORD process_id = 0; |
DWORD thread_id = ::GetWindowThreadProcessId(remote_window_, &process_id); |
if (!thread_id || !process_id) { |
@@ -257,7 +262,40 @@ ProcessSingleton::NotifyResult ProcessSingleton::NotifyOtherProcess() { |
} |
base::Process process = base::Process::Open(process_id); |
- // The window is hung. Scan for every window to find a visible one. |
+#if BUILDFLAG(ENABLE_KASKO) |
Sigurður Ásgeirsson
2016/03/31 19:28:49
As we discussed, there is a race on the PID here,
manzagop (departed)
2016/04/01 16:09:00
Done.
|
+ // Capture a failed rendez-vous hang report of the other process. Kasko needs |
+ // the exception context to live either in the dumper of the dumpee. This |
+ // means we cannot rely on kasko reporters from either browser watcher, and |
+ // instead spin up a new reporter. Note that we will exit shortly after |
+ // capturing the report, meaning the report may not get uploaded by this |
+ // reporter. |
+ // DO NOT SUBMIT: add a build flag for capturign RDV hangs |
+ // #if BUILDFLAG(ENABLE_KASKO_RDV_HANG_REPORTS) |
+ // TODO(manzagop): add a metric for the number of captured hang reports, for |
+ // comparison with uploaded count? |
+ |
+ // Check the channel |
+ // DO NOT SUBMIT: only on canary. |
+ // base::string16 channel_name = GoogleUpdateSettings::GetChromeChannel(!InstallUtil::IsPerUserInstall(cmd_line.GetProgram())); |
+ // if (base::StringPiece16(channel_name) == L"" || |
+ // base::StringPiece16(channel_name) == installer::kChromeChannelCanary) |
+ |
+ base::FilePath data_base_dir; |
+ chrome::GetDefaultUserDataDirectory(&data_base_dir); |
+ base::string16 endpoint = |
+ L"chrome_kasko_hangs_" + |
+ base::UintToString16(base::Process::Current().Pid()); |
+ |
+ bool launched_kasko = |
+ InitializeKaskoReporter(endpoint, data_base_dir.value().c_str()); |
+ if (launched_kasko) { |
+ // DO NOT SUBMIT: add a specific crash keys (RDV hang). |
+ DumpHungProcess(thread_id, installer::kChromeChannelCanary, process); |
+ ShutdownKaskoReporter(); |
+ } |
+#endif // BUILDFLAG(ENABLE_KASKO) |
+ |
+ // Scan for every window to find a visible one. |
bool visible_window = false; |
::EnumThreadWindows(thread_id, |
&BrowserWindowEnumeration, |