Skip to content

Commit

Permalink
mojo: drop lazy serialization support for interfaces
Browse files Browse the repository at this point in the history
Lazy serialization is only used in tests, and it complicates the
binding generator a bunch. This test removes lazy serialization
for interfaces and all its test coverage. It does not remove lazy
message serialization.

Bug: 40732837
Change-Id: Ie5dfbf5c5d8524c8aa9ca425f31a5ab0f23e4772
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5381630
Reviewed-by: Richard (Torne) Coles <[email protected]>
Commit-Queue: Elly FJ <[email protected]>
Reviewed-by: Oksana Zhuravlova <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1276568}
  • Loading branch information
Elly authored and Chromium LUCI CQ committed Mar 21, 2024
1 parent 2738ede commit ba734fd
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 358 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -216,8 +216,7 @@ def _GenerateModule(self, args, remaining_args, generator_modules,
for_blink=args.for_blink,
export_attribute=args.export_attribute,
export_header=args.export_header,
generate_non_variant_code=args.generate_non_variant_code,
support_lazy_serialization=args.support_lazy_serialization)
generate_non_variant_code=args.generate_non_variant_code)
filtered_args = []
if hasattr(generator_module, 'GENERATOR_PREFIX'):
prefix = '--' + generator_module.GENERATOR_PREFIX + '_'
Expand Down Expand Up @@ -366,10 +365,6 @@ def main():
"a salt for generating scrambled message IDs. If this switch is specified"
"more than once, the contents of all salt files are concatenated to form"
"the salt value.", default=[], action="append")
generate_parser.add_argument(
"--support_lazy_serialization",
help="If set, generated bindings will serialize lazily when possible.",
action="store_true")
generate_parser.set_defaults(func=_Generate)

precompile_parser = subparsers.add_parser("precompile",
Expand Down
10 changes: 0 additions & 10 deletions components/cronet/tools/generators/cronet_c_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ def _GetJinjaExports(self):
"namespace": self.module.namespace,
"namespaces_as_array": NamespaceToArray(self.module.namespace),
"structs": self.module.structs,
"support_lazy_serialization": self.support_lazy_serialization,
"unions": self.module.unions,
"variant": self.variant,
}
Expand Down Expand Up @@ -344,8 +343,6 @@ def GetFilters(self):
"get_qualified_name_for_kind": self._GetQualifiedNameForKind,
"has_callbacks": mojom.HasCallbacks,
"has_sync_methods": mojom.HasSyncMethods,
"method_supports_lazy_serialization":
self._MethodSupportsLazySerialization,
"requires_context_for_data_view": RequiresContextForDataView,
"should_inline": ShouldInlineStruct,
"should_inline_union": ShouldInlineUnion,
Expand Down Expand Up @@ -706,13 +703,6 @@ def _GetUnionTraitGetterReturnType(self, kind):
add_same_module_namespaces=True)
return self._GetCppWrapperType(kind, add_same_module_namespaces=True)

def _MethodSupportsLazySerialization(self, method):
# TODO(crbug.com/753431,crbug.com/753433): Support lazy serialization for
# methods which pass associated handles and InterfacePtrs.
return self.support_lazy_serialization and (
not mojom.MethodPassesAssociatedKinds(method) and
not mojom.MethodPassesInterfaces(method))

def _TranslateConstants(self, token, kind):
if isinstance(token, mojom.NamedValue):
return self._GetNameForKind(token, flatten_nested_kind=True)
Expand Down
1 change: 0 additions & 1 deletion ipc/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ mojom("mojom_constants") {
mojom("test_interfaces") {
testonly = true
sources = [ "ipc_test.mojom" ]
support_lazy_serialization = true
}

# This is provided as a separate target so other targets can provide param
Expand Down
3 changes: 0 additions & 3 deletions mojo/public/cpp/bindings/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ source_set("tests") {
"hash_unittest.cc",
"idle_tracking_unittest.cc",
"interface_unittest.cc",
"lazy_serialization_unittest.cc",
"map_unittest.cc",
"message_queue.cc",
"message_queue.h",
Expand Down Expand Up @@ -195,8 +194,6 @@ mojom("test_mojom") {
"//mojo/public/mojom/base",
]

support_lazy_serialization = true

cpp_typemaps = [
{
types = [
Expand Down
171 changes: 0 additions & 171 deletions mojo/public/cpp/bindings/tests/lazy_serialization_unittest.cc

This file was deleted.

4 changes: 0 additions & 4 deletions mojo/public/interfaces/bindings/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -189,8 +189,6 @@ mojom("test_interfaces") {
},
]

support_lazy_serialization = true

# Validation tests require precise message content matching, so we avoid
# scrambling message IDs for test interfaces.
scramble_message_ids = false
Expand Down Expand Up @@ -353,8 +351,6 @@ mojom("test_struct_traits_interfaces") {
[ "//mojo/public/cpp/bindings/tests:struct_with_traits_impl" ]
},
]

support_lazy_serialization = true
}

mojom("test_associated_interfaces") {
Expand Down
Loading

0 comments on commit ba734fd

Please sign in to comment.