OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "mojo/common/common_custom_types_struct_traits.h" | |
6 | |
7 #include <iterator> | |
8 | |
9 #include "base/version.h" | |
10 | |
11 namespace mojo { | |
12 | |
13 // static | |
14 const std::vector<uint32_t>& | |
15 StructTraits<mojo::common::mojom::Version, base::Version>::components( | |
16 const base::Version& version) { | |
17 return version.components(); | |
dcheng
2016/07/28 02:09:39
Assuming this isn't doing any implicit conversions
Alex Z.
2016/07/28 19:40:44
Done.
| |
18 } | |
19 | |
20 // static | |
21 bool StructTraits<mojo::common::mojom::Version, base::Version>::Read( | |
22 mojo::common::mojom::VersionDataView data, | |
23 base::Version* out) { | |
24 std::vector<uint32_t> components; | |
25 if (!data.ReadComponents(&components)) | |
26 return false; | |
27 | |
28 *out = base::Version(base::Version(std::move(components))); | |
29 return out->IsValid(); | |
30 } | |
31 | |
32 } // namespace mojo | |
OLD | NEW |