• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2016 the V8 project 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 SRC_LIBPLATFORM_TRACING_TRACE_WRITER_H_
6 #define SRC_LIBPLATFORM_TRACING_TRACE_WRITER_H_
7 
8 #include "include/libplatform/v8-tracing.h"
9 
10 namespace v8 {
11 namespace platform {
12 namespace tracing {
13 
14 class JSONTraceWriter : public TraceWriter {
15  public:
16   explicit JSONTraceWriter(std::ostream& stream);
17   ~JSONTraceWriter();
18   void AppendTraceEvent(TraceObject* trace_event) override;
19   void Flush() override;
20 
21  private:
22   void AppendArgValue(uint8_t type, TraceObject::ArgValue value);
23   void AppendArgValue(v8::ConvertableToTraceFormat*);
24 
25   std::ostream& stream_;
26   bool append_comma_ = false;
27 };
28 
29 }  // namespace tracing
30 }  // namespace platform
31 }  // namespace v8
32 
33 #endif  // SRC_LIBPLATFORM_TRACING_TRACE_WRITER_H_
34