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

Unified Diff: mojo/dart/packages/_mojo_for_test_only/lib/math/math_calculator.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/math/math_calculator.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/math/math_calculator.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/math/math_calculator.mojom.dart
index 52913ba3bb8771e75a34817a4be65c5ba3be6a37..d7d2fc602ee1255012954a466f37299a95eb6ead 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/math/math_calculator.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/math/math_calculator.mojom.dart
@@ -642,14 +642,19 @@ class CalculatorProxy implements bindings.ProxyBase {
class CalculatorStub extends bindings.Stub {
- Calculator _impl = null;
+ Calculator _impl;
CalculatorStub.fromEndpoint(
- core.MojoMessagePipeEndpoint endpoint, [this._impl])
- : super.fromEndpoint(endpoint);
+ core.MojoMessagePipeEndpoint endpoint, [Calculator impl])
+ : super.fromEndpoint(endpoint, autoBegin: impl != null) {
+ _impl = impl;
+ }
- CalculatorStub.fromHandle(core.MojoHandle handle, [this._impl])
- : super.fromHandle(handle);
+ CalculatorStub.fromHandle(
+ core.MojoHandle handle, [Calculator impl])
+ : super.fromHandle(handle, autoBegin: impl != null) {
+ _impl = impl;
+ }
CalculatorStub.unbound() : super.unbound();
@@ -682,7 +687,9 @@ class CalculatorStub 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 _calculatorMethodClearName:
var response = _impl.clear(_calculatorClearResponseParamsFactory);
@@ -757,10 +764,23 @@ class CalculatorStub extends bindings.Stub {
Calculator get impl => _impl;
set impl(Calculator 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 "CalculatorStub($superString)";
@@ -790,7 +810,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/+xXTWvyQBA2+r4Q9f3w/WhNb0IvXup6lJ4sRSiUgodehILEZFtT8mHzUeg/6c/z2GOPvbWbZlbXaRYjKNqSgWGa7Q6Z5+GZJ6gVkqhBbUPF57yqqOJ7HeFZEe414O7loN8bnvcGx44ejlunum1Eth56vgb3476S0NcU+sV4Qc9d9NxG568QZ4X0+MuywnI+UXJeZ/mbJRr3A24V+q9ijCzJ2HMo8SPTcyyX+sTxbj0S+EbyxyQa2ZZBLDek/rVu0ICMLNe03JuAhDQIAxK/bmjMXteKu5w0vjkv/4G3AvBYFP5fEvr635L6WE7nd8r5VbLxi6MpOf/J8nvMr011PwVHGWbeNH8NpNspqstwch3J8O8B1necRz69i9g8KXh5bBqvKtlHDc2hIh1gfp6V9fCzz/KXwE8w8dyAbo8fzEs3xcf4TmWJde3JvW5HVLIn9S3wIupFEeaR+YdaWuRtGS8KpIyXKvjYiWmmfncqW/aPde3HP8DKcAruke9H1v2owPd6V/Zj03qJv/s/ZnrhbprrZRW9HH4iPy1m5KUIKeOlBrNcRHZoTewHzEv1i/ipBpg4Tm6q+X5k248qeMyu+ukT+r2SVS8dCR8HLP8s6mVuqrmvrqSb5g7p5i0AAP//5ns7IOgQAAA=";
+ var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xXTY/TMBBtU5CyLR/lc8OtEpdeWO9xxWkRWgkJIXHgsqfKm5pskBOHOEGCX8uxR/4BOGTcOtOYflDasMpIo2kcW5n3+ual9TplDKGeQsXrurqo4n1nxnXX2DeCvR8u319M3l5cvoxodn3ymnI/5zQTqQf7i3M949zYOF+JbvXyHN0+Res/Id506uOhyr7KRUfl+rHK+ypRu0u4XTgfqJyoJLlMCRc+5SQQIuCMXIuIkW8pJZH4JIhM/fJDkl/x0CdhnLH0I/WZJFdhPA3jQJKMyUyS4skTf/7kk+JUtPR8zc9j4E9T5Bj3e8b3ldwq6/ejep5nGpezHs84xpb1uypvFzxzRtMa/RxBz/vicYR0PEN1FV6tKxsPTwDzb7wvUvY5V83U4NaxL9yuZU491I+LdIF50gL7W56eqrxn8CQTEUt2eJ4wP+c1PldjR9bY1fx8oTxnlvk5PiA/HrLoYefP/jLqVflbxU8X0sbPAHzu1XRa+37qN8RfdjU3jwCzwmu4Szs3m85NH97zTZubf62f4vfCnbl+tOu2+tlGP8//Q9911uTHgbTxM4Re3uU8CxP+FfMzuGG+6wE2jVebbzs3m83NADyo6b77A/0fWlc/ZxZenql8UNXPwnxb/91KR+MG6uhXAAAA//+Vb42mYBEAAA==";
// Deserialize RuntimeTypeInfo
var bytes = BASE64.decode(serializedRuntimeTypeInfo);

Powered by Google App Engine
This is Rietveld 408576698