New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 762025 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
please use my google.com address
Closed: Sep 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug



Sign in to add a comment

Support message attachments with [Native]-mapped structs

Project Member Reported by roc...@chromium.org, Sep 5 2017

Issue description

[Native]-mapped structs map to C++ types with appropriate IPC::ParamTraits specializations. Currently this arrangement requires the traits to accept a base::Pickle, and any message attachments provided by traits are ignored. This effectively means that such structs cannot carry any kind of handles, Mojo or otherwise.

We should change the wire representation of native structs to include support for Mojo handles and update the native struct serialization logic to convert between legacy IPC MessageAttachment and Mojo handles.

The motivation here is to support at least one complex use case in resource loading.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Sep 14 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/fd907634b5ea956b34bd1672c084089aad2150cd

commit fd907634b5ea956b34bd1672c084089aad2150cd
Author: Ken Rockot <rockot@chromium.org>
Date: Thu Sep 14 04:23:41 2017

Mojo Bindings: Support handles in native structs

Changes [Native] struct serialization to use an IPC::Message instead of
a base::Pickle, allowing ParamTraits for [Native]-mapped types to be
parameterized over IPC::Message once again. In order to support this,
IPC::Message and related attachment support code has been moved into a
separate leaf target in //ipc, avoiding circular dependencies with Mojo
bindings.

Also changes the wire representation of native structs to allow for
typed Mojo handle attachments, and wires up native struct
serialization to automatically convert between IPC::MessageAttachments
and these typed mojom handles.

The net result here is that [Native] mojom structs can be mapped to
native types whose ParamTraits use message attachments.

BUG= 762025 

Change-Id: Ib058eff2f32e0e7abfff9619da9f142113ad28ed
Reviewed-on: https://chromium-review.googlesource.com/650219
Commit-Queue: Ken Rockot <rockot@chromium.org>
Reviewed-by: John Abd-El-Malek <jam@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Yuzhu Shen <yzshen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#501866}
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/content/browser/site_per_process_browsertest.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/content/common/BUILD.gn
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/content/common/renderer.mojom
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/BUILD.gn
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/OWNERS
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/constants.mojom
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/handle_attachment_fuchsia.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/handle_attachment_win.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/handle_fuchsia.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/handle_win.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc.mojom
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_channel_mojo.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_channel_mojo.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_attachment.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_attachment.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_attachment_set.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_pipe_reader.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_pipe_reader.h
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_support_export.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_message_utils.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_mojo_bootstrap_unittest.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_mojo_handle_attachment.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_mojo_message_helper.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_mojo_message_helper.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_mojo_param_traits.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_platform_file.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_platform_file_attachment_posix.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/ipc_sync_message.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/mach_port_attachment_mac.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/mach_port_mac.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/mach_port_mac.h
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/native_handle_type_converters.cc
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/ipc/native_handle_type_converters.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/BUILD.gn
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/lib/bindings_internal.h
[delete] https://crrev.com/b0ad6af8d420a7b4b53d60350da123d950f23cbf/mojo/public/cpp/bindings/lib/native_struct.cc
[delete] https://crrev.com/b0ad6af8d420a7b4b53d60350da123d950f23cbf/mojo/public/cpp/bindings/lib/native_struct_data.cc
[delete] https://crrev.com/b0ad6af8d420a7b4b53d60350da123d950f23cbf/mojo/public/cpp/bindings/lib/native_struct_data.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/lib/native_struct_serialization.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/lib/native_struct_serialization.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/lib/serialization.h
[delete] https://crrev.com/b0ad6af8d420a7b4b53d60350da123d950f23cbf/mojo/public/cpp/bindings/native_struct.h
[delete] https://crrev.com/b0ad6af8d420a7b4b53d60350da123d950f23cbf/mojo/public/cpp/bindings/native_struct_data_view.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/BUILD.gn
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/data_view_unittest.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/hash_unittest.cc
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/native_struct_unittest.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/struct_unittest.cc
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/test_native_types.cc
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/test_native_types.h
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/test_native_types_chromium.typemap
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/cpp/bindings/tests/wtf_hash_unittest.cc
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/interfaces/bindings/BUILD.gn
[add] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/interfaces/bindings/native_struct.mojom
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/interfaces/bindings/tests/test_native_types.mojom
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/generators/cpp_templates/module-shared-internal.h.tmpl
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/generators/cpp_templates/module-shared.h.tmpl
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/generators/cpp_templates/module.h.tmpl
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/generators/cpp_templates/struct_serialization_declaration.tmpl
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/generators/mojom_cpp_generator.py
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/mojom.gni
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/mojom_bindings_generator.py
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/pylib/mojom/generate/generator.py
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/pylib/mojom/generate/module.py
[modify] https://crrev.com/fd907634b5ea956b34bd1672c084089aad2150cd/mojo/public/tools/bindings/pylib/mojom/generate/translate.py

Comment 2 by roc...@chromium.org, Sep 25 2017

Status: Fixed (was: Assigned)

Sign in to add a comment