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

Side by Side Diff: base/trace_event/trace_event_argument.h

Issue 1717283003: tracing: Make ConvertableToTraceFormat move-only scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_ 5 #ifndef BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_
6 #define BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_ 6 #define BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/pickle.h" 15 #include "base/pickle.h"
16 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
17 #include "base/trace_event/trace_event_impl.h" 17 #include "base/trace_event/trace_event_impl.h"
18 18
19 namespace base { 19 namespace base {
20 20
21 class Value; 21 class Value;
22 22
23 namespace trace_event { 23 namespace trace_event {
24 24
25 class BASE_EXPORT TracedValue : public ConvertableToTraceFormat { 25 class BASE_EXPORT TracedValue : public ConvertableToTraceFormat {
26 public: 26 public:
27 TracedValue(); 27 TracedValue();
28 explicit TracedValue(size_t capacity); 28 explicit TracedValue(size_t capacity);
29 ~TracedValue() override;
29 30
30 void EndDictionary(); 31 void EndDictionary();
31 void EndArray(); 32 void EndArray();
32 33
33 // These methods assume that |name| is a long lived "quoted" string. 34 // These methods assume that |name| is a long lived "quoted" string.
34 void SetInteger(const char* name, int value); 35 void SetInteger(const char* name, int value);
35 void SetDouble(const char* name, double value); 36 void SetDouble(const char* name, double value);
36 void SetBoolean(const char* name, bool value); 37 void SetBoolean(const char* name, bool value);
37 void SetString(const char* name, base::StringPiece value); 38 void SetString(const char* name, base::StringPiece value);
38 void SetValue(const char* name, const TracedValue& value); 39 void SetValue(const char* name, const TracedValue& value);
(...skipping 29 matching lines...) Expand all
68 // SetValue(TracedValue) API. crbug.com/495628. 69 // SetValue(TracedValue) API. crbug.com/495628.
69 void SetValue(const char* name, scoped_ptr<base::Value> value); 70 void SetValue(const char* name, scoped_ptr<base::Value> value);
70 void SetBaseValueWithCopiedName(base::StringPiece name, 71 void SetBaseValueWithCopiedName(base::StringPiece name,
71 const base::Value& value); 72 const base::Value& value);
72 void AppendBaseValue(const base::Value& value); 73 void AppendBaseValue(const base::Value& value);
73 74
74 // Public for tests only. 75 // Public for tests only.
75 scoped_ptr<base::Value> ToBaseValue() const; 76 scoped_ptr<base::Value> ToBaseValue() const;
76 77
77 private: 78 private:
78 ~TracedValue() override;
79
80 Pickle pickle_; 79 Pickle pickle_;
81 80
82 #ifndef NDEBUG 81 #ifndef NDEBUG
83 // In debug builds checks the pairings of {Start,End}{Dictionary,Array} 82 // In debug builds checks the pairings of {Start,End}{Dictionary,Array}
84 std::vector<bool> nesting_stack_; 83 std::vector<bool> nesting_stack_;
85 #endif 84 #endif
86 85
87 DISALLOW_COPY_AND_ASSIGN(TracedValue); 86 DISALLOW_COPY_AND_ASSIGN(TracedValue);
88 }; 87 };
89 88
90 } // namespace trace_event 89 } // namespace trace_event
91 } // namespace base 90 } // namespace base
92 91
93 #endif // BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_ 92 #endif // BASE_TRACE_EVENT_TRACE_EVENT_ARGUMENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698