blob: e60e0abd825ee8584d859a892496bd520e9d2e72 [file] [log] [blame]
// Copyright 2017 The Cobalt Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Defines an interface for setting arbitrary values to be logged (in a
// platform-specific way) whenever a crash occurs. For example, a platform
// may implement this by uploading the data to a central crash report
// repository that can be examined later.
// Platforms typically have maximum crash log data sizes on the order of 16KB,
// but it varies per platform.
interface H5vccCrashLog {
// Returns true if the string was successfully set in the crash log, and false
// if for some reason the string could not be set in the crash log.
// Sets a (key, value) string pair that should be logged if a crash occurs.
boolean setString(DOMString key, DOMString value);
// Induce a crash. This attempts, but does not guarantee, to cause a specified
// type of crash. The result may vary by platform. This API is intended for
// reliability testing only.
void triggerCrash(H5vccCrashType intent);
// Returns true if Watchdog client was registered.
// name, Watchdog client to register.
// description, information on the Watchdog client.
// watchdog_state, application state to continue monitoring client up to.
// Inclusive.
// time_interval_milliseconds, maximum number of milliseconds allowed
// between pings before triggering a Watchdog violation. Min value of
// 1000.
// time_wait_milliseconds, number of milliseconds to initially wait before
// Watchdog violations can be triggered. Reapplies after client resumes
// from idle state due to application state changes.
// watchdog_replace, behavior with previously registered Watchdog clients
// of the same name.
boolean register(DOMString name, DOMString description,
WatchdogState watchdog_state, long long time_interval_milliseconds,
long long time_wait_milliseconds, WatchdogReplace watchdog_replace);
// Returns true if Watchdog client was unregistered. Name determines the
// Watchdog client to unregister.
boolean unregister(DOMString name);
// Returns true if Watchdog client was pinged. Name determines the Watchdog
// client to ping with ping_info which can either be empty or contain relevant
// metadata. ping_info has a max length of 128.
boolean ping(DOMString name, DOMString ping_info);
// Returns a json string containing the Watchdog violations since the last
// call, up to 200. Clears internal cache of Watchdog violations to prevent
// duplicates. Timestamps are stored as strings due to int size constraints.
// Example json:
// {
// "test-name":{
// "description":"test-desc",
// "violations":[
// {
// "monitorState":"kApplicationStateStarted",
// "pingInfos":[
// {
// "info":"test-ping",
// "timestampMilliseconds":"1658972623547"
// }
// ],
// "registeredClients":[
// "test-name"
// ],
// "timeIntervalMilliseconds":"5000",
// "timeWaitMilliseconds":"0",
// "timestampLastPingedMilliseconds":"1658972623547",
// "timestampRegisteredMilliseconds":"1658972621890",
// "timestampViolationMilliseconds":"1658972629489",
// "violationDurationMilliseconds":"942"
// }
// ]
// }
// }
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
// effect.
boolean getPersistentSettingWatchdogEnable();
// Sets 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
// effect.
void setPersistentSettingWatchdogEnable(boolean enable_watchdog);
// Gets a persistent Watchdog setting that determines whether or not a
// Watchdog violation will trigger a crash.
boolean getPersistentSettingWatchdogCrash();
// Sets a persistent Watchdog setting that determines whether or not a
// Watchdog violation will trigger a crash.
void setPersistentSettingWatchdogCrash(boolean can_trigger_crash);
};