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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/ui/view_associates.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/view_associates.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_associates.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_associates.mojom.dart
index c668f2f47d58e8f6ea015096d990563f8454e2aa..79001456ee525207dca4c70834254b75b70e35aa 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/ui/view_associates.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/ui/view_associates.mojom.dart
@@ -981,14 +981,19 @@ class ViewAssociateProxy implements bindings.ProxyBase {
class ViewAssociateStub extends bindings.Stub {
- ViewAssociate _impl = null;
+ ViewAssociate _impl;
ViewAssociateStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [ViewAssociate impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- ViewAssociateStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ ViewAssociateStub.fromHandle(
+ core.MojoHandle handle, [ViewAssociate impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
ViewAssociateStub.unbound() : super.unbound();
@@ -1011,7 +1016,9 @@ class ViewAssociateStub 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 _viewAssociateMethodConnectName:
var params = _ViewAssociateConnectParams.deserialize(
@@ -1054,10 +1061,23 @@ class ViewAssociateStub extends bindings.Stub {
ViewAssociate get impl => _impl;
set impl(ViewAssociate 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 "ViewAssociateStub($superString)";
@@ -1255,14 +1275,19 @@ class ViewInspectorProxy implements bindings.ProxyBase {
class ViewInspectorStub extends bindings.Stub {
- ViewInspector _impl = null;
+ ViewInspector _impl;
ViewInspectorStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [ViewInspector impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- ViewInspectorStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ ViewInspectorStub.fromHandle(
+ core.MojoHandle handle, [ViewInspector impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
ViewInspectorStub.unbound() : super.unbound();
@@ -1290,7 +1315,9 @@ class ViewInspectorStub 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 _viewInspectorMethodGetHitTesterName:
var params = _ViewInspectorGetHitTesterParams.deserialize(
@@ -1345,10 +1372,23 @@ class ViewInspectorStub extends bindings.Stub {
ViewInspector get impl => _impl;
set impl(ViewInspector 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 "ViewInspectorStub($superString)";

Powered by Google App Engine
This is Rietveld 408576698