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

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

Issue 2136733002: Mojo C++ bindings: add a new mode to generator to use native STL/WTF types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@67_new
Patch Set: . Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/bindings/wtf_array.h ('k') | mojo/public/interfaces/bindings/tests/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/wtf_map.h
diff --git a/mojo/public/cpp/bindings/wtf_map.h b/mojo/public/cpp/bindings/wtf_map.h
index 18d0c42b3ecf8721f37791fc1948cbab7be8b542..0aba9595172e0e22760c7a1a5aef38cc8c870350 100644
--- a/mojo/public/cpp/bindings/wtf_map.h
+++ b/mojo/public/cpp/bindings/wtf_map.h
@@ -10,6 +10,7 @@
#include "base/macros.h"
#include "mojo/public/cpp/bindings/lib/template_util.h"
+#include "mojo/public/cpp/bindings/lib/wtf_clone_equals_util.h"
#include "mojo/public/cpp/bindings/type_converter.h"
#include "third_party/WebKit/Source/wtf/HashMap.h"
#include "third_party/WebKit/Source/wtf/text/StringHash.h"
@@ -156,9 +157,7 @@ class WTFMap {
WTFMap Clone() const {
WTFMap result;
result.is_null_ = is_null_;
- auto map_end = map_.end();
- for (auto it = map_.begin(); it != map_end; ++it)
- result.map_.add(internal::Clone(it->key), internal::Clone(it->value));
+ result.map_ = internal::Clone(map_);
return result;
}
@@ -168,20 +167,7 @@ class WTFMap {
bool Equals(const WTFMap& other) const {
if (is_null() != other.is_null())
return false;
- if (size() != other.size())
- return false;
-
- auto this_end = map_.end();
- auto other_end = other.map_.end();
-
- for (auto iter = map_.begin(); iter != this_end; ++iter) {
- auto other_iter = other.map_.find(iter->key);
- if (other_iter == other_end ||
- !internal::Equals(iter->value, other_iter->value)) {
- return false;
- }
- }
- return true;
+ return internal::Equals(map_, other.map_);
}
ConstIterator begin() const { return map_.begin(); }
« no previous file with comments | « mojo/public/cpp/bindings/wtf_array.h ('k') | mojo/public/interfaces/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698