[service-manager] Clean up Connector API
Updates the Connector mojom and C++ APIs with clarifying naming and
type usage.
Connector has accumulated lots of cruft over the years and its API
conveys a number of muddled concepts which have lead to general
confusion, misuse, and abuse.
This attempts to sort all that out. Namely:
- All use of Identity in the Connector API has been migrated to
ServiceFilter where appropriate.
- StartService (first version) has been renamed to WarmService to
convey the correct intent. Bugs filed and TODOs dropped in places
where this is being used in an undesirable fashion.
- StartService (second version) has been renamed to
RegisterServiceInstance to convey more accurately what it does.
It also requires a complete Identity to be provided by the trusted
caller.
- QueryService takes only a service name instead of an Identity, since
it only needs to take a service name. It also makes no service
connection so it no longer returns a ConnectResult.
- FilterInterfaces is marked as deprecated on the mojom interface,
because we want to obliterate it.
- Test-only methods have been properly suffixed and made public,
eliminating the need for the weird TestApi wrapper thing. A
follow-up CL will delete TestApi and migrate its users.
- Connector methods which have async replies have optional callbacks
now instead of the Connector weirdly having a single catch-all
(and dubiously named) "StartServiceCallback" to handle all replies.
Bug: 902590
Change-Id: I5a986a5c114da914fd624dac7e6fd021cf139958
Reviewed-on: https://chromium-review.googlesource.com/c/1329845
Reviewed-by: Tom Sepez <[email protected]>
Reviewed-by: Oksana Zhuravlova <[email protected]>
Reviewed-by: Scott Violet <[email protected]>
Reviewed-by: John Abd-El-Malek <[email protected]>
Commit-Queue: Ken Rockot <[email protected]>
Cr-Commit-Position: refs/heads/master@{#607750}
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index ce64af11..ab4166e3 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -582,12 +582,13 @@
auto service_request = mojo::MakeRequest(&service);
service_manager::mojom::PIDReceiverPtr pid_receiver;
- service_manager::Identity identity(mojom::kBrowserServiceName, new_group);
- service_manager_connection->GetConnector()->StartService(
+ service_manager::Identity identity(mojom::kBrowserServiceName, new_group,
+ base::Token{},
+ base::Token::CreateRandom());
+ service_manager_connection->GetConnector()->RegisterServiceInstance(
identity, std::move(service), mojo::MakeRequest(&pid_receiver));
pid_receiver->SetPID(base::GetCurrentProcId());
- service_manager_connection->GetConnector()->StartService(identity);
BrowserContextServiceManagerConnectionHolder* connection_holder =
new BrowserContextServiceManagerConnectionHolder(
std::move(service_request));