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

Side by Side Diff: mojo/public/cpp/bindings/lib/array_serialization.h

Issue 1966933002: Mojo C++ bindings: switch the existing usage of StructTraits to use the new data view interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@26_reader
Patch Set: typeid() is not allowed :/ Created 4 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <string.h> // For |memcpy()|. 9 #include <string.h> // For |memcpy()|.
10 10
(...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 Impl::SerializeElements(input, buf, result, validate_params, context); 383 Impl::SerializeElements(input, buf, result, validate_params, context);
384 *output = result; 384 *output = result;
385 } else { 385 } else {
386 *output = nullptr; 386 *output = nullptr;
387 } 387 }
388 } 388 }
389 389
390 static bool Deserialize(Data* input, 390 static bool Deserialize(Data* input,
391 UserType* output, 391 UserType* output,
392 SerializationContext* context) { 392 SerializationContext* context) {
393 if (input) 393 if (!input)
394 return Impl::DeserializeElements(input, output, context); 394 return CallSetToNullIfExists<Traits>(output);
395 Traits::SetToNull(*output); 395 return Impl::DeserializeElements(input, output, context);
396 return true;
397 } 396 }
398 }; 397 };
399 398
400 } // namespace internal 399 } // namespace internal
401 } // namespace mojo 400 } // namespace mojo
402 401
403 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_ 402 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_ARRAY_SERIALIZATION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698