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

Unified Diff: mojo/dart/packages/_mojo_for_test_only/lib/sample/sample_interfaces.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_for_test_only/lib/sample/sample_interfaces.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/sample/sample_interfaces.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/sample/sample_interfaces.mojom.dart
index a67959217808beb50f3f059b9e10a63d6f598a0a..6b094b4ed826cd112d51c374c5cc7b3925221496 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/sample/sample_interfaces.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/sample/sample_interfaces.mojom.dart
@@ -1620,14 +1620,19 @@ class ProviderProxy implements bindings.ProxyBase {
class ProviderStub extends bindings.Stub {
- Provider _impl = null;
+ Provider _impl;
ProviderStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [Provider impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- ProviderStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ ProviderStub.fromHandle(
+ core.MojoHandle handle, [Provider impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
ProviderStub.unbound() : super.unbound();
@@ -1671,7 +1676,9 @@ class ProviderStub 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 _providerMethodEchoStringName:
var params = _ProviderEchoStringParams.deserialize(
@@ -1792,10 +1799,23 @@ class ProviderStub extends bindings.Stub {
Provider get impl => _impl;
set impl(Provider 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 "ProviderStub($superString)";
@@ -1972,14 +1992,19 @@ class IntegerAccessorProxy implements bindings.ProxyBase {
class IntegerAccessorStub extends bindings.Stub {
- IntegerAccessor _impl = null;
+ IntegerAccessor _impl;
IntegerAccessorStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [IntegerAccessor impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- IntegerAccessorStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ IntegerAccessorStub.fromHandle(
+ core.MojoHandle handle, [IntegerAccessor impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
IntegerAccessorStub.unbound() : super.unbound();
@@ -2003,7 +2028,9 @@ class IntegerAccessorStub extends bindings.Stub {
3,
message);
}
- assert(_impl != null);
+ if (_impl == null) {
+ throw new core.MojoApiError("$this has no implementation set");
+ }
switch (message.header.type) {
case _integerAccessorMethodGetIntegerName:
var response = _impl.getInteger(_integerAccessorGetIntegerResponseParamsFactory);
@@ -2039,10 +2066,23 @@ class IntegerAccessorStub extends bindings.Stub {
IntegerAccessor get impl => _impl;
set impl(IntegerAccessor 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 "IntegerAccessorStub($superString)";
@@ -2229,14 +2269,19 @@ class SampleInterfaceProxy implements bindings.ProxyBase {
class SampleInterfaceStub extends bindings.Stub {
- SampleInterface _impl = null;
+ SampleInterface _impl;
SampleInterfaceStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [SampleInterface impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- SampleInterfaceStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ SampleInterfaceStub.fromHandle(
+ core.MojoHandle handle, [SampleInterface impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
SampleInterfaceStub.unbound() : super.unbound();
@@ -2260,7 +2305,9 @@ class SampleInterfaceStub 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 _sampleInterfaceMethodSampleMethod1Name:
var params = _SampleInterfaceSampleMethod1Params.deserialize(
@@ -2299,10 +2346,23 @@ class SampleInterfaceStub extends bindings.Stub {
SampleInterface get impl => _impl;
set impl(SampleInterface 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 "SampleInterfaceStub($superString)";
@@ -2332,7 +2392,7 @@ mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() {
// serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
// a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
// file. The string contains the base64 encoding of the gzip-compressed bytes.
- var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xb3W7jRBS243QJu1Rkty2k7J930UJuWqdFgoir9CIiFVSqVKjYG1ZpMjRGjR1sBy1vw+U+Bo/C5V7uG8C4mbMZn8z4p3XsSelIo6n/Mj6fv/OdmTPThjYrdda2WIvPQ1tDLb7vb9Y2aa3SarLjNmt/Zu2EtY9o3aT1x5fH3Vffd19+6/fHkwuy23Wm4/D6l7Q+FVw/dAJyTryDwYD4vutd9tMQ3HfsuX/YQ+LJfufksgl/zfu1PyBaj713Hb13eGzQOqpEj+sfR4/f7IpxecvajhYtLdTPv6zg+6B8xN4P8Nmg9R6tCLaF/sPn1mj9hdZTWq2ROyaWNx26Y9shnjV2f3Mt3xvM/phMzy7sgWUDLL51ZjtD2zn3rYD4gW/Nuns1v2E3fG4860/n+NHi+HDJG12LLWnx6UmeX2d2nh788FOXttu03o/iswvXRDiFz1cKwCmJ94CXiQ1k+BkJeHUQXscSvD6lNaQw9qcn9Nwnc9zw5QXcwuO7BeAm6heOKxxEDXYM9zXvRHloIr+sVdLxUONwFZ2H8oDh8R0JGHZivm0XxDcT4fU2pS5piEdtib2fMZvn9u545PcpfSmx3VCWbXeN61cXxC0NxTMZTn8Z+eD0kGl2BCd/4jo+KRUn7C91PWpvG73XHS1dSetHzYR4N+wHfZn/bBeAjwiHMM60JfEM+FTRxDi+FuCgc+MiXDB/TYH+GVx/oD9HtnNKPN92nSiewZ8TIsPzqwL1SJPoOR7nJMVLzF9T4Oe6oJ8Kqw1NHB9a+mL41TN8z9fX/J56wveE8ycJceZhyXEmL/2EOHOiWJxZVf2EeKSqfhoF66dxTf0M8dz5H+mnkaCfUN5dcZ7Xifme4beE+T3MY9C0X5jHKGOe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fmpTAj+lLjA+zFpvX/j5WYTeMELe6m1+vR3mSG+sv/8Xx4lasn0tNDctghvOvwa6C+aQWW4lSfw7tv/nlPYmGh+XoY3YbnTpebKvNYnsqwR/5339ZNH5wn5G84W4P4/SJzVbmK84IJtOn9wgnYriyD4EkGIK7sUI7sGa3Qeg10PLm+G+JVkc2cgojuB6JbT7cmSQJ/tUqLXLVdvn1oriyLx+P2s90f2SiZ4mbv9WT/Pr6anEeorbvx7HqcHoKm7/Ovt/Hsz+dfbyDM+KJPsuKlQ815h9F3hdo55rw4W/70avw6XVJ75XZM+B/u5fcj8iXt/u1jjtealcz/3sOJ8Yar+E82dp97OL9HOWch1XjdCVSD91DrcXkumnpS1PP3UJ9ZN2X+lVxcd74AdNq871oy/gnAz7Sq9yfWjKZU/I5dUK5wvVjNZt/8rIDrGfwNqhbPPSsq7b4vjeHnt1kd6+lkBvaedvsrZLitOeiNPBNZ+/iVr3ZfupSdd98f9r0vQz9jj8P79B/dS9a9BP/T8AAP//qXbi1dhAAAA=";
// Deserialize RuntimeTypeInfo
var bytes = BASE64.decode(serializedRuntimeTypeInfo);

Powered by Google App Engine
This is Rietveld 408576698