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

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

Issue 1837883003: Some fleshing out the mojo based localstorage implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/renderer/dom_storage/local_storage_cached_area.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_ARRAY_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> 9 #include <string.h>
10 #include <algorithm> 10 #include <algorithm>
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 static std::set<E> Convert(const Array<T>& input) { 288 static std::set<E> Convert(const Array<T>& input) {
289 std::set<E> result; 289 std::set<E> result;
290 if (!input.is_null()) { 290 if (!input.is_null()) {
291 for (size_t i = 0; i < input.size(); ++i) 291 for (size_t i = 0; i < input.size(); ++i)
292 result.insert(TypeConverter<E, T>::Convert(input[i])); 292 result.insert(TypeConverter<E, T>::Convert(input[i]));
293 } 293 }
294 return result; 294 return result;
295 } 295 }
296 }; 296 };
297 297
298 // Less than operator to allow Arrays as keys in std maps and sets.
299 template <typename T>
300 inline bool operator<(const Array<T>& a, const Array<T>& b) {
301 if (a.is_null())
302 return !b.is_null();
303 if (b.is_null())
304 return false;
305 return a.storage() < b.storage();
306 }
307
298 } // namespace mojo 308 } // namespace mojo
299 309
300 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_ 310 #endif // MOJO_PUBLIC_CPP_BINDINGS_ARRAY_H_
OLDNEW
« no previous file with comments | « content/renderer/dom_storage/local_storage_cached_area.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698