From ecdcfdb8e5a4741b4d5809b9f29073b7071ea4a9 Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Thu, 25 Apr 2024 18:01:38 -0700 Subject: [PATCH] Cherry pick PR #3084: Add idl definition for PersistentSettingLogtraceEnable getter and setter (#3091) 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 a11a3adb5915..eba3dedb2e28 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.cc +++ b/cobalt/h5vcc/h5vcc_crash_log.cc @@ -226,6 +226,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 0e5fa5cf985e..def1e67927d0 100644 --- a/cobalt/h5vcc/h5vcc_crash_log.h +++ b/cobalt/h5vcc/h5vcc_crash_log.h @@ -91,6 +91,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