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

Side by Side Diff: mojo/public/cpp/bindings/lib/native_struct_serialization.cc

Issue 2030873002: Mojo C++ bindings: rename ArrayValidateParams for clarity (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cc-enums
Patch Set: Rebase Created 4 years, 6 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 #include "mojo/public/cpp/bindings/lib/native_struct_serialization.h" 5 #include "mojo/public/cpp/bindings/lib/native_struct_serialization.h"
6 6
7 #include "mojo/public/cpp/bindings/lib/serialization.h" 7 #include "mojo/public/cpp/bindings/lib/serialization.h"
8 8
9 namespace mojo { 9 namespace mojo {
10 namespace internal { 10 namespace internal {
(...skipping 12 matching lines...) Expand all
23 const NativeStructPtr& input, 23 const NativeStructPtr& input,
24 Buffer* buffer, 24 Buffer* buffer,
25 NativeStruct_Data** output, 25 NativeStruct_Data** output,
26 SerializationContext* context) { 26 SerializationContext* context) {
27 if (!input) { 27 if (!input) {
28 *output = nullptr; 28 *output = nullptr;
29 return; 29 return;
30 } 30 }
31 31
32 Array_Data<uint8_t>* data = nullptr; 32 Array_Data<uint8_t>* data = nullptr;
33 const ArrayValidateParams params(0, false, nullptr); 33 const ContainerValidateParams params(0, false, nullptr);
34 internal::Serialize<Array<uint8_t>>(input->data, buffer, &data, &params, 34 internal::Serialize<Array<uint8_t>>(input->data, buffer, &data, &params,
35 context); 35 context);
36 *output = reinterpret_cast<NativeStruct_Data*>(data); 36 *output = reinterpret_cast<NativeStruct_Data*>(data);
37 } 37 }
38 38
39 // static 39 // static
40 bool UnmappedNativeStructSerializerImpl::Deserialize( 40 bool UnmappedNativeStructSerializerImpl::Deserialize(
41 NativeStruct_Data* input, 41 NativeStruct_Data* input,
42 NativeStructPtr* output, 42 NativeStructPtr* output,
43 SerializationContext* context) { 43 SerializationContext* context) {
44 Array_Data<uint8_t>* data = reinterpret_cast<Array_Data<uint8_t>*>(input); 44 Array_Data<uint8_t>* data = reinterpret_cast<Array_Data<uint8_t>*>(input);
45 45
46 NativeStructPtr result(NativeStruct::New()); 46 NativeStructPtr result(NativeStruct::New());
47 if (!internal::Deserialize<Array<uint8_t>>(data, &result->data, context)) { 47 if (!internal::Deserialize<Array<uint8_t>>(data, &result->data, context)) {
48 output = nullptr; 48 output = nullptr;
49 return false; 49 return false;
50 } 50 }
51 if (!result->data) 51 if (!result->data)
52 *output = nullptr; 52 *output = nullptr;
53 else 53 else
54 result.Swap(output); 54 result.Swap(output);
55 return true; 55 return true;
56 } 56 }
57 57
58 } // namespace internal 58 } // namespace internal
59 } // namespace mojo 59 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/native_struct_data.cc ('k') | mojo/public/cpp/bindings/lib/validate_params.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698