Skip to content

Commit

Permalink
[Watchdog] Create API for getting watchdog client names (#1308)
Browse files Browse the repository at this point in the history
b/287302949
  • Loading branch information
sherryzy authored Aug 18, 2023
1 parent ebb66ef commit 4625b69
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 4625b69

Please sign in to comment.