OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <stddef.h> | 5 #include <stddef.h> |
| 6 #include <utility> |
6 | 7 |
7 #include "mojo/public/cpp/bindings/array.h" | 8 #include "mojo/public/cpp/bindings/array.h" |
8 #include "third_party/WebKit/public/platform/WebVector.h" | 9 #include "third_party/WebKit/public/platform/WebVector.h" |
9 | 10 |
10 namespace mojo { | 11 namespace mojo { |
11 | 12 |
12 template <typename T, typename U> | 13 template <typename T, typename U> |
13 struct TypeConverter<Array<T>, blink::WebVector<U>> { | 14 struct TypeConverter<Array<T>, blink::WebVector<U>> { |
14 static Array<T> Convert(const blink::WebVector<U>& vector) { | 15 static Array<T> Convert(const blink::WebVector<U>& vector) { |
15 Array<T> array(vector.size()); | 16 Array<T> array(vector.size()); |
16 for (size_t i = 0; i < vector.size(); ++i) | 17 for (size_t i = 0; i < vector.size(); ++i) |
17 array[i] = TypeConverter<T, U>::Convert(vector[i]); | 18 array[i] = TypeConverter<T, U>::Convert(vector[i]); |
18 return array.Pass(); | 19 return std::move(array); |
19 } | 20 } |
20 }; | 21 }; |
21 | 22 |
22 } // namespace mojo | 23 } // namespace mojo |
OLD | NEW |