Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: src/tracing/traced-value.h

Issue 2399463004: [tracing] Add support for TracedValue JSON serializer. (Closed)
Patch Set: addressing nits Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « BUILD.gn ('k') | src/tracing/traced-value.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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 std::string& value);
33 void BeginDictionary(const char* name);
34 void BeginArray(const char* name);
35
36 void AppendInteger(int);
37 void AppendDouble(double);
38 void AppendBoolean(bool);
39 void AppendString(const std::string&);
40 void BeginArray();
41 void BeginDictionary();
42
43 // ConvertableToTraceFormat implementation.
44 void AppendAsTraceFormat(std::string* out) const override;
45
46 private:
47 TracedValue();
48
49 void WriteComma();
50 void WriteName(const char* name);
51
52 #ifdef DEBUG
53 // In debug builds checks the pairings of {Begin,End}{Dictionary,Array}
54 std::vector<bool> nesting_stack_;
55 #endif
56
57 std::string data_;
58 bool first_item_;
59
60 DISALLOW_COPY_AND_ASSIGN(TracedValue);
61 };
62
63 } // namespace tracing
64 } // namespace v8
65
66 #endif // V8_TRACING_TRACED_VALUE_H_
OLDNEW
« no previous file with comments | « BUILD.gn ('k') | src/tracing/traced-value.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698