GCC Code Coverage Report
Directory: ../ Exec Total Coverage
File: /home/iojs/build/workspace/node-test-commit-linux-coverage-daily/nodes/benchmark/out/../src/tracing/traced_value.h Lines: 1 1 100.0 %
Date: 2019-02-13 22:28:58 Branches: 0 0 - %

Line Branch Exec Source
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_TRACING_TRACED_VALUE_H_
6
#define SRC_TRACING_TRACED_VALUE_H_
7
8
#include "node.h"
9
#include "util.h"
10
#include "v8.h"
11
12
#include <stddef.h>
13
#include <memory>
14
#include <string>
15
16
namespace node {
17
namespace tracing {
18
19
class TracedValue : public v8::ConvertableToTraceFormat {
20
 public:
21
  ~TracedValue() override;
22
23
  static std::unique_ptr<TracedValue> Create();
24
  static std::unique_ptr<TracedValue> CreateArray();
25
26
  void EndDictionary();
27
  void EndArray();
28
29
  // These methods assume that |name| is a long lived "quoted" string.
30
  void SetInteger(const char* name, int value);
31
  void SetDouble(const char* name, double value);
32
  void SetBoolean(const char* name, bool value);
33
  void SetNull(const char* name);
34
  void SetString(const char* name, const char* value);
35
  void SetString(const char* name, const std::string& value) {
36
    SetString(name, value.c_str());
37
  }
38
  void BeginDictionary(const char* name);
39
  void BeginArray(const char* name);
40
41
  void AppendInteger(int);
42
  void AppendDouble(double);
43
  void AppendBoolean(bool);
44
  void AppendNull();
45
  void AppendString(const char*);
46
30
  void AppendString(const std::string& value) { AppendString(value.c_str()); }
47
  void BeginArray();
48
  void BeginDictionary();
49
50
  // ConvertableToTraceFormat implementation.
51
  void AppendAsTraceFormat(std::string* out) const override;
52
53
 private:
54
  explicit TracedValue(bool root_is_array = false);
55
56
  void WriteComma();
57
  void WriteName(const char* name);
58
59
  std::string data_;
60
  bool first_item_;
61
  bool root_is_array_;
62
63
  DISALLOW_COPY_AND_ASSIGN(TracedValue);
64
};
65
66
}  // namespace tracing
67
}  // namespace node
68
69
#endif  // SRC_TRACING_TRACED_VALUE_H_