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

Unified Diff: mojo/public/cpp/bindings/wtf_array.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/tests/wtf_types_unittest.cc ('k') | mojo/public/cpp/bindings/wtf_map.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/wtf_array.h
diff --git a/mojo/public/cpp/bindings/wtf_array.h b/mojo/public/cpp/bindings/wtf_array.h
index 116d1b9ddcaa9c543d45cd1f1c36651ff8041a4f..46d9a6958bd658145761b1d7359993bc06cea57c 100644
--- a/mojo/public/cpp/bindings/wtf_array.h
+++ b/mojo/public/cpp/bindings/wtf_array.h
@@ -12,6 +12,7 @@
#include "mojo/public/cpp/bindings/lib/array_internal.h"
#include "mojo/public/cpp/bindings/lib/bindings_internal.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/Vector.h"
@@ -147,9 +148,7 @@ class WTFArray {
WTFArray Clone() const {
WTFArray result;
result.is_null_ = is_null_;
- result.vec_.reserveCapacity(vec_.size());
- for (const auto& element : vec_)
- result.vec_.append(internal::Clone(element));
+ result.vec_ = internal::Clone(vec_);
return result;
}
@@ -159,13 +158,7 @@ class WTFArray {
bool Equals(const WTFArray& other) const {
if (is_null() != other.is_null())
return false;
- if (size() != other.size())
- return false;
- for (size_t i = 0; i < size(); ++i) {
- if (!internal::Equals(at(i), other.at(i)))
- return false;
- }
- return true;
+ return internal::Equals(vec_, other.vec_);
}
private:
« no previous file with comments | « mojo/public/cpp/bindings/tests/wtf_types_unittest.cc ('k') | mojo/public/cpp/bindings/wtf_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698