| // Copyright 2018 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // Next min version: 1 |
| |
| module arc.mojom; |
| |
| import "mojo/public/mojom/base/time.mojom"; |
| |
| [Extensible] |
| enum ArcTimerResult { |
| SUCCESS = 0, |
| FAILURE = 1, |
| }; |
| |
| [Extensible] |
| enum ClockId { |
| REALTIME_ALARM = 0, |
| BOOTTIME_ALARM = 1, |
| }; |
| |
| struct CreateTimerRequest { |
| // Type of the clock for which a timer needs to be created. This value |
| // corresponds to the clock ids used by timerfd_create. |
| ClockId clock_id; |
| |
| // File descriptor to write to when the timer is expired. This indicates to |
| // the instance that the timer is expired. This fd is owned by the host. |
| handle expiration_fd; |
| }; |
| |
| // Next method ID: 2 |
| interface TimerHost { |
| // Creates timers with the given arguments. Returns |ArcTimerResult::SUCCESS| |
| // iff timers corresponding to all clocks in |timer_requests| are created. |
| CreateTimers@0(array<CreateTimerRequest> timer_requests) |
| => (ArcTimerResult result); |
| |
| // Starts the timer of type |clock_id| to run at |absolute_expiration_time| in |
| // the future. If the timer is already running, it will be replaced. |
| // Notification will be performed as an 8-byte write to the associated |
| // expiration fd. Returns |ArcTimerResult::SUCCESS| if the timer can be |
| // started and |ArcTimerResult::FAILURE| otherwise. |
| StartTimer@1(ClockId clock_id, |
| mojo_base.mojom.TimeTicks absolute_expiration_time) |
| => (ArcTimerResult result); |
| }; |
| |
| // Next method ID: 1 |
| interface TimerInstance { |
| // Establishes full-duplex communication with the host. |
| Init@0(TimerHost host_ptr) => (); |
| }; |