From 741bbe08cfb1da077c37d43cb3e7ef8ab5b94181 Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Fri, 26 Apr 2024 13:58:16 -0700 Subject: [PATCH] Cherry pick PR #3084: Add idl definition for PersistentSettingLogtraceEnable getter and setter (#3092) Refer to the original PR: https://github.com/youtube/cobalt/pull/3084 Add idl definition for PersistentSettingLogtraceEnable getter and setter. Tested with devtools on Cobalt on linux. b/334122726 Change-Id: I22a881f99af3c05eadc251881cf167d3e0934c0e Co-authored-by: Anton --- cobalt/h5vcc/h5vcc_crash_log.cc | 11 +++++++++++ cobalt/h5vcc/h5vcc_crash_log.h | 4 ++++ cobalt/h5vcc/h5vcc_crash_log.idl | 8 ++++++++ 3 files changed, 23 insertions(+) diff --git a/cobalt/h5vcc/h5vcc_crash_log.cc b/cobalt/h5vcc/h5vcc_crash_log.cc index e4bbbd04cc71..1f35d8bbeb83 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.cc +++ b/cobalt/h5vcc/h5vcc_crash_log.cc @@ -176,6 +176,17 @@ void H5vccCrashLog::SetPersistentSettingWatchdogCrash(bool can_trigger_crash) { if (watchdog) watchdog->SetPersistentSettingWatchdogCrash(can_trigger_crash); } +bool H5vccCrashLog::GetPersistentSettingLogtraceEnable() { + watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance(); + if (watchdog) return watchdog->GetPersistentSettingLogtraceEnable(); + return false; +} + +void H5vccCrashLog::SetPersistentSettingLogtraceEnable(bool enable_logtrace) { + watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance(); + if (watchdog) watchdog->SetPersistentSettingLogtraceEnable(enable_logtrace); +} + bool H5vccCrashLog::LogEvent(const std::string& event) { watchdog::Watchdog* watchdog = watchdog::Watchdog::GetInstance(); if (!watchdog) { diff --git a/cobalt/h5vcc/h5vcc_crash_log.h b/cobalt/h5vcc/h5vcc_crash_log.h index 0ad68a675aa8..4f7f03be98a4 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.h +++ b/cobalt/h5vcc/h5vcc_crash_log.h @@ -60,6 +60,10 @@ class H5vccCrashLog : public script::Wrappable { void SetPersistentSettingWatchdogCrash(bool can_trigger_crash); + bool GetPersistentSettingLogtraceEnable(); + + void SetPersistentSettingLogtraceEnable(bool enable_logtrace); + bool LogEvent(const std::string& event); script::Sequence GetLogTrace(); diff --git a/cobalt/h5vcc/h5vcc_crash_log.idl b/cobalt/h5vcc/h5vcc_crash_log.idl index 0596c0d24ec3..98e1b81e3e12 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.idl +++ b/cobalt/h5vcc/h5vcc_crash_log.idl @@ -109,6 +109,14 @@ interface H5vccCrashLog { // Watchdog violation will trigger a crash. void setPersistentSettingWatchdogCrash(boolean can_trigger_crash); + // Gets a persistent setting that determines whether or not + // events emitted by logEvent() are saved in Cobalt buffer. + boolean getPersistentSettingLogtraceEnable(); + + // Sets a persistent setting that determines whether or not + // events emitted by logEvent() are saved in Cobalt buffer. + void setPersistentSettingLogtraceEnable(boolean enable_logtrace); + // Appends a string event to a ring buffer. These log events can be appended // from JS code. When watchdog violation is created, a snapshot of // that buffer is attached to a violation. Identical sequential events