• 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 V8_LIBPLATFORM_TRACING_TRACE_WRITER_H_
6 #define V8_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(std::ostream& stream, const std::string& tag);
18   ~JSONTraceWriter();
19   void AppendTraceEvent(TraceObject* trace_event) override;
20   void Flush() override;
21 
22  private:
23   void AppendArgValue(uint8_t type, TraceObject::ArgValue value);
24   void AppendArgValue(v8::ConvertableToTraceFormat*);
25 
26   std::ostream& stream_;
27   bool append_comma_ = false;
28 };
29 
30 }  // namespace tracing
31 }  // namespace platform
32 }  // namespace v8
33 
34 #endif  // V8_LIBPLATFORM_TRACING_TRACE_WRITER_H_
35