LCOV - code coverage report
Current view: top level - src/tracing - traced-value.h (source / functions) Hit Total Coverage
Test: app.info Lines: 2 2 100.0 %
Date: 2019-02-19 Functions: 0 0 -

          Line data    Source code
       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_TRACING_TRACED_VALUE_H_
       6             : #define V8_TRACING_TRACED_VALUE_H_
       7             : 
       8             : #include <stddef.h>
       9             : #include <memory>
      10             : #include <string>
      11             : #include <vector>
      12             : 
      13             : #include "include/v8-platform.h"
      14             : #include "src/base/macros.h"
      15             : 
      16             : namespace v8 {
      17             : namespace tracing {
      18             : 
      19             : class TracedValue : public ConvertableToTraceFormat {
      20             :  public:
      21             :   ~TracedValue() override;
      22             : 
      23             :   static std::unique_ptr<TracedValue> Create();
      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 SetString(const char* name, const char* value);
      33             :   void SetString(const char* name, const std::string& value) {
      34          10 :     SetString(name, value.c_str());
      35             :   }
      36             :   void BeginDictionary(const char* name);
      37             :   void BeginArray(const char* name);
      38             : 
      39             :   void AppendInteger(int);
      40             :   void AppendDouble(double);
      41             :   void AppendBoolean(bool);
      42             :   void AppendString(const char*);
      43           5 :   void AppendString(const std::string& value) { AppendString(value.c_str()); }
      44             :   void BeginArray();
      45             :   void BeginDictionary();
      46             : 
      47             :   // ConvertableToTraceFormat implementation.
      48             :   void AppendAsTraceFormat(std::string* out) const override;
      49             : 
      50             :  private:
      51             :   TracedValue();
      52             : 
      53             :   void WriteComma();
      54             :   void WriteName(const char* name);
      55             : 
      56             : #ifdef DEBUG
      57             :   // In debug builds checks the pairings of {Begin,End}{Dictionary,Array}
      58             :   std::vector<bool> nesting_stack_;
      59             : #endif
      60             : 
      61             :   std::string data_;
      62             :   bool first_item_;
      63             : 
      64             :   DISALLOW_COPY_AND_ASSIGN(TracedValue);
      65             : };
      66             : 
      67             : }  // namespace tracing
      68             : }  // namespace v8
      69             : 
      70             : #endif  // V8_TRACING_TRACED_VALUE_H_

Generated by: LCOV version 1.10