Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert legacy IPC messages to Mojo #3123

Closed
magreenblatt opened this issue May 12, 2021 · 6 comments
Closed

Convert legacy IPC messages to Mojo #3123

magreenblatt opened this issue May 12, 2021 · 6 comments
Labels
Framework Related to framework code or APIs task Task to be performed

Comments

@magreenblatt
Copy link
Collaborator

Original report by me.


Legacy IPC messaging is deprecated in Chromium. See here (minimal overview, somewhat outdated) and here (current full documentation) for background.

@magreenblatt
Copy link
Collaborator Author

Some recent examples of converting IPC messages to Mojo are here (adding a mojom interface), here (method with buildflag) and here (method with struct and callback).

@magreenblatt
Copy link
Collaborator Author

Convert legacy IPC messages to Mojo (fixes issue #3123)

This change introduces a few minor CEF API behavior changes:

  • A CefProcessMessage object cannot be reused after being passed to
    SendProcessMessage.
  • The |extra_info| argument to CefRenderProcessHandler::OnBrowserCreated may
    now be NULL.

Where appropriate, we now utilize the default UTF string encoding format and
shared memory to reduce copies and conversions for the cross-process
transfer of arbitrary-length strings. For example, CefFrame::GetSource/GetText
now involves zero UTF conversions and zero copies in the browser process for
the CefString delivered to CefStringVisitor::Visit().

→ <<cset ebee84755ed1 (bb)>>

@magreenblatt
Copy link
Collaborator Author

  • changed state from "new" to "resolved"

@magreenblatt
Copy link
Collaborator Author

See issue #2849 for follow-up fixes.

@magreenblatt
Copy link
Collaborator Author

Original comment by Alex Maitland (Bitbucket: a-maitland).


The |extra_info| argument to CefRenderProcessHandler::OnBrowserCreated may now be NULL.

Any chance you could provide any additional insight on when we might expect NULL? Thanks

@magreenblatt
Copy link
Collaborator Author

It will be NULL if NULL was passed into the source method (CreateBrowser, etc).

S1artie pushed a commit to GEBIT/cef that referenced this issue Aug 10, 2023
This change introduces a few minor CEF API behavior changes:

- A CefProcessMessage object cannot be reused after being passed to
  SendProcessMessage.
- The |extra_info| argument to CefRenderProcessHandler::OnBrowserCreated may
  now be NULL.

Where appropriate, we now utilize the default UTF string encoding format and
shared memory to reduce copies and conversions for the cross-process
transfer of arbitrary-length strings. For example, CefFrame::GetSource/GetText
now involves zero UTF conversions and zero copies in the browser process for
the CefString delivered to CefStringVisitor::Visit().
S1artie pushed a commit to GEBIT/cef that referenced this issue Aug 10, 2023
…romiumembedded#3126)

A reference to a received CefProcessMessage object and/or associated argument
list can now be kept outside of the OnProcessMessageReceived callback. The
argument list is no longer explicitly owned by the CefProcessMessage object
and can be individually assigned to other CefValue types as needed (e.g. by
passing to SetList, etc). Depending on client usage this could reduce the
potential for unnecessary copies of the list contents.

Received messages can also be sent back using SendProcessMessage (after which
the CefProcessMessage would become invalid as discussed in issue chromiumembedded#3123). This
is not new behavior but we have now added explicit unit test coverage for it.
This also no longer requires a copy of the argument list contents.

Note that a received argument list is initially read-only for logical
consistency. Assignment to another CefValue object could potentially remove
the read-only status because it is not an intrinsic property of the underlying
Chromium data type. This is fine because, at that point, ownership has been
transfered to the new CefValue object and the original logical context (as
part of the CefProcessMessage) no longer applies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Framework Related to framework code or APIs task Task to be performed
Projects
None yet
Development

No branches or pull requests

1 participant