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

Unified Diff: mojo/dart/packages/mojo/lib/src/codec.dart

Issue 1964193002: Dart: Refactors Proxies (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Address comments Created 4 years, 7 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
Index: mojo/dart/packages/mojo/lib/src/codec.dart
diff --git a/mojo/dart/packages/mojo/lib/src/codec.dart b/mojo/dart/packages/mojo/lib/src/codec.dart
index 092a9607026f2e75f1fe1323398761fe45ae1460..5fd7ac6242de4f8af6c40bfdf955b108aa4c70cf 100644
--- a/mojo/dart/packages/mojo/lib/src/codec.dart
+++ b/mojo/dart/packages/mojo/lib/src/codec.dart
@@ -210,7 +210,7 @@ class Encoder {
encodeHandle(value != null ? value.handle : null, offset, nullable);
void encodeInterface(
- core.MojoEventHandler interface, int offset, bool nullable) {
+ Object interface, int offset, bool nullable) {
if (interface == null) {
encodeInvalideHandle(offset, nullable);
// Set the version field to 0.
@@ -228,18 +228,18 @@ class Encoder {
// Set the version to the version in the stub.
encodeUint32(interface.version, offset + kSerializedHandleSize);
} else if (interface is Proxy) {
- if (!interface.isBound) {
+ if (!interface.ctrl.isBound) {
throw new MojoCodecError(
'Cannot encode an unbound proxy for an interface');
}
- if (!interface.isOpen) {
+ if (!interface.ctrl.isOpen) {
// Make sure that we are listening so that state for the proxy is
// cleaned up when the message is sent and the handle is closed.
- interface.beginHandlingEvents();
+ interface.ctrl.beginHandlingEvents();
}
- encodeMessagePipeHandle(interface.endpoint, offset, nullable);
+ encodeMessagePipeHandle(interface.ctrl.endpoint, offset, nullable);
// Set the version to the current version of the proxy.
- encodeUint32(interface.version, offset + kSerializedHandleSize);
+ encodeUint32(interface.ctrl.version, offset + kSerializedHandleSize);
} else {
throw new MojoCodecError('Cannot encode an unknown MojoEventHandler');
}
@@ -250,14 +250,14 @@ class Encoder {
encodeInvalideHandle(offset, nullable);
return;
}
- if (request is ProxyBase) {
- if (request.impl.isBound) {
+ if (request is Proxy) {
+ if (request.ctrl.isBound) {
throw new MojoCodecError(
'Cannot encode a bound proxy for an interface request');
}
var pipe = new core.MojoMessagePipe();
- request.impl.bind(pipe.endpoints[0]);
- request.impl.beginHandlingEvents();
+ request.ctrl.bind(pipe.endpoints[0]);
+ request.ctrl.beginHandlingEvents();
encodeMessagePipeHandle(pipe.endpoints[1], offset, nullable);
} else if (request is Stub) {
if (!request.isBound) {
@@ -746,15 +746,15 @@ class Decoder {
core.MojoSharedBuffer decodeSharedBufferHandle(int offset, bool nullable) =>
new core.MojoSharedBuffer(decodeHandle(offset, nullable));
- ProxyBase decodeServiceInterface(
+ Proxy decodeServiceInterface(
int offset, bool nullable, Function clientFactory) {
var endpoint = decodeMessagePipeHandle(offset, nullable);
var version = decodeUint32(offset + kSerializedHandleSize);
if (!endpoint.handle.isValid) {
return null;
}
- ProxyBase client = clientFactory(endpoint);
- client.impl._version = version;
+ Proxy client = clientFactory(endpoint);
+ client.ctrl._version = version;
return client;
}
« no previous file with comments | « mojo/dart/packages/mojo/lib/src/application_connection.dart ('k') | mojo/dart/packages/mojo/lib/src/event_handler.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698