OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_TRACING_CORE_TRACE_BUFFER_WRITER_H_ | 5 #ifndef COMPONENTS_TRACING_CORE_TRACE_BUFFER_WRITER_H_ |
6 #define COMPONENTS_TRACING_CORE_TRACE_BUFFER_WRITER_H_ | 6 #define COMPONENTS_TRACING_CORE_TRACE_BUFFER_WRITER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "components/tracing/core/proto_zero_message.h" | 9 #include "components/tracing/core/proto_zero_message.h" |
10 #include "components/tracing/core/proto_zero_message_handle.h" | 10 #include "components/tracing/core/proto_zero_message_handle.h" |
11 #include "components/tracing/core/scattered_stream_writer.h" | 11 #include "components/tracing/core/scattered_stream_writer.h" |
12 #include "components/tracing/core/trace_ring_buffer.h" | 12 #include "components/tracing/core/trace_ring_buffer.h" |
13 #include "components/tracing/tracing_export.h" | 13 #include "components/tracing/tracing_export.h" |
14 | 14 |
| 15 // Fwd declaration from the generated components/tracing/proto/event.pbzero.h. |
| 16 namespace pbzero { |
15 namespace tracing { | 17 namespace tracing { |
| 18 namespace proto { |
| 19 class Event; |
| 20 } // namespace proto |
| 21 } // namespace tracing |
| 22 } // namespace pbzero |
16 | 23 |
17 // TODO(primiano): in next CL the Event class will just come from the C++ | 24 namespace tracing { |
18 // header generated by the ProtoZero plugin. | |
19 namespace proto { | |
20 class Event : public v2::ProtoZeroMessage {}; | |
21 } | |
22 | |
23 namespace v2 { | 25 namespace v2 { |
24 | 26 |
25 using TraceEventHandle = ProtoZeroMessageHandle<::tracing::proto::Event>; | 27 using TraceEventHandle = ProtoZeroMessageHandle<pbzero::tracing::proto::Event>; |
26 | 28 |
27 // This class is the entry-point to add events to the TraceRingBuffer. | 29 // This class is the entry-point to add events to the TraceRingBuffer. |
28 // It acts as a glue layer between the protobuf classes (ProtoZeroMessage) and | 30 // It acts as a glue layer between the protobuf classes (ProtoZeroMessage) and |
29 // the chunked trace ring buffer (TraceRingBuffer). This class is deliberately | 31 // the chunked trace ring buffer (TraceRingBuffer). This class is deliberately |
30 // NOT thread safe. The expected design is that each thread owns an instance of | 32 // NOT thread safe. The expected design is that each thread owns an instance of |
31 // TraceBufferWriter and that trace events produced on one thread are not passed | 33 // TraceBufferWriter and that trace events produced on one thread are not passed |
32 // to other threads. | 34 // to other threads. |
33 class TRACING_EXPORT TraceBufferWriter | 35 class TRACING_EXPORT TraceBufferWriter |
34 : public ScatteredStreamWriter::Delegate { | 36 : public ScatteredStreamWriter::Delegate { |
35 public: | 37 public: |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // headers for the stub classes and reduce build time. | 94 // headers for the stub classes and reduce build time. |
93 ProtoZeroMessage event_; | 95 ProtoZeroMessage event_; |
94 | 96 |
95 DISALLOW_COPY_AND_ASSIGN(TraceBufferWriter); | 97 DISALLOW_COPY_AND_ASSIGN(TraceBufferWriter); |
96 }; | 98 }; |
97 | 99 |
98 } // namespace v2 | 100 } // namespace v2 |
99 } // namespace tracing | 101 } // namespace tracing |
100 | 102 |
101 #endif // COMPONENTS_TRACING_CORE_TRACE_BUFFER_WRITER_H_ | 103 #endif // COMPONENTS_TRACING_CORE_TRACE_BUFFER_WRITER_H_ |
OLD | NEW |