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

Unified Diff: mojo/public/dart/src/client.dart

Issue 814543006: Move //mojo/{public, edk} underneath //third_party (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 5 years, 11 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 | « mojo/public/dart/src/buffer.dart ('k') | mojo/public/dart/src/codec.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/src/client.dart
diff --git a/mojo/public/dart/src/client.dart b/mojo/public/dart/src/client.dart
deleted file mode 100644
index f8ec73c00fcac32b75f151f63030b1c352669bbd..0000000000000000000000000000000000000000
--- a/mojo/public/dart/src/client.dart
+++ /dev/null
@@ -1,82 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-part of bindings;
-
-abstract class Client extends core.MojoEventStreamListener {
- Map<int, Completer> _completerMap;
- int _nextId = 0;
-
- Client(core.MojoMessagePipeEndpoint endpoint) :
- _completerMap = {},
- super(endpoint);
-
- Client.fromHandle(core.MojoHandle handle) :
- _completerMap = {},
- super.fromHandle(handle);
-
- Client.unbound() :
- _completerMap = {},
- super.unbound();
-
- void handleResponse(ServiceMessage reader);
-
- void handleRead() {
- // Query how many bytes are available.
- var result = endpoint.query();
- assert(result.status.isOk || result.status.isResourceExhausted);
-
- // Read the data.
- var bytes = new ByteData(result.bytesRead);
- var handles = new List<core.MojoHandle>(result.handlesRead);
- result = endpoint.read(bytes, result.bytesRead, handles);
- assert(result.status.isOk || result.status.isResourceExhausted);
- var message = new ServiceMessage.fromMessage(new Message(bytes, handles));
- handleResponse(message);
- }
-
- void handleWrite() {
- throw 'Unexpected write signal in client.';
- }
-
- void sendMessage(Struct message, int name) {
- if (!isOpen) {
- listen();
- }
- var header = new MessageHeader(name);
- var serviceMessage = message.serializeWithHeader(header);
- endpoint.write(serviceMessage.buffer,
- serviceMessage.buffer.lengthInBytes,
- serviceMessage.handles);
- if (!endpoint.status.isOk) {
- throw "message pipe write failed";
- }
- }
-
- Future sendMessageWithRequestId(
- Struct message, int name, int id, int flags) {
- if (!isOpen) {
- listen();
- }
- if (id == -1) {
- id = _nextId++;
- }
-
- var header = new MessageHeader.withRequestId(name, flags, id);
- var serviceMessage = message.serializeWithHeader(header);
- endpoint.write(serviceMessage.buffer,
- serviceMessage.buffer.lengthInBytes,
- serviceMessage.handles);
- if (!endpoint.status.isOk) {
- throw "message pipe write failed";
- }
-
- var completer = new Completer();
- _completerMap[id] = completer;
- return completer.future;
- }
-
- // Need a getter for this for access in subclasses.
- Map<int, Completer> get completerMap => _completerMap;
-}
« no previous file with comments | « mojo/public/dart/src/buffer.dart ('k') | mojo/public/dart/src/codec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698