Dart: Removes name conflicts from generated bindings.

This change causes the generated abstract class having the same name as the interface to contain only the interface's method declarations. The generated Proxy class then implements the base class. In addition to implementing the interface methods, the generated Proxy class has one private field _proxyImpl, which is a MojoEventStreamListener and manages sending messages and receiving responses. Operations on the ProxyImpl (close, bind, etc.) are exposed through generated utility functions.

The generated Stub is largely as before with the difference that a class providing a service will implement the mojo interface and *have* a Stub rather than be a Stub. Where appropriate, this change also calls listen() immediately where a Stub is constructed.

BUG=
R=hansmuller@google.com, sky@chromium.org

Review URL: https://codereview.chromium.org/959993002
This commit is contained in:
Zachary Anderson 2015-02-26 15:16:14 -08:00
parent f17af20890
commit 7d03344783
3 changed files with 9 additions and 10 deletions

View File

@ -30,7 +30,7 @@ void main() {
var event = new events.Event();
event.action = constants.EventType_KEY_PRESSED;
event.keyData = keyData;
testHarness.dispatchInputEvent(event);
testHarness.ptr.dispatchInputEvent(event);
});
}
</script>

View File

@ -30,15 +30,15 @@ class IFrameEmbed extends Application {
// resolve until the vmcApp's onEmbed() method runs.
final echoService = new echo_service_mojom.EchoServiceProxy.unbound();
vmcAppConnection.requestService(echoService);
echoService.echoString("success").then((response) {
echoService.ptr.echoString("success").then((response) {
internals.notifyTestComplete(response.value);
});
var applicationPipe = new MojoMessagePipe();
var proxyEndpoint = applicationPipe.endpoints[0];
var applicationEndpoint = applicationPipe.endpoints[1];
vmcAppConnection.remoteServiceProvider.connectToService(
view_manager.ViewManagerClient.name, applicationEndpoint);
vmcAppConnection.remoteServiceProvider.ptr.connectToService(
view_manager.ViewManagerClientName, applicationEndpoint);
document.querySelector("iframe").
embedViewManagerClient(proxyEndpoint.handle.h);
}
@ -47,7 +47,6 @@ class IFrameEmbed extends Application {
main() {
var messagePipe = new MojoMessagePipe();
var app = new IFrameEmbed(messagePipe.endpoints[1]);
app.listen();
var shellProxy = new shell_mojom.ShellProxy.fromHandle(
new MojoHandle(internals.takeShellProxyHandle()));
app.initializeFromShellProxy(shellProxy, [], "");

View File

@ -12,18 +12,18 @@ import 'package:mojo/services/network/public/interfaces/network_service.mojom.da
import 'package:mojo/services/network/public/interfaces/url_loader.mojom.dart';
Future<String> run(url) async {
var networkService = new NetworkServiceProxy.unbound();
var networkService= new NetworkServiceProxy.unbound();
embedder.connectToService("mojo:network_service", networkService);
var urlLoaderProxy = new UrlLoaderProxy.unbound();
networkService.createUrlLoader(urlLoaderProxy);
var urlLoader = new UrlLoaderProxy.unbound();
networkService.ptr.createUrlLoader(urlLoader);
var urlRequest = new UrlRequest()
..url = url
..autoFollowRedirects = true;
var urlResponse = await urlLoaderProxy.start(urlRequest);
var urlResponse = await urlLoader.ptr.start(urlRequest);
urlLoaderProxy.close();
urlLoader.close();
networkService.close();
print("url => ${urlResponse.response.url}");