Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(82)

Unified Diff: sky/framework/embedder.dart

Issue 954653002: Make Sky embedder.connection deal with null handles (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/dart/src/application_connection.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/embedder.dart
diff --git a/sky/framework/embedder.dart b/sky/framework/embedder.dart
index 90046be8aefb5ff609e23a25886842ce526354bf..8b2385d71fde1c0c284e0a694ccd9f432164c57e 100644
--- a/sky/framework/embedder.dart
+++ b/sky/framework/embedder.dart
@@ -12,14 +12,26 @@ import "package:mojo/public/interfaces/application/shell.mojom.dart";
final _EmbedderImpl embedder = new _EmbedderImpl();
class _EmbedderImpl {
- static final ShellProxy shell = new ShellProxy.fromHandle(
+ ApplicationConnection _connection;
+
+ final ShellProxy shell = new ShellProxy.fromHandle(
new core.MojoHandle(internals.takeShellProxyHandle()));
- static final ApplicationConnection connection = new ApplicationConnection(
- new ServiceProviderStub.fromHandle(
- new core.MojoHandle(internals.takeServicesProvidedToEmbedder())),
- new ServiceProviderProxy.fromHandle(
- new core.MojoHandle(internals.takeServicesProvidedByEmbedder())));
+ ApplicationConnection get connection {
+ if (_connection == null) {
+ var stubHandle = new core.MojoHandle(
+ internals.takeServicesProvidedToEmbedder());
+ var proxyHandle = new core.MojoHandle(
+ internals.takeServicesProvidedByEmbedder());
+ _connection = new ApplicationConection(
+ stubHandle.isValid ? ServiceProviderStub.fromHandle(stubHandle)
+ : null;
+ proxyHandle.isValid ? ServiceProviderProxy.fromHandle(proxyHandle)
+ : null;
+ );
+ }
+ return _connection;
+ }
ApplicationConnection connectToApplication(String url) {
var proxy = new ServiceProviderProxy.unbound();
« no previous file with comments | « mojo/public/dart/src/application_connection.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698