1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
ash / components / arc / timer / arc_timer_mojom_traits.cc [blame]
// Copyright 2018 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "ash/components/arc/timer/arc_timer_mojom_traits.h"
#include <utility>
namespace mojo {
// static
arc::mojom::ClockId EnumTraits<arc::mojom::ClockId, clockid_t>::ToMojom(
clockid_t clock_id) {
switch (clock_id) {
case CLOCK_REALTIME_ALARM:
return arc::mojom::ClockId::REALTIME_ALARM;
case CLOCK_BOOTTIME_ALARM:
return arc::mojom::ClockId::BOOTTIME_ALARM;
}
NOTREACHED();
}
// static
bool EnumTraits<arc::mojom::ClockId, clockid_t>::FromMojom(
arc::mojom::ClockId input,
clockid_t* output) {
switch (input) {
case arc::mojom::ClockId::REALTIME_ALARM:
*output = CLOCK_REALTIME_ALARM;
return true;
case arc::mojom::ClockId::BOOTTIME_ALARM:
*output = CLOCK_BOOTTIME_ALARM;
return true;
}
NOTREACHED();
}
} // namespace mojo