mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Provide a handle for the ServiceProvider stub used by the application to expose services to the embedder
This commit is contained in:
parent
16f8b5059d
commit
b63c2d93e1
@ -41,7 +41,8 @@ void TakeServicesProvidedByEmbedder(Dart_NativeArguments args) {
|
||||
}
|
||||
|
||||
void TakeServicesProvidedToEmbedder(Dart_NativeArguments args) {
|
||||
Dart_SetIntegerReturnValue(args, 0);
|
||||
Dart_SetIntegerReturnValue(
|
||||
args, GetInternals()->TakeServicesProvidedToEmbedder().value());
|
||||
}
|
||||
|
||||
void TakeServiceRegistry(Dart_NativeArguments args) {
|
||||
@ -93,10 +94,16 @@ Internals::Internals(mojo::ServiceProviderPtr platform_service_provider,
|
||||
mojo::asset_bundle::AssetBundlePtr root_bundle)
|
||||
: root_bundle_(root_bundle.Pass()),
|
||||
service_provider_impl_(GetProxy(&service_provider_)),
|
||||
|
||||
platform_service_provider_(platform_service_provider.Pass()) {
|
||||
service_provider_impl_.set_fallback_service_provider(
|
||||
platform_service_provider_.get());
|
||||
service_provider_impl_.AddService<mojo::asset_bundle::AssetUnpacker>(this);
|
||||
|
||||
// Currently we don't consume any services provided by the application.
|
||||
// So there's no need to hold the proxy to the application's ServiceProvider.
|
||||
mojo::ServiceProviderPtr application_service_provider;
|
||||
services_provided_to_embedder_ = GetProxy(&application_service_provider);
|
||||
}
|
||||
|
||||
Internals::~Internals() {
|
||||
@ -117,5 +124,9 @@ mojo::Handle Internals::TakeRootBundleHandle() {
|
||||
return root_bundle_.PassInterface().PassHandle().release();
|
||||
}
|
||||
|
||||
mojo::Handle Internals::TakeServicesProvidedToEmbedder() {
|
||||
return services_provided_to_embedder_.PassMessagePipe().release();
|
||||
}
|
||||
|
||||
} // namespace shell
|
||||
} // namespace sky
|
||||
|
||||
@ -31,6 +31,7 @@ class Internals
|
||||
|
||||
mojo::Handle TakeServicesProvidedByEmbedder();
|
||||
mojo::Handle TakeRootBundleHandle();
|
||||
mojo::Handle TakeServicesProvidedToEmbedder();
|
||||
|
||||
private:
|
||||
explicit Internals(mojo::ServiceProviderPtr platform_service_provider,
|
||||
@ -46,6 +47,11 @@ class Internals
|
||||
mojo::ServiceProviderImpl service_provider_impl_;
|
||||
mojo::ServiceProviderPtr platform_service_provider_;
|
||||
|
||||
// A ServiceProvider supplied by the application that exposes services to
|
||||
// the embedder.
|
||||
mojo::InterfaceRequest<mojo::ServiceProvider>
|
||||
services_provided_to_embedder_;
|
||||
|
||||
MOJO_DISALLOW_COPY_AND_ASSIGN(Internals);
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user