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

Unified Diff: mojo/common/dart/lib/src/trace_provider_impl.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 | « mojo/common/dart/BUILD.gn ('k') | mojo/common/dart/lib/tracing_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/dart/lib/src/trace_provider_impl.dart
diff --git a/mojo/common/dart/lib/src/trace_provider_impl.dart b/mojo/common/dart/lib/src/trace_provider_impl.dart
deleted file mode 100644
index 43066a029d3cf2ecafcae6c1788beef45f154359..0000000000000000000000000000000000000000
--- a/mojo/common/dart/lib/src/trace_provider_impl.dart
+++ /dev/null
@@ -1,98 +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 'package:mojo/core.dart';
-import 'package:mojo_services/tracing/tracing.mojom.dart';
-
-enum TraceSendTiming {
- IMMEDIATE,
- // TODO: Add BATCHED?
- AT_END,
-}
-
-class TraceProviderImpl implements TraceProvider {
- // Any messages sent before the tracing service connects to us will be
- // recorded and kept until one second after construction of the trace
- // provider. If the tracing service connects before that time, we will replay
- // the recorded trace events.
- //
- // This allows the client to record trace events early during initialization
- // of the app.
- List<String> _message_queue;
- bool _enqueuing;
-
- TraceProviderStub _stub;
- TraceRecorderProxy _recorder;
- // TODO(rudominer) We currently ignore _categories.
- String _categories;
-
- TraceSendTiming _timing;
-
- TraceProviderImpl([TraceSendTiming timing = TraceSendTiming.IMMEDIATE]) {
- _message_queue = [];
- _enqueuing = true;
- _timing = timing;
- new Future.delayed(const Duration(seconds: 1), () {
- if (_enqueuing) {
- _enqueuing = false;
- _message_queue.clear();
- }
- });
- }
-
- void connect(MojoMessagePipeEndpoint e) {
- _stub = TraceProviderStub.newFromEndpoint(e);
- _stub.impl = this;
- }
-
- @override
- void startTracing(String categories, TraceRecorderProxy recorder) {
- assert(_recorder == null);
- _recorder = recorder;
- _categories = categories;
- _enqueuing = false;
- if (_timing == TraceSendTiming.IMMEDIATE) {
- for (String message in _message_queue) {
- _recorder.ptr.record(message);
- }
- _message_queue.clear();
- }
- }
-
- @override
- void stopTracing() {
- assert(_recorder != null);
- if (_timing == TraceSendTiming.AT_END) {
- for (String message in _message_queue) {
- _recorder.ptr.record(message);
- }
- _message_queue.clear();
- }
- _recorder.close();
- _recorder = null;
- }
-
- bool isActive() {
- return _enqueuing || _recorder != null;
- }
-
- void sendTraceMessage(String message) {
- switch (_timing) {
- case TraceSendTiming.IMMEDIATE:
- if (_recorder != null) {
- _recorder.ptr.record(message);
- } else if (_enqueuing) {
- _message_queue.add(message);
- }
- break;
- case TraceSendTiming.AT_END:
- if (isActive()) {
- _message_queue.add(message);
- }
- break;
- }
- }
-}
« no previous file with comments | « mojo/common/dart/BUILD.gn ('k') | mojo/common/dart/lib/tracing_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698