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

Unified Diff: sky/examples/terminal/terminal_file_impl.dart

Issue 1038813005: Move terminal example from //sky/examples to //examples (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 9 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 | « sky/examples/terminal/terminal_display.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/examples/terminal/terminal_file_impl.dart
diff --git a/sky/examples/terminal/terminal_file_impl.dart b/sky/examples/terminal/terminal_file_impl.dart
deleted file mode 100644
index 041765a8c41cf6fd1ecd245bf6f19a77aeec2f2d..0000000000000000000000000000000000000000
--- a/sky/examples/terminal/terminal_file_impl.dart
+++ /dev/null
@@ -1,124 +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.
-
-import 'dart:async';
-import 'dart:core';
-import 'package:mojo/public/dart/core.dart';
-import 'package:mojo/services/files/public/interfaces/file.mojom.dart' as files;
-import 'package:mojo/services/files/public/interfaces/types.mojom.dart' as files;
-
-import 'terminal_display.dart';
-
-// This implements a |mojo.files.File| that acts like a (pseudo)terminal. Bytes
-// written to the |File| will be read by this implementation and passed on to
-// the (Dart) |TerminalDisplay| (using |putChar()|). A read from the |File| will
-// be completed if/when |TerminalDisplay| makes a byte available (via
-// |getChar()|).
-// TODO(vtl): This implementation is very incomplete.
-class TerminalFileImpl implements files.File {
- final files.FileStub stub;
- final TerminalDisplay _display;
-
- TerminalFileImpl(this._display) : stub = new files.FileStub.unbound() {
- stub.impl = this;
- }
-
- // |files.File| implementation:
-
- @override
- Future close(Function responseFactory) async {
- // TODO(vtl): We should probably do more than just say OK.
- return responseFactory(files.Error_OK);
- }
-
- @override
- Future read(int numBytesToRead, int offset, int whence,
- Function responseFactory) async {
- if (numBytesToRead < 0) {
- return responseFactory(files.Error_INVALID_ARGUMENT, null);
- }
-
- // TODO(vtl): Error if |offset|/|whence| not appropriate.
-
- if (numBytesToRead == 0) {
- return responseFactory(files.Error_OK, []);
- }
-
- return responseFactory(files.Error_OK, [await _display.getChar()]);
- }
-
- @override
- Future write(List<int> bytesToWrite, int offset, int whence,
- Function responseFactory) async {
- // TODO(vtl): Error if |offset|/|whence| not appropriate.
-
- for (var c in bytesToWrite) {
- _display.putChar(c);
- }
- return responseFactory(files.Error_OK, bytesToWrite.length);
- }
-
- @override
- Future readToStream(MojoDataPipeProducer source, int offset, int whence,
- int numBytesToRead, Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED);
- }
-
- @override
- Future writeFromStream(MojoDataPipeConsumer sink, int offset, int whence,
- Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED);
- }
-
- @override
- Future tell(Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED, 0);
- }
-
- @override
- Future seek(int offset, int whence, Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED, 0);
- }
-
- @override
- Future stat(Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED, null);
- }
-
- @override
- Future truncate(int size, Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED);
- }
-
- @override
- Future touch(files.TimespecOrNow atime, files.TimespecOrNow mtime,
- Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED);
- }
-
- @override
- Future dup(Object file, Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED);
- }
-
- @override
- Future reopen(Object file, int openFlags, Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED);
- }
-
- @override
- Future asBuffer(Function responseFactory) async {
- // TODO(vtl)
- return responseFactory(files.Error_UNIMPLEMENTED, null);
- }
-}
« no previous file with comments | « sky/examples/terminal/terminal_display.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698