提交 acdf951c 编写于 作者: J Jason Simmons

Merge pull request #2042 from jason-simmons/application_service_provider

Provide a handle for the ServiceProvider stub used by the application…
......@@ -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);
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册