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

Unified Diff: mojo/public/cpp/bindings/lib/serialization.h

Issue 2754003005: Mojo C++ Bindings: fix mojom::Foo::Deserialize() for component build. (Closed)
Patch Set: . Created 3 years, 9 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 | « no previous file | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/lib/serialization.h
diff --git a/mojo/public/cpp/bindings/lib/serialization.h b/mojo/public/cpp/bindings/lib/serialization.h
index 359b02b77c25a55636560bb7d94f28e28a0bf702..2a7d288d55492322ab451052e727d3fbb18c349c 100644
--- a/mojo/public/cpp/bindings/lib/serialization.h
+++ b/mojo/public/cpp/bindings/lib/serialization.h
@@ -64,7 +64,10 @@ DataArrayType StructSerializeImpl(UserType* input) {
}
template <typename MojomType, typename DataArrayType, typename UserType>
-bool StructDeserializeImpl(const DataArrayType& input, UserType* output) {
+bool StructDeserializeImpl(const DataArrayType& input,
+ UserType* output,
+ bool (*validate_func)(const void*,
+ ValidationContext*)) {
static_assert(BelongsTo<MojomType, MojomTypeCategory::STRUCT>::value,
"Unexpected type.");
using DataType = typename MojomTypeTraits<MojomType>::Data;
@@ -86,7 +89,7 @@ bool StructDeserializeImpl(const DataArrayType& input, UserType* output) {
ValidationContext validation_context(input_buffer, input.size(), 0, 0);
bool result = false;
- if (DataType::Validate(input_buffer, &validation_context)) {
+ if (validate_func(input_buffer, &validation_context)) {
auto data = reinterpret_cast<DataType*>(input_buffer);
SerializationContext context;
result = Deserialize<MojomType>(data, output, &context);
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/tests/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698