diff options
author | Luis Hector Chavez <lhchavez@google.com> | 2017-07-26 17:38:05 +0000 |
---|---|---|
committer | Luis Hector Chavez <lhchavez@google.com> | 2017-07-26 17:38:05 +0000 |
commit | 21a249e4d9cb0b2ec6f0ff84ed5f7939ea67ac52 (patch) | |
tree | d380c2689495d31fd250cf8f1d0ceebbdd4cf250 /mojo/public/cpp/bindings/array_traits_wtf.h | |
parent | 8ac9103e05b66812c25348943383f9365d1ce3e0 (diff) | |
download | libmojo-21a249e4d9cb0b2ec6f0ff84ed5f7939ea67ac52.tar.gz |
Revert "libmojo: Uprev the library to r456626 from Chromium"
This reverts commit 8ac9103e05b66812c25348943383f9365d1ce3e0.
Reason for revert: Broke the mac_sdk
Exempt-From-Owner-Approval: Fixing mac_sdk
Change-Id: I0b74d1abaa66933a93fd6f82ff018e8948c1204e
Diffstat (limited to 'mojo/public/cpp/bindings/array_traits_wtf.h')
-rw-r--r-- | mojo/public/cpp/bindings/array_traits_wtf.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/mojo/public/cpp/bindings/array_traits_wtf.h b/mojo/public/cpp/bindings/array_traits_wtf.h new file mode 100644 index 0000000..7e773fc --- /dev/null +++ b/mojo/public/cpp/bindings/array_traits_wtf.h @@ -0,0 +1,40 @@ +// Copyright 2016 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. + +#ifndef MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_WTF_H_ +#define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_WTF_H_ + +#include "mojo/public/cpp/bindings/array_traits.h" +#include "mojo/public/cpp/bindings/wtf_array.h" + +namespace mojo { + +template <typename U> +struct ArrayTraits<WTFArray<U>> { + using Element = U; + + static bool IsNull(const WTFArray<U>& input) { return input.is_null(); } + static void SetToNull(WTFArray<U>* output) { *output = nullptr; } + + static size_t GetSize(const WTFArray<U>& input) { return input.size(); } + + static U* GetData(WTFArray<U>& input) { return &input.front(); } + + static const U* GetData(const WTFArray<U>& input) { return &input.front(); } + + static U& GetAt(WTFArray<U>& input, size_t index) { return input[index]; } + + static const U& GetAt(const WTFArray<U>& input, size_t index) { + return input[index]; + } + + static bool Resize(WTFArray<U>& input, size_t size) { + input.resize(size); + return true; + } +}; + +} // namespace mojo + +#endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_TRAITS_WTF_H_ |