mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
At present there is a special case in Dart bindings generation which makes the Mojo SDK and things under mojo/services portable. However, we must not require things under mojo/services to be next to the Mojo SDK under mojo/public/... in client repos. Further, other collections of mojoms should also be portable. To fix this, instead of using the path in the host repo as the canonical package: import URI for the generated Dart code, this CL uses the mojom module name. BUG=https://github.com/domokit/mojo/issues/73 R=blundell@chromium.org, johnmccutchan@google.com, tonyg@chromium.org Review URL: https://codereview.chromium.org/1071693003
24 lines
878 B
Dart
24 lines
878 B
Dart
// Copyright 2015 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
import "dart:sky.internals" as internals;
|
|
import "package:mojo/public/dart/application.dart";
|
|
import 'package:mojo/public/dart/core.dart' as core;
|
|
import "package:mojo/service_provider.mojom.dart";
|
|
|
|
ApplicationConnection _initConnection() {
|
|
int rawHandle = internals.takeServicesProvidedByEmbedder();
|
|
core.MojoHandle proxyHandle = new core.MojoHandle(rawHandle);
|
|
ServiceProviderProxy serviceProvider = null;
|
|
if (proxyHandle.isValid)
|
|
serviceProvider = new ServiceProviderProxy.fromHandle(proxyHandle);
|
|
return new ApplicationConnection(null, serviceProvider);
|
|
}
|
|
|
|
final ApplicationConnection _connection = _initConnection();
|
|
|
|
void requestService(Object proxy) {
|
|
_connection.requestService(proxy);
|
|
}
|