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

Side by Side Diff: apps/benchmark/trace_collector_client.h

Issue 1305193002: Trace-based benchmarking via a mojo app. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Further address Etienne's comments. Created 5 years, 3 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 unified diff | Download patch
« no previous file with comments | « apps/benchmark/run_args.cc ('k') | apps/benchmark/trace_collector_client.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef APPS_BENCHMARK_TRACE_COORDINATOR_CLIENT_H_
6 #define APPS_BENCHMARK_TRACE_COORDINATOR_CLIENT_H_
7
8 #include <memory>
9 #include <string>
10
11 #include "base/memory/scoped_ptr.h"
12 #include "mojo/data_pipe_utils/data_pipe_drainer.h"
13 #include "mojo/services/tracing/public/interfaces/tracing.mojom.h"
14
15 // Connects to trace collector in tracing.mojo to get traces and returns the
16 // results as a single string to the receiver.
17 class TraceCollectorClient : public mojo::common::DataPipeDrainer::Client {
18 public:
19 class Receiver {
20 public:
21 // |trace_data| will be a JSON list of the collected trace events.
22 virtual void OnTraceCollected(std::string trace_data) = 0;
23
24 protected:
25 virtual ~Receiver() {}
26 };
27
28 TraceCollectorClient(Receiver* receiver,
29 tracing::TraceCollectorPtr collector);
30 ~TraceCollectorClient() override;
31
32 void Start(const std::string& categories);
33 void Stop();
34
35 private:
36 // mojo::common:DataPipeDrainer:
37 void OnDataAvailable(const void* data, size_t num_bytes) override;
38 void OnDataComplete() override;
39
40 Receiver* receiver_;
41 tracing::TraceCollectorPtr collector_;
42 scoped_ptr<mojo::common::DataPipeDrainer> drainer_;
43 std::string trace_data_;
44 bool currently_tracing_;
45
46 DISALLOW_COPY_AND_ASSIGN(TraceCollectorClient);
47 };
48
49 #endif // APPS_BENCHMARK_TRACE_COORDINATOR_CLIENT_H_
OLDNEW
« no previous file with comments | « apps/benchmark/run_args.cc ('k') | apps/benchmark/trace_collector_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698