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

Unified Diff: mojo/public/bindings/lib/array_internal.cc

Issue 131033002: Mojo: Simplify object serialization (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix indentation error Created 6 years, 11 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/bindings/lib/array_internal.h ('k') | mojo/public/bindings/lib/bindings_serialization.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/bindings/lib/array_internal.cc
diff --git a/mojo/public/bindings/lib/array_internal.cc b/mojo/public/bindings/lib/array_internal.cc
index a4ea9302d3b5d62be0007cd6994da7811b07b252..17a26b2157337dda85206f5d00296a654e30c8bd 100644
--- a/mojo/public/bindings/lib/array_internal.cc
+++ b/mojo/public/bindings/lib/array_internal.cc
@@ -34,5 +34,26 @@ ArrayDataTraits<bool>::BitRef::operator bool() const {
return (*storage_ & mask_) != 0;
}
+// static
+void ArraySerializationHelper<Handle>::EncodePointersAndHandles(
+ const ArrayHeader* header,
+ ElementType* elements,
+ std::vector<Handle>* handles) {
+ for (uint32_t i = 0; i < header->num_elements; ++i)
+ EncodeHandle(&elements[i], handles);
+}
+
+// static
+bool ArraySerializationHelper<Handle>::DecodePointersAndHandles(
+ const ArrayHeader* header,
+ ElementType* elements,
+ Message* message) {
+ for (uint32_t i = 0; i < header->num_elements; ++i) {
+ if (!DecodeHandle(&elements[i], &message->handles))
+ return false;
+ }
+ return true;
+}
+
} // namespace internal
} // namespace mojo
« no previous file with comments | « mojo/public/bindings/lib/array_internal.h ('k') | mojo/public/bindings/lib/bindings_serialization.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698