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