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