Skip to content

Commit

Permalink
Add idl definition for PersistentSettingLogtraceEnable getter and set…
Browse files Browse the repository at this point in the history
…ter (#3084)

Add idl definition for PersistentSettingLogtraceEnable getter and
setter. Tested with devtools on Cobalt on linux.

b/334122726

Change-Id: I22a881f99af3c05eadc251881cf167d3e0934c0e
(cherry picked from commit eda5bd8)
  • Loading branch information
alunev authored and anonymous1-me committed Apr 25, 2024
1 parent 183890a commit b03fe24
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 @@ -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) {
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 @@ -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<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 b03fe24

Please sign in to comment.