Skip to content

Commit

Permalink
Cherry pick PR #3084: Add idl definition for PersistentSettingLogtrac…
Browse files Browse the repository at this point in the history
…eEnable getter and setter (#3091)

Refer to the original PR: youtube/cobalt#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 <[email protected]>
  • Loading branch information
cobalt-github-releaser-bot and alunev authored Apr 26, 2024
1 parent 1f9e541 commit ecdcfdb
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 4 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::string> GetLogTrace();
Expand Down
8 changes: 8 additions & 0 deletions cobalt/h5vcc/h5vcc_crash_log.idl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ecdcfdb

Please sign in to comment.