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

Unified Diff: mojo/public/dart/mojo/lib/src/fill_data.dart

Issue 1441033002: Move mojo and mojom from mojo/public/dart to mojo/dart/packages (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month 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/mojo/lib/src/event_stream.dart ('k') | mojo/public/dart/mojo/lib/src/handle.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/dart/mojo/lib/src/fill_data.dart
diff --git a/mojo/public/dart/mojo/lib/src/fill_data.dart b/mojo/public/dart/mojo/lib/src/fill_data.dart
deleted file mode 100644
index c139a7c3c4c2182d70c4fcf6159c8108a7483f4e..0000000000000000000000000000000000000000
--- a/mojo/public/dart/mojo/lib/src/fill_data.dart
+++ /dev/null
@@ -1,52 +0,0 @@
-// Copyright 2015 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 core;
-
-class DataPipeFiller {
- final MojoDataPipeProducer _producer;
- final ByteData _data;
- MojoEventSubscription _eventSubscription;
- int _dataPosition;
-
- DataPipeFiller(this._producer, this._data) {
- _eventSubscription = new MojoEventSubscription(_producer.handle);
- _dataPosition = 0;
- }
-
- MojoResult _doWrite() {
- ByteData view = new ByteData.view(
- _data.buffer, _dataPosition, _data.lengthInBytes - _dataPosition);
- int written = _producer.write(view);
- if (!_producer.status.isOk) {
- throw 'Data pipe beginWrite failed: ${_producer.status}';
- }
- _dataPosition += written;
- return _producer.status;
- }
-
- void fill() {
- _eventSubscription.enableWriteEvents();
- _eventSubscription.subscribe((List<int> event) {
- var mojoSignals = new MojoHandleSignals(event[1]);
- if (mojoSignals.isWritable) {
- MojoResult result = _doWrite();
- if (_dataPosition >= _data.lengthInBytes || !result.isOk) {
- _eventSubscription.close();
- _eventSubscription = null;
- }
- } else if (mojoSignals.isPeerClosed) {
- _eventSubscription.close();
- _eventSubscription = null;
- } else {
- throw 'Unexpected handle event: $mojoSignals';
- }
- });
- }
-
- static void fillHandle(MojoDataPipeProducer producer, ByteData data) {
- var filler = new DataPipeFiller(producer, data);
- filler.fill();
- }
-}
« no previous file with comments | « mojo/public/dart/mojo/lib/src/event_stream.dart ('k') | mojo/public/dart/mojo/lib/src/handle.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698