Skip to content

Commit

Permalink
Cherry pick PR #1308: [Watchdog] Create API for getting watchdog clie…
Browse files Browse the repository at this point in the history
…nt names (#1320)

Refer to the original PR: youtube/cobalt#1308

b/287302949

Co-authored-by: Sherry Zhou <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and sherryzy committed Aug 18, 2023
1 parent ae1c315 commit 6fa8f3a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,19 @@ std::string H5vccCrashLog::GetWatchdogViolations(
return "";
}

script::Sequence<std::string> H5vccCrashLog::GetWatchdogViolationClients() {
watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance();
script::Sequence<std::string> client_names;
if (watchdog) {
std::vector<std::string> 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();
Expand Down
2 changes: 2 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ class H5vccCrashLog : public script::Wrappable {
std::string GetWatchdogViolations(
const script::Sequence<std::string>& clients = {});

script::Sequence<std::string> GetWatchdogViolationClients();

bool GetPersistentSettingWatchdogEnable();

void SetPersistentSettingWatchdogEnable(bool enable_watchdog);
Expand Down
3 changes: 3 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.idl
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ interface H5vccCrashLog {
// }
DOMString getWatchdogViolations(optional sequence<DOMString> clients);

// Returns a sequence of the client names that have watchdog violations.
sequence<DOMString> 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
Expand Down

0 comments on commit 6fa8f3a

Please sign in to comment.