Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1798)

Unified Diff: mojo/public/cpp/bindings/map_traits_wtf.h

Issue 2608503002: Remove mojo::WTFMap. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/lib/wtf_serialization.h ('k') | mojo/public/cpp/bindings/struct_traits.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/map_traits_wtf.h
diff --git a/mojo/public/cpp/bindings/map_traits_wtf.h b/mojo/public/cpp/bindings/map_traits_wtf.h
deleted file mode 100644
index 805e4c987e374d35be122d5ddedc1bc2e2102172..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/bindings/map_traits_wtf.h
+++ /dev/null
@@ -1,62 +0,0 @@
-// 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_MAP_TRAITS_WTF_H_
-#define MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_WTF_H_
-
-#include "base/logging.h"
-#include "mojo/public/cpp/bindings/map_traits.h"
-#include "mojo/public/cpp/bindings/wtf_map.h"
-
-namespace mojo {
-
-template <typename K, typename V>
-struct MapTraits<WTFMap<K, V>> {
- using Key = K;
- using Value = V;
- using Iterator = typename WTFMap<K, V>::Iterator;
- using ConstIterator = typename WTFMap<K, V>::ConstIterator;
-
- static bool IsNull(const WTFMap<K, V>& input) { return input.is_null(); }
- static void SetToNull(WTFMap<K, V>* output) { *output = nullptr; }
-
- static size_t GetSize(const WTFMap<K, V>& input) { return input.size(); }
-
- static ConstIterator GetBegin(const WTFMap<K, V>& input) {
- return input.begin();
- }
- static Iterator GetBegin(WTFMap<K, V>& input) { return input.begin(); }
-
- static void AdvanceIterator(ConstIterator& iterator) { ++iterator; }
- static void AdvanceIterator(Iterator& iterator) { ++iterator; }
-
- static const K& GetKey(Iterator& iterator) { return iterator->key; }
- static const K& GetKey(ConstIterator& iterator) { return iterator->key; }
-
- static V& GetValue(Iterator& iterator) { return iterator->value; }
- static const V& GetValue(ConstIterator& iterator) { return iterator->value; }
-
- static bool Insert(WTFMap<K, V>& input, const K& key, V&& value) {
- if (!WTFMap<K, V>::IsValidKey(key)) {
- LOG(ERROR) << "The key value is disallowed by WTF::HashMap: " << key;
- return false;
- }
- input.insert(key, std::forward<V>(value));
- return true;
- }
- static bool Insert(WTFMap<K, V>& input, const K& key, const V& value) {
- if (!WTFMap<K, V>::IsValidKey(key)) {
- LOG(ERROR) << "The key value is disallowed by WTF::HashMap: " << key;
- return false;
- }
- input.insert(key, value);
- return true;
- }
-
- static void SetToEmpty(WTFMap<K, V>* output) { output->SetToEmpty(); }
-};
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_WTF_H_
« no previous file with comments | « mojo/public/cpp/bindings/lib/wtf_serialization.h ('k') | mojo/public/cpp/bindings/struct_traits.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698