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

Unified Diff: examples/dart/mojo_rtt_benchmark/lib/echo_server.dart

Issue 1378163004: Dart: Performance improvements to Dart's handle watcher. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Format Created 5 years, 2 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
« no previous file with comments | « no previous file | mojo/dart/embedder/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/dart/mojo_rtt_benchmark/lib/echo_server.dart
diff --git a/examples/dart/mojo_rtt_benchmark/lib/echo_server.dart b/examples/dart/mojo_rtt_benchmark/lib/echo_server.dart
index ec2e507a4db04e61a2e0a2a0aecaa2901a013792..3e2568df00d7306a6db62d2d882d15b71ef2d66d 100644
--- a/examples/dart/mojo_rtt_benchmark/lib/echo_server.dart
+++ b/examples/dart/mojo_rtt_benchmark/lib/echo_server.dart
@@ -28,9 +28,11 @@ class EchoImpl implements Echo {
class EchoApplication extends Application {
List<EchoImpl> _echoServices;
+ bool _closing;
EchoApplication.fromHandle(MojoHandle handle)
- : _echoServices = [],
+ : _closing = false,
+ _echoServices = [],
super.fromHandle(handle) {
onError = _errorHandler;
}
@@ -42,16 +44,23 @@ class EchoApplication extends Application {
}
void removeService(EchoImpl service) {
- _echoServices.remove(service);
+ if (!_closing) {
+ _echoServices.remove(service);
+ }
}
EchoImpl _createService(MojoMessagePipeEndpoint endpoint) {
+ if (_closing) {
+ endpoint.close();
+ return null;
+ }
var echoService = new EchoImpl(this, endpoint);
_echoServices.add(echoService);
return echoService;
}
_errorHandler() async {
+ _closing = true;
for (var service in _echoServices) {
await service.close();
}
« no previous file with comments | « no previous file | mojo/dart/embedder/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698