From 6fa8f3a351b2a1e686a6a87b8956330f8022c0c1 Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Fri, 18 Aug 2023 14:27:28 -0700 Subject: [PATCH] Cherry pick PR #1308: [Watchdog] Create API for getting watchdog client names (#1320) Refer to the original PR: https://github.com/youtube/cobalt/pull/1308 b/287302949 Co-authored-by: Sherry Zhou --- cobalt/h5vcc/h5vcc_crash_log.cc | 13 +++++++++++++ cobalt/h5vcc/h5vcc_crash_log.h | 2 ++ cobalt/h5vcc/h5vcc_crash_log.idl | 3 +++ 3 files changed, 18 insertions(+) diff --git a/cobalt/h5vcc/h5vcc_crash_log.cc b/cobalt/h5vcc/h5vcc_crash_log.cc index b3e76e7d93957..39c545c9da233 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.cc +++ b/cobalt/h5vcc/h5vcc_crash_log.cc @@ -191,6 +191,19 @@ std::string H5vccCrashLog::GetWatchdogViolations( return ""; } +script::Sequence H5vccCrashLog::GetWatchdogViolationClients() { + watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance(); + script::Sequence client_names; + if (watchdog) { + std::vector client_string_names = + watchdog->GetWatchdogViolationClientNames(); + for (std::size_t i = 0; i < client_string_names.size(); ++i) { + client_names.push_back(client_string_names[i]); + } + } + return client_names; +} + bool H5vccCrashLog::GetPersistentSettingWatchdogEnable() { watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance(); if (watchdog) return watchdog->GetPersistentSettingWatchdogEnable(); diff --git a/cobalt/h5vcc/h5vcc_crash_log.h b/cobalt/h5vcc/h5vcc_crash_log.h index ea06c88f7d10b..e01d23e448414 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.h +++ b/cobalt/h5vcc/h5vcc_crash_log.h @@ -81,6 +81,8 @@ class H5vccCrashLog : public script::Wrappable { std::string GetWatchdogViolations( const script::Sequence& clients = {}); + script::Sequence GetWatchdogViolationClients(); + bool GetPersistentSettingWatchdogEnable(); void SetPersistentSettingWatchdogEnable(bool enable_watchdog); diff --git a/cobalt/h5vcc/h5vcc_crash_log.idl b/cobalt/h5vcc/h5vcc_crash_log.idl index 8d4a3baf3b1bd..e60e0abd825ee 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.idl +++ b/cobalt/h5vcc/h5vcc_crash_log.idl @@ -86,6 +86,9 @@ interface H5vccCrashLog { // } DOMString getWatchdogViolations(optional sequence clients); + // Returns a sequence of the client names that have watchdog violations. + sequence getWatchdogViolationClients(); + // Gets a persistent Watchdog setting that determines whether or not Watchdog // is enabled. When disabled, Watchdog behaves like a stub except that // persistent settings can still be get/set. Requires a restart to take