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

Unified Diff: mojo/public/cpp/bindings/array_traits_stl.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
Index: mojo/public/cpp/bindings/array_traits_stl.h
diff --git a/mojo/public/cpp/bindings/array_traits_stl.h b/mojo/public/cpp/bindings/array_traits_stl.h
index 51af5ad7a1b28dae51c5b4f77d449b0a115761c5..9054a920190cd455890b3263e366c1811b3ce574 100644
--- a/mojo/public/cpp/bindings/array_traits_stl.h
+++ b/mojo/public/cpp/bindings/array_traits_stl.h
@@ -43,7 +43,16 @@ struct ArrayTraits<std::vector<T>> {
}
static bool Resize(std::vector<T>& input, size_t size) {
- input.resize(size);
+ if (input.size() != size) {
+ // This is a hack to make compilers for Mac and Android happy. They
+ // currently don't allow resizing types like
+ // std::vector<std::vector<MoveOnlyType>>.
Ken Rockot(use gerrit already) 2016/07/11 23:59:03 weird
yzshen1 2016/07/12 16:29:20 It is possible that the compiler version is not fu
+ // Because the deserialization code doesn't care about the original
+ // contents of |input|, we discard them directly.
+ std::vector<T> temp(size);
+ input.swap(temp);
+ }
+
return true;
}
};

Powered by Google App Engine
This is Rietveld 408576698