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

Side by Side Diff: mojo/public/cpp/bindings/map_traits_stl.h

Issue 2034273002: Mojo C++ bindings: introduce mojo::WTFMap for blink bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed the code of adding enum key support to WTF::HashMap; which turned out to be non-trivial; wi… Created 4 years, 6 months 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STL_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STL_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STL_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STL_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "mojo/public/cpp/bindings/map_traits.h" 10 #include "mojo/public/cpp/bindings/map_traits.h"
(...skipping 26 matching lines...) Expand all
37 37
38 static void AdvanceIterator(ConstIterator& iterator) { iterator++; } 38 static void AdvanceIterator(ConstIterator& iterator) { iterator++; }
39 static void AdvanceIterator(Iterator& iterator) { iterator++; } 39 static void AdvanceIterator(Iterator& iterator) { iterator++; }
40 40
41 static const K& GetKey(Iterator& iterator) { return iterator->first; } 41 static const K& GetKey(Iterator& iterator) { return iterator->first; }
42 static const K& GetKey(ConstIterator& iterator) { return iterator->first; } 42 static const K& GetKey(ConstIterator& iterator) { return iterator->first; }
43 43
44 static V& GetValue(Iterator& iterator) { return iterator->second; } 44 static V& GetValue(Iterator& iterator) { return iterator->second; }
45 static const V& GetValue(ConstIterator& iterator) { return iterator->second; } 45 static const V& GetValue(ConstIterator& iterator) { return iterator->second; }
46 46
47 static void Insert(std::map<K, V>& input, const K& key, V&& value) { 47 static bool Insert(std::map<K, V>& input, const K& key, V&& value) {
48 input.insert(std::make_pair(key, std::forward<V>(value))); 48 input.insert(std::make_pair(key, std::forward<V>(value)));
49 return true;
49 } 50 }
50 static void Insert(std::map<K, V>& input, const K& key, const V& value) { 51 static bool Insert(std::map<K, V>& input, const K& key, const V& value) {
51 input.insert(std::make_pair(key, value)); 52 input.insert(std::make_pair(key, value));
53 return true;
52 } 54 }
53 55
54 static void SetToEmpty(std::map<K, V>* output) { output->clear(); } 56 static void SetToEmpty(std::map<K, V>* output) { output->clear(); }
55 }; 57 };
56 58
57 } // namespace mojo 59 } // namespace mojo
58 60
59 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STL_H_ 61 #endif // MOJO_PUBLIC_CPP_BINDINGS_MAP_TRAITS_STL_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/map_traits_standard.h ('k') | mojo/public/cpp/bindings/map_traits_wtf.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698