OLD | NEW |
(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 SERVICES_TRACING_RECORDER_H_ |
| 6 #define SERVICES_TRACING_RECORDER_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "mojo/public/cpp/bindings/binding.h" |
| 10 #include "mojo/public/cpp/bindings/string.h" |
| 11 #include "services/tracing/data_sink.h" |
| 12 #include "services/tracing/public/interfaces/tracing.mojom.h" |
| 13 |
| 14 namespace tracing { |
| 15 |
| 16 class Recorder : public mojom::Recorder { |
| 17 public: |
| 18 Recorder(mojom::RecorderRequest request, DataSink* sink); |
| 19 ~Recorder() override; |
| 20 |
| 21 // TryRead attempts to read a single chunk from the Recorder pipe if one is |
| 22 // available and passes it to the DataSink. Returns immediately if no |
| 23 // chunk is available. |
| 24 void TryRead(); |
| 25 |
| 26 // RecorderHandle returns the handle value of the Recorder binding which can |
| 27 // be used to wait until chunks are available. |
| 28 mojo::Handle RecorderHandle() const; |
| 29 |
| 30 private: |
| 31 // mojom::Recorder implementation. |
| 32 void Record(const std::string& json) override; |
| 33 |
| 34 DataSink* sink_; |
| 35 mojo::Binding<mojom::Recorder> binding_; |
| 36 |
| 37 DISALLOW_COPY_AND_ASSIGN(Recorder); |
| 38 }; |
| 39 |
| 40 } // namespace tracing |
| 41 |
| 42 #endif // SERVICES_TRACING_RECORDER_H_ |
OLD | NEW |