Commit da6b36bc authored by Erik Chen's avatar Erik Chen Committed by Commit Bot

lacros: Add an ash_chrome_service_version field to LacrosInitParams.

This will allow lacros to synchronously determine ash's version. This
allows Lacros to avoid using unsupported APIs.

Bug: 1130810
Change-Id: I57fb355861b70b082499e123606f97366e0c3670
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2423203Reviewed-by: default avatarGreg Kerr <kerrnel@chromium.org>
Reviewed-by: default avatarJames Cook <jamescook@chromium.org>
Commit-Queue: Erik Chen <erikchen@chromium.org>
Auto-Submit: Erik Chen <erikchen@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809533}
parent aee50e0b
...@@ -120,7 +120,10 @@ SendMojoInvitationToLacrosChrome( ...@@ -120,7 +120,10 @@ SendMojoInvitationToLacrosChrome(
invitation.AttachMessagePipe(0 /* token */), /*version=*/0)); invitation.AttachMessagePipe(0 /* token */), /*version=*/0));
lacros_chrome_service.set_disconnect_handler( lacros_chrome_service.set_disconnect_handler(
std::move(mojo_disconnected_callback)); std::move(mojo_disconnected_callback));
lacros_chrome_service->Init(crosapi::mojom::LacrosInitParams::New()); auto params = crosapi::mojom::LacrosInitParams::New();
params->ash_chrome_service_version =
crosapi::mojom::AshChromeService::Version_;
lacros_chrome_service->Init(std::move(params));
lacros_chrome_service->RequestAshChromeServiceReceiver( lacros_chrome_service->RequestAshChromeServiceReceiver(
std::move(ash_chrome_service_callback)); std::move(ash_chrome_service_callback));
mojo::OutgoingInvitation::Send(std::move(invitation), mojo::OutgoingInvitation::Send(std::move(invitation),
......
...@@ -39,10 +39,28 @@ interface AshChromeService { ...@@ -39,10 +39,28 @@ interface AshChromeService {
}; };
// LacrosInitParams is a set of parameters for initialization of lacros-chrome, // LacrosInitParams is a set of parameters for initialization of lacros-chrome,
// which is passed from ash-chrome. // which is passed from ash-chrome to lacros-chrome. Since ash-chrome and
// lacros-chrome may have different versions, lacros-chrome must handle this
// struct carefully.
//
// If ash-chrome is older than lacros-chrome, then some fields may not be
// present in the serialized IPC message. This manifests as the newer (missing)
// fields taking on default values in lacros-chrome. This means
// that the default value for each field must always be interpreted to mean:
// this field was not sent because ash-chrome was too old. If the default value
// needs to have a different meaning, then we must also add a bool field
// describing the validity of this field. Mojo currently does not support
// optional primitives.
//
// If ash-chrome is newer than lacros-chrome, then some fields may not be
// processed by lacros-chrome.
[Stable] [Stable]
struct LacrosInitParams { struct LacrosInitParams {
// This is placeholder, so now it is empty. // This is ash-chrome's version of the AshChromeService interface. This is
// used by lacros-chrome to determine which interface methods are safe to
// call.
[MinVersion=1]
uint32 ash_chrome_service_version@0;
}; };
// LacrosChromeService defines the APIs that live in lacros-chrome and // LacrosChromeService defines the APIs that live in lacros-chrome and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment