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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.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_dispatcher.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart
index 393a7ddff93b10a69857eccf89a35f363447ec8f..dc549e526cd577d6a3118536a3b478992421e850 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/input_dispatcher.mojom.dart
@@ -212,14 +212,19 @@ class InputDispatcherProxy implements bindings.ProxyBase {
class InputDispatcherStub extends bindings.Stub {
- InputDispatcher _impl = null;
+ InputDispatcher _impl;
InputDispatcherStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [InputDispatcher impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- InputDispatcherStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ InputDispatcherStub.fromHandle(
+ core.MojoHandle handle, [InputDispatcher impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
InputDispatcherStub.unbound() : super.unbound();
@@ -237,7 +242,9 @@ class InputDispatcherStub 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 _inputDispatcherMethodDispatchEventName:
var params = _InputDispatcherDispatchEventParams.deserialize(
@@ -253,10 +260,23 @@ class InputDispatcherStub extends bindings.Stub {
InputDispatcher get impl => _impl;
set impl(InputDispatcher 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 "InputDispatcherStub($superString)";

Powered by Google App Engine
This is Rietveld 408576698