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

Unified Diff: examples/dart/traced_application/lib/main.dart

Issue 1471393003: Dart: Remove unused library and example (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 5 years 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 | « examples/dart/traced_application/BUILD.gn ('k') | examples/dart/traced_application/pubspec.lock » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/dart/traced_application/lib/main.dart
diff --git a/examples/dart/traced_application/lib/main.dart b/examples/dart/traced_application/lib/main.dart
deleted file mode 100644
index 6ef40987865ef920ccae0c5aa873e1ecfac0d849..0000000000000000000000000000000000000000
--- a/examples/dart/traced_application/lib/main.dart
+++ /dev/null
@@ -1,105 +0,0 @@
-#!mojo mojo:dart_content_handler
-// 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.
-
-// This example application illustrates how to use Mojo Tracing from Dart code.
-//
-// To run this app:
-// mojo/devtools/common/mojo_run --trace-startup \
-// https://core.mojoapps.io/examples/dart/traced_application/lib/main.dart
-//
-// This will produce a file called |mojo_shell.trace| that may be loaded
-// by Chrome's about:tracing.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:common/tracing_helper.dart';
-import 'package:mojo/application.dart';
-import 'package:mojo/bindings.dart';
-import 'package:mojo/core.dart';
-
-class TestUsingTracingApp extends Application {
- TracingHelper _tracing;
- Timer _timer;
-
- TestUsingTracingApp.fromHandle(MojoHandle handle) : super.fromHandle(handle);
-
- void initialize(List<String> args, String url) {
- // This sets up a connection between this application and the Mojo
- // tracing service.
- _tracing = new TracingHelper.fromApplication(
- this, "example_traced_application", TraceSendTiming.AT_END);
- _tracing.traceInstant("initialized", "traced_application");
-
- // Now we schedule some random work just so we have something to trace.
- _timer = new Timer.periodic(new Duration(seconds: 1), (t) => function1());
-
- onError = (() {
- if (_timer != null) {
- _timer.cancel();
- }
- });
- }
-
- @override
- void acceptConnection(String requestorUrl, String resolvedUrl,
- ApplicationConnection connection) {
- _tracing.traceInstant("connected", "traced_application");
- }
-
- Future function1() {
- return _tracing.traceAsync("function1", "traced_application", () async {
- await waitForMilliseconds(100);
- await function2(42);
- await waitForMilliseconds(100);
- });
- }
-
- Future function2(int x) {
- return _tracing.traceAsync("function2", "traced_application", () async {
- await waitForMilliseconds(200);
- assert(await identity(42) == 42);
- assert(await fourtyTwo() == 42);
- assert(await addOne(42) == 43);
- await doNothing();
- }, args: {"x": x});
- }
-
- Future identity(int x) {
- return _tracing.traceAsync("identity", "traced_application", () async {
- await waitForMilliseconds(10);
- return x;
- });
- }
-
- Future addOne(int x) {
- return _tracing.traceAsync("add1", "traced_application", () async {
- await waitForMilliseconds(10);
- return x + 1;
- }, args: {"x": x});
- }
-
- Future fourtyTwo() {
- return _tracing.traceAsync("fourtyTwo", "traced_application", () async {
- await waitForMilliseconds(10);
- return 42;
- });
- }
-
- Future doNothing() {
- return _tracing.traceAsync("doNothing", "traced_application", () async {
- await waitForMilliseconds(10);
- });
- }
-}
-
-Future waitForMilliseconds(int milliseconds) {
- return new Future.delayed(new Duration(milliseconds: milliseconds), () {});
-}
-
-main(List args) {
- MojoHandle appHandle = new MojoHandle(args[0]);
- new TestUsingTracingApp.fromHandle(appHandle);
-}
« no previous file with comments | « examples/dart/traced_application/BUILD.gn ('k') | examples/dart/traced_application/pubspec.lock » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698