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

Unified Diff: mojo/public/cpp/bindings/tests/type_conversion_unittest.cc

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/struct_unittest.cc ('k') | mojo/public/cpp/bindings/tests/union_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
diff --git a/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc b/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
index a2692a064ab5d8ef0c983d91719f890061c6c100..7eb24ea033081be08c811c9637e8b762728e0986 100644
--- a/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
+++ b/mojo/public/cpp/bindings/tests/type_conversion_unittest.cc
@@ -69,8 +69,8 @@ template <>
struct TypeConverter<test::NamedRegionPtr, RedmondNamedRegion> {
static test::NamedRegionPtr Convert(const RedmondNamedRegion& input) {
test::NamedRegionPtr region(test::NamedRegion::New());
- region->name = input.name;
- region->rects = Array<test::RectPtr>::From(input.rects);
+ region->name.emplace(input.name);
+ region->rects = Array<test::RectPtr>::From(input.rects).PassStorage();
return region;
}
};
@@ -79,8 +79,13 @@ template <>
struct TypeConverter<RedmondNamedRegion, test::NamedRegionPtr> {
static RedmondNamedRegion Convert(const test::NamedRegionPtr& input) {
RedmondNamedRegion region;
- region.name = input->name;
- region.rects = input->rects.To<std::vector<RedmondRect>>();
+ if (input->name)
+ region.name = input->name.value();
+ if (input->rects) {
+ region.rects.reserve(input->rects->size());
+ for (const auto& element : *input->rects)
+ region.rects.push_back(element.To<RedmondRect>());
+ }
return region;
}
};
« no previous file with comments | « mojo/public/cpp/bindings/tests/struct_unittest.cc ('k') | mojo/public/cpp/bindings/tests/union_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698