[cleanup] remove public/lib/story/dart
Change-Id: I6d186ed6283f1681d57b73aeeb5f6bc6a9dcf2d8
diff --git a/bin/flutter_screencap_test/BUILD.gn b/bin/flutter_screencap_test/BUILD.gn
index 838bcaa..222cca9 100644
--- a/bin/flutter_screencap_test/BUILD.gn
+++ b/bin/flutter_screencap_test/BUILD.gn
@@ -19,7 +19,7 @@
deps = [
"//third_party/dart-pkg/git/flutter/packages/flutter",
- "//topaz/public/lib/app/dart",
+ "//topaz/public/dart/fuchsia_logger",
]
}
diff --git a/bin/flutter_screencap_test/lib/main.dart b/bin/flutter_screencap_test/lib/main.dart
index f14541f..998b0b5 100644
--- a/bin/flutter_screencap_test/lib/main.dart
+++ b/bin/flutter_screencap_test/lib/main.dart
@@ -3,7 +3,7 @@
// found in the LICENSE file.
import 'package:flutter/material.dart';
-import 'package:lib.app.dart/logging.dart';
+import 'package:fuchsia_logger/logger.dart';
const Color _lightColor = Color(0xFF4dac26);
const Color _darkColor = Color(0xFFd01c8b);
@@ -41,7 +41,6 @@
void main() {
setupLogger(
name: 'flutter_screencap_test_app',
- logToStdoutForTest: true,
);
log.info('starting flutter_screencap_test_app');
runApp(MaterialApp(
diff --git a/bin/ui/benchmarks/image_grid_flutter/lib/image_grid_model.dart b/bin/ui/benchmarks/image_grid_flutter/lib/image_grid_model.dart
index ef77978..909fa80 100644
--- a/bin/ui/benchmarks/image_grid_flutter/lib/image_grid_model.dart
+++ b/bin/ui/benchmarks/image_grid_flutter/lib/image_grid_model.dart
@@ -66,8 +66,8 @@
var image = await recorder.endRecording().toImage(500, 500);
- images.add(
- RawImage(image: image, width: 500.0, height: 500.0, scale: 1.0));
+ images
+ .add(RawImage(image: image, width: 500.0, height: 500.0, scale: 1.0));
}
return images;
}
@@ -82,8 +82,7 @@
}
class _TracedSpringModel extends SpringModel {
- final FrameRateTracer _frameRateTracer =
- FrameRateTracer(name: 'auto scroll');
+ final FrameRateTracer _frameRateTracer = FrameRateTracer(name: 'auto scroll');
_TracedSpringModel({RK4SpringDescription springDescription})
: super(springDescription: springDescription);
diff --git a/examples/test/driver_example_mod/BUILD.gn b/examples/test/driver_example_mod/BUILD.gn
index d26b621..c850a0d 100644
--- a/examples/test/driver_example_mod/BUILD.gn
+++ b/examples/test/driver_example_mod/BUILD.gn
@@ -32,7 +32,6 @@
"//third_party/dart-pkg/git/flutter/packages/flutter",
"//topaz/public/dart/fuchsia_modular",
"//topaz/public/dart/fuchsia_services",
- "//topaz/public/lib/app/dart",
"//topaz/public/lib/widgets/dart",
]
}
diff --git a/lib/keyboard/flutter/test/BUILD.gn b/lib/keyboard/flutter/test/BUILD.gn
index 4799ab8..c4b475e 100644
--- a/lib/keyboard/flutter/test/BUILD.gn
+++ b/lib/keyboard/flutter/test/BUILD.gn
@@ -19,7 +19,6 @@
"//topaz/lib/shell",
"//topaz/public/dart/fidl",
"//topaz/public/dart/widgets:lib.widgets",
- "//topaz/public/lib/app/dart",
]
}
diff --git a/lib/shell/BUILD.gn b/lib/shell/BUILD.gn
index 5615293..8166b0b 100644
--- a/lib/shell/BUILD.gn
+++ b/lib/shell/BUILD.gn
@@ -17,6 +17,5 @@
"//topaz/public/dart/fidl",
"//topaz/public/dart/fuchsia_logger",
"//topaz/public/dart/widgets:lib.widgets",
- "//topaz/public/lib/app/dart",
]
}
diff --git a/public/lib/story/dart/BUILD.gn b/public/lib/story/dart/BUILD.gn
deleted file mode 100644
index 92bfab5..0000000
--- a/public/lib/story/dart/BUILD.gn
+++ /dev/null
@@ -1,23 +0,0 @@
-# Copyright 2017 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("//build/dart/dart_library.gni")
-
-dart_library("dart") {
- package_name = "lib.story.dart"
-
- sdk_category = "partner"
-
- sources = [
- "src/link_client.dart",
- "src/link_watcher_host.dart",
- "src/link_watcher_impl.dart",
- "story.dart",
- ]
-
- deps = [
- "//sdk/fidl/fuchsia.modular",
- "//topaz/public/lib/app/dart",
- ]
-}
diff --git a/public/lib/story/dart/analysis_options.yaml b/public/lib/story/dart/analysis_options.yaml
deleted file mode 100644
index 54917c0..0000000
--- a/public/lib/story/dart/analysis_options.yaml
+++ /dev/null
@@ -1,5 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-include: ../../../analysis_options.yaml
diff --git a/public/lib/story/dart/lib/src/link_client.dart b/public/lib/story/dart/lib/src/link_client.dart
deleted file mode 100644
index 8c06c63..0000000
--- a/public/lib/story/dart/lib/src/link_client.dart
+++ /dev/null
@@ -1,294 +0,0 @@
-// Copyright 2018 The Fuchsia 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:convert';
-import 'dart:typed_data';
-
-import 'package:fidl/fidl.dart';
-import 'package:fidl_fuchsia_mem/fidl.dart' as fuchsia_mem;
-import 'package:fidl_fuchsia_modular/fidl.dart' as fidl;
-import 'package:lib.app.dart/logging.dart';
-import 'package:zircon/zircon.dart';
-
-import 'link_watcher_host.dart';
-
-export 'package:fidl_fuchsia_modular/fidl.dart';
-
-export 'link_watcher_host.dart';
-
-/// When a value for a given [ref] is not found.
-class LinkClientNotFoundException extends Error {
- /// The id/ref that was not found.
- final String ref;
-
- /// Constructor.
- LinkClientNotFoundException(this.ref);
-
- @override
- String toString() {
- return 'LinkClientNotFoundException: no value found for "$ref"';
- }
-}
-
-/// Client wrapper for [fidl.Link].
-///
-/// TODO(SO-1126): implement all methods for LinkClient
-class LinkClient {
- /// The underlying [Proxy] used to send client requests to the [fidl.Link]
- /// service.
- final fidl.LinkProxy proxy = fidl.LinkProxy();
-
- /// The name of the link.
- final String name;
-
- /// Constructor.
- LinkClient({
- this.name,
- }) {
- if (name == null) {
- /// TODO: add a better warning.
- log.warning('default links will be deprecated soon');
- }
-
- proxy.ctrl
- ..onBind = _handleBind
- ..onClose = _handleClose
- ..onConnectionError = _handleConnectionError
- ..onUnbind = _handleUnbind;
- }
-
- final Completer<Null> _bind = Completer<Null>();
-
- /// A future that completes when the [proxy] is bound.
- Future<Null> get bound => _bind.future;
-
- void _handleBind() {
- log.fine('proxy ready');
- _bind.complete(null);
- }
-
- /// Get the decoded JSON value from [fidl.Link#get].
- Future<Object> get({
- List<String> path,
- }) async {
- log.fine('#get($path)');
-
- Completer<Object> completer = Completer<Object>();
-
- try {
- await bound;
- } on Exception catch (err, stackTrace) {
- completer.completeError(err, stackTrace);
- return completer.future;
- }
-
- // ignore: unawaited_futures
- proxy.ctrl.error.then((ProxyError err) {
- if (!completer.isCompleted) {
- completer.completeError(err);
- }
- });
-
- try {
- proxy.get(path, completer.complete);
- } on Exception catch (err) {
- completer.completeError(err);
- }
-
- return completer.future;
- }
-
- /// Future based API for [fidl.Link#set].
- Future<Null> set({
- List<String> path,
- Object jsonData,
- }) async {
- log.fine('#set($path, $json)');
-
- Completer<Null> completer = Completer<Null>();
-
- try {
- await bound;
- } on Exception catch (err, stackTrace) {
- completer.completeError(err, stackTrace);
- return completer.future;
- }
-
- String jsonString = json.encode(jsonData);
- var jsonList = Uint8List.fromList(utf8.encode(jsonString));
- var data = fuchsia_mem.Buffer(
- vmo: SizedVmo.fromUint8List(jsonList),
- size: jsonList.length,
- );
-
- // ignore: unawaited_futures
- proxy.ctrl.error.then((ProxyError err) {
- if (!completer.isCompleted) {
- completer.completeError(err);
- }
- });
-
- try {
- proxy.set(path, data);
- } on Exception catch (err) {
- completer.completeError(err);
- }
-
- // Since there is no async success path for proxy.set (it is fire and
- // forget) the best way to check for success is pushing a job onto the end
- // of the async call stack and checking that the completer didn't enounter
- // and error, no errors at this stage == success.
- scheduleMicrotask(() {
- if (!completer.isCompleted) {
- completer.complete(null);
- }
- });
-
- return completer.future;
- }
-
- final List<LinkWatcherHost> _watchers = <LinkWatcherHost>[];
- final List<StreamController<String>> _streams = <StreamController<String>>[];
- bool _receivedInitialValue = false;
-
- /// Stream based API for [fidl.Link#watch] and [fidl.Link#watchAll].
- Stream<String> watch({bool all = false}) {
- log.fine('#watch(all: $all)');
-
- // TODO(SO-1127): connect the stream's control plane to the underlying link watcher
- // so that it properly responds to clients requesting listen, pause, resume,
- // cancel.
- StreamController<String> controller = StreamController<String>();
- _streams.add(controller);
-
- bound.then((_) {
- log.fine('link proxy bound, adding watcher');
-
- LinkWatcherHost watcher = LinkWatcherHost(onNotify: (String data) {
- // TODO: remove when MI4-940 is done
- bool isInitialNullData =
- (data == null || data == 'null') && !_receivedInitialValue;
- if (!isInitialNullData) {
- _receivedInitialValue = true;
- controller.add(data);
- }
- });
- _watchers.add(watcher);
-
- // Using Future#catchError allows any sync errors thrown within the onValue
- // block below to be caught without needing to add try-catch logic.
- watcher.wrap().then((InterfaceHandle<LinkWatcher> handle) {
- if (all) {
- proxy.watchAll(handle);
- } else {
- proxy.watch(handle);
- }
- }, onError: controller.addError).catchError(controller.addError);
- });
-
- return controller.stream;
- }
-
- /// See [fidl.Link#setEntity].
- Future<Null> setEntity(String ref) async {
- assert(ref != null);
- assert(ref.isNotEmpty);
-
- Completer<Null> completer = Completer<Null>();
-
- try {
- await bound;
- } on Exception catch (err, stackTrace) {
- completer.completeError(err, stackTrace);
- return completer.future;
- }
-
- // ignore: unawaited_futures
- proxy.ctrl.error.then((ProxyError err) {
- if (!completer.isCompleted) {
- completer.completeError(err);
- }
- });
-
- try {
- proxy.setEntity(ref);
- } on Exception catch (err) {
- completer.completeError(err);
- }
-
- // Since there is no async success path for proxy.set (it is fire and
- // forget) the best way to check for success is pushing a job onto the end
- // of the async call stack and checking that the completer didn't enounter
- // and error, no errors at this stage == success.
- scheduleMicrotask(() {
- if (!completer.isCompleted) {
- completer.complete(null);
- }
- });
-
- return completer.future;
- }
-
- /// See [fidl.Link#getEntity].
- Future<String> getEntity() async {
- Completer<String> completer = Completer<String>();
-
- try {
- await bound;
- } on Exception catch (err, stackTrace) {
- completer.completeError(err, stackTrace);
- return completer.future;
- }
-
- // ignore: unawaited_futures
- proxy.ctrl.error.then((ProxyError err) {
- if (!completer.isCompleted) {
- completer.completeError(err);
- }
- });
-
- void handleEntity(String ref) {
- completer.complete(ref);
- }
-
- try {
- proxy.getEntity(handleEntity);
- } on Exception catch (err) {
- completer.completeError(err);
- }
-
- return completer.future;
- }
-
- /// Closes the underlying proxy connection, should be called as a response to
- /// Lifecycle::terminate (see https://goo.gl/MmZ2dc).
- Future<Null> terminate() async {
- log.info('terminate called');
- proxy.ctrl.close();
- return;
- }
-
- void _handleUnbind() {
- log.fine('proxy unbound');
- }
-
- void _handleClose() {
- log.fine('proxy closed');
- for (LinkWatcherHost watcher in _watchers) {
- watcher.terminate();
- }
- _watchers.clear();
-
- for (StreamController<String> stream in _streams) {
- stream.close();
- }
-
- log.info('link watchers closed');
- }
-
- void _handleConnectionError() {
- log.severe('LinkClient connection error');
- }
-}
diff --git a/public/lib/story/dart/lib/src/link_watcher_host.dart b/public/lib/story/dart/lib/src/link_watcher_host.dart
deleted file mode 100644
index 454ac05..0000000
--- a/public/lib/story/dart/lib/src/link_watcher_host.dart
+++ /dev/null
@@ -1,120 +0,0 @@
-// Copyright 2018 The Fuchsia 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 'package:fidl/fidl.dart';
-import 'package:fidl_fuchsia_modular/fidl.dart' as fidl;
-import 'package:lib.app.dart/logging.dart';
-import 'package:meta/meta.dart';
-
-import 'link_watcher_impl.dart';
-
-export 'package:fidl_fuchsia_modular/fidl.dart';
-
-/// Hosts a [LinkWatcherImpl] and manages the underlying [binding].
-class LinkWatcherHost {
- /// The [Binding] that connects the [impl] to client requests.
- final fidl.LinkWatcherBinding binding = fidl.LinkWatcherBinding();
-
- /// Callback for when the Link content value updates.
- final LinkWatcherNotifyCallback onNotify;
-
- /// The impl that handles client requests by delegating to the [onNotify]
- /// callback.
- LinkWatcherImpl impl;
-
- /// Constructor.
- LinkWatcherHost({
- @required this.onNotify,
- }) : assert(onNotify != null) {
- impl = LinkWatcherImpl(
- onNotify: onNotify,
- );
-
- binding
- ..onBind = _handleBind
- ..onClose = _handleClose
- ..onConnectionError = _handleConnectionError
- ..onUnbind = _handleUnbind;
- }
-
- Completer<InterfaceHandle<fidl.LinkWatcher>> _wrap;
-
- /// Async version of binding.wrap()
- Future<InterfaceHandle<fidl.LinkWatcher>> wrap() {
- if (_wrap != null) {
- Exception err = Exception(
- 'failing due to rebind attempt on an active connection');
- _wrap.completeError(err);
- return _wrap.future;
- } else {
- _wrap = Completer<InterfaceHandle<fidl.LinkWatcher>>();
- }
-
- InterfaceHandle<fidl.LinkWatcher> handle;
- try {
- handle = binding.wrap(impl);
- } on Exception catch (err, stackTrace) {
- _wrap.completeError(err, stackTrace);
- return _wrap.future;
- }
-
- // TODO: binding.wrap should use exceptions instead of a null value for
- // failure modes.
- if (handle == null) {
- Exception err = Exception('failed to wrap LinkWatcherImpl');
- _wrap.completeError(err);
- }
-
- // Give the async errors a chance to bubble before resolving with a success.
- scheduleMicrotask(() {
- if (!_wrap.isCompleted) {
- _wrap.complete(handle);
- }
- });
-
- return _wrap.future;
- }
-
- void _handleConnectionError() {
- Exception err = Exception('binding connection failed');
-
- if (_wrap != null && !_wrap.isCompleted) {
- _wrap.completeError(err);
- return;
- }
-
- log.severe('binding connection failed outside of async control flow.');
- }
-
- void _handleBind() {
- log.fine('binding ready');
- }
-
- void _handleUnbind() {
- log.fine('binding unbound');
- _reset();
- }
-
- void _handleClose() {
- log.fine('binding closed');
- _reset();
- }
-
- void _reset() {
- // _wrap is reset so it can be called again without returning the previous,
- // unbound interface handle.
- _wrap = null;
- }
-
- /// Closes the underlying binding, usually called as a direct effect of
- /// Lifecycle::terminate (see https://goo.gl/MmZ2dc) being triggered by the
- /// framework.
- Future<Null> terminate() async {
- log.fine('terminate called, closing $binding');
- binding.close();
- return null;
- }
-}
diff --git a/public/lib/story/dart/lib/src/link_watcher_impl.dart b/public/lib/story/dart/lib/src/link_watcher_impl.dart
deleted file mode 100644
index 1c439e6..0000000
--- a/public/lib/story/dart/lib/src/link_watcher_impl.dart
+++ /dev/null
@@ -1,32 +0,0 @@
-// Copyright 2018 The Fuchsia 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:convert';
-
-import 'package:fidl_fuchsia_mem/fidl.dart' as fuchsia_mem;
-import 'package:fidl_fuchsia_modular/fidl.dart';
-import 'package:meta/meta.dart';
-import 'package:zircon/zircon.dart';
-
-/// Handler for when [LinkWatcher#notify] is called by the framework.
-typedef LinkWatcherNotifyCallback = void Function(String data);
-
-/// Implements [LinkWatcher] for receiving update notifications from a [Link].
-class LinkWatcherImpl extends LinkWatcher {
- /// Called when [LinkWatcher.notify] is called.
- final LinkWatcherNotifyCallback onNotify;
-
- /// Creates a new instance of [LinkWatcherImpl].
- LinkWatcherImpl({
- @required this.onNotify,
- }) : assert(onNotify != null);
-
- @override
- void notify(fuchsia_mem.Buffer buffer) {
- var dataVmo = SizedVmo(buffer.vmo.handle, buffer.size);
- var data = dataVmo.read(buffer.size);
- dataVmo.close();
- onNotify(utf8.decode(data.bytesAsUint8List()));
- }
-}
diff --git a/public/lib/story/dart/lib/story.dart b/public/lib/story/dart/lib/story.dart
deleted file mode 100644
index 7dfc600..0000000
--- a/public/lib/story/dart/lib/story.dart
+++ /dev/null
@@ -1,7 +0,0 @@
-// Copyright 2017 The Fuchsia Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-export 'src/link_client.dart';
-export 'src/link_watcher_host.dart';
-export 'src/link_watcher_impl.dart';
diff --git a/public/lib/story/dart/pubspec.yaml b/public/lib/story/dart/pubspec.yaml
deleted file mode 100644
index 3a809f4..0000000
--- a/public/lib/story/dart/pubspec.yaml
+++ /dev/null
@@ -1,3 +0,0 @@
-# Copyright 2017 The Fuchsia Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.