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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/input_connection.mojom.dart

Issue 1948003003: Dart: Wait to handle events on a Stub until it makes sense to do it. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Add test 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_services/lib/mojo/ui/input_connection.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/input_connection.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/input_connection.mojom.dart
index 9c4c0d7dcfa92084eb808d7c6addbfbb0a832c3d..38689757ef8f5d701aba24ae4481e171df10b4f1 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/input_connection.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/input_connection.mojom.dart
@@ -355,14 +355,19 @@ class InputConnectionProxy implements bindings.ProxyBase {
class InputConnectionStub extends bindings.Stub {
- InputConnection _impl = null;
+ InputConnection _impl;
InputConnectionStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [InputConnection impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- InputConnectionStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ InputConnectionStub.fromHandle(
+ core.MojoHandle handle, [InputConnection impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
InputConnectionStub.unbound() : super.unbound();
@@ -380,7 +385,9 @@ class InputConnectionStub extends bindings.Stub {
0,
message);
}
- assert(_impl != null);
+ if (_impl == null) {
+ throw new core.MojoApiError("$this has no implementation set");
+ }
switch (message.header.type) {
case _inputConnectionMethodSetListenerName:
var params = _InputConnectionSetListenerParams.deserialize(
@@ -396,10 +403,23 @@ class InputConnectionStub extends bindings.Stub {
InputConnection get impl => _impl;
set impl(InputConnection d) {
- assert(_impl == null);
+ if (d == null) {
+ throw new core.MojoApiError("$this: Cannot set a null implementation");
+ }
+ if (isBound && (_impl == null)) {
+ beginHandlingEvents();
+ }
_impl = d;
}
+ @override
+ void bind(core.MojoMessagePipeEndpoint endpoint) {
+ super.bind(endpoint);
+ if (!isOpen && (_impl != null)) {
+ beginHandlingEvents();
+ }
+ }
+
String toString() {
var superString = super.toString();
return "InputConnectionStub($superString)";
@@ -565,14 +585,19 @@ class InputListenerProxy implements bindings.ProxyBase {
class InputListenerStub extends bindings.Stub {
- InputListener _impl = null;
+ InputListener _impl;
InputListenerStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [InputListener impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- InputListenerStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ InputListenerStub.fromHandle(
+ core.MojoHandle handle, [InputListener impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
InputListenerStub.unbound() : super.unbound();
@@ -595,7 +620,9 @@ class InputListenerStub extends bindings.Stub {
0,
message);
}
- assert(_impl != null);
+ if (_impl == null) {
+ throw new core.MojoApiError("$this has no implementation set");
+ }
switch (message.header.type) {
case _inputListenerMethodOnEventName:
var params = _InputListenerOnEventParams.deserialize(
@@ -628,10 +655,23 @@ class InputListenerStub extends bindings.Stub {
InputListener get impl => _impl;
set impl(InputListener d) {
- assert(_impl == null);
+ if (d == null) {
+ throw new core.MojoApiError("$this: Cannot set a null implementation");
+ }
+ if (isBound && (_impl == null)) {
+ beginHandlingEvents();
+ }
_impl = d;
}
+ @override
+ void bind(core.MojoMessagePipeEndpoint endpoint) {
+ super.bind(endpoint);
+ if (!isOpen && (_impl != null)) {
+ beginHandlingEvents();
+ }
+ }
+
String toString() {
var superString = super.toString();
return "InputListenerStub($superString)";

Powered by Google App Engine
This is Rietveld 408576698