diff options
author | blundell <blundell@chromium.org> | 2015-01-19 09:18:33 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-19 17:19:27 +0000 |
commit | 70fb54767b472a5edfb859e489beeeec7abdb0e4 (patch) | |
tree | 28e534ec774391a9f6571a1770e12a0d63ebf833 /mojo/public/dart/src/interface.dart | |
parent | ba5f0233fa38f949e24f6274ba891fa652eab640 (diff) | |
download | chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.zip chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.tar.gz chromium_src-70fb54767b472a5edfb859e489beeeec7abdb0e4.tar.bz2 |
Move //mojo/{public, edk} underneath //third_party
This CL move //mojo/public and //mojo/edk to live in the following locations:
- //third_party/mojo/src/mojo/public
- //third_party/mojo/src/mojo/edk
It moves the related gypfiles from //mojo to //third_party/mojo and updates
them as necessary to account for the file moves. It also updates clients of the
mojo SDK and EDK targets in both GYP and GN. (Note that for GN, the mojo SDK
and EDK build systems are maintained in the Mojo repo and designed to be
flexible wrt the location of the SDK/EDK in a client repo, so no changes are
needed.
This CL does not update include paths to the code being moved to limit the
number of moving parts, instead relying on the include_dirs that the SDK and
EDK targets supply to their direct dependents to ensure that include paths
continue to resolve correctly.
NOPRESUBMIT=true
Review URL: https://codereview.chromium.org/814543006
Cr-Commit-Position: refs/heads/master@{#312129}
Diffstat (limited to 'mojo/public/dart/src/interface.dart')
-rw-r--r-- | mojo/public/dart/src/interface.dart | 103 |
1 files changed, 0 insertions, 103 deletions
diff --git a/mojo/public/dart/src/interface.dart b/mojo/public/dart/src/interface.dart deleted file mode 100644 index 0e73214..0000000 --- a/mojo/public/dart/src/interface.dart +++ /dev/null @@ -1,103 +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 Interface extends core.MojoEventStreamListener { - int _outstandingResponseFutures = 0; - bool _isClosing = false; - - Interface(core.MojoMessagePipeEndpoint endpoint) : super(endpoint); - - Interface.fromHandle(core.MojoHandle handle) : super.fromHandle(handle); - - Interface.unbound() : super.unbound(); - - Future<Message> handleMessage(ServiceMessage message); - - void handleRead() { - // Query how many bytes are available. - var result = endpoint.query(); - assert(result.status.isOk || result.status.isResourceExhausted); - - // Read the data and view as a message. - 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); - - // Prepare the response. - var message = new ServiceMessage.fromMessage(new Message(bytes, handles)); - var responseFuture = _isClosing ? null : handleMessage(message); - - // If there's a response, send it. - if (responseFuture != null) { - _outstandingResponseFutures++; - responseFuture.then((response) { - _outstandingResponseFutures--; - if (isOpen) { - endpoint.write(response.buffer, - response.buffer.lengthInBytes, - response.handles); - if (!endpoint.status.isOk) { - throw "message pipe write failed: ${endpoint.status}"; - } - if (_isClosing && (_outstandingResponseFutures == 0)) { - // This was the final response future for which we needed to send - // a response. It is safe to close. - super.close(); - _isClosing = false; - } - } - }); - } else if (_isClosing && (_outstandingResponseFutures == 0)) { - // We are closing, there is no response to send for this message, and - // there are no outstanding response futures. Do the close now. - super.close(); - _isClosing = false; - } - } - - void handleWrite() { - throw 'Unexpected write signal in client.'; - } - - void close() { - if (!isOpen) return; - if (isInHandler || (_outstandingResponseFutures > 0)) { - // Either close() is being called from within handleRead() or - // handleWrite(), or close() is being called while there are outstanding - // response futures. Defer the actual close until all response futures - // have been resolved. - _isClosing = true; - } else { - super.close(); - } - } - - Message buildResponse(Struct response, int name) { - var header = new MessageHeader(name); - return response.serializeWithHeader(header); - } - - Message buildResponseWithId(Struct response, int name, int id, int flags) { - var header = new MessageHeader.withRequestId(name, flags, id); - return response.serializeWithHeader(header); - } - - void sendMessage(Struct message, int name) { - 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: ${endpoint.status}"; - } - } - - Future sendMessageWithRequestId(Struct response, int name, int id) { - throw "The client interface should not expect a response"; - } -} |