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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/Values_h.template

Issue 2238423002: [DevTools] Generate all files in inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2240663003
Patch Set: Created 4 years, 4 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 Values_h 5 #ifndef Values_h
6 #define Values_h 6 #define Values_h
7 7
8 #include "platform/inspector_protocol/Allocator.h" 8 //#include "Allocator.h"
9 #include "platform/inspector_protocol/Collections.h" 9 //#include "Collections.h"
10 #include "platform/inspector_protocol/Platform.h" 10 //#include "Platform.h"
11 #include "platform/inspector_protocol/String16.h" 11 //#include "String16.h"
12 #include "{{export_macro_include}}"
12 13
13 #include <vector> 14 #include <vector>
14 15
15 namespace blink { 16 namespace blink {
16 namespace protocol { 17 namespace protocol {
17 18
18 class ListValue; 19 class ListValue;
19 class DictionaryValue; 20 class DictionaryValue;
20 class Value; 21 class Value;
21 22
22 class PLATFORM_EXPORT Value { 23 class {{export_macro}} Value {
23 PROTOCOL_DISALLOW_COPY(Value); 24 PROTOCOL_DISALLOW_COPY(Value);
24 public: 25 public:
25 static const int maxDepth = 1000; 26 static const int maxDepth = 1000;
26 27
27 virtual ~Value() { } 28 virtual ~Value() { }
28 29
29 static std::unique_ptr<Value> null() 30 static std::unique_ptr<Value> null()
30 { 31 {
31 return wrapUnique(new Value()); 32 return wrapUnique(new Value());
32 } 33 }
(...skipping 27 matching lines...) Expand all
60 Value() : m_type(TypeNull) { } 61 Value() : m_type(TypeNull) { }
61 explicit Value(ValueType type) : m_type(type) { } 62 explicit Value(ValueType type) : m_type(type) { }
62 63
63 private: 64 private:
64 friend class DictionaryValue; 65 friend class DictionaryValue;
65 friend class ListValue; 66 friend class ListValue;
66 67
67 ValueType m_type; 68 ValueType m_type;
68 }; 69 };
69 70
70 class PLATFORM_EXPORT FundamentalValue : public Value { 71 class {{export_macro}} FundamentalValue : public Value {
71 public: 72 public:
72 static std::unique_ptr<FundamentalValue> create(bool value) 73 static std::unique_ptr<FundamentalValue> create(bool value)
73 { 74 {
74 return wrapUnique(new FundamentalValue(value)); 75 return wrapUnique(new FundamentalValue(value));
75 } 76 }
76 77
77 static std::unique_ptr<FundamentalValue> create(int value) 78 static std::unique_ptr<FundamentalValue> create(int value)
78 { 79 {
79 return wrapUnique(new FundamentalValue(value)); 80 return wrapUnique(new FundamentalValue(value));
80 } 81 }
(...skipping 14 matching lines...) Expand all
95 explicit FundamentalValue(int value) : Value(TypeInteger), m_integerValue(va lue) { } 96 explicit FundamentalValue(int value) : Value(TypeInteger), m_integerValue(va lue) { }
96 explicit FundamentalValue(double value) : Value(TypeDouble), m_doubleValue(v alue) { } 97 explicit FundamentalValue(double value) : Value(TypeDouble), m_doubleValue(v alue) { }
97 98
98 union { 99 union {
99 bool m_boolValue; 100 bool m_boolValue;
100 double m_doubleValue; 101 double m_doubleValue;
101 int m_integerValue; 102 int m_integerValue;
102 }; 103 };
103 }; 104 };
104 105
105 class PLATFORM_EXPORT StringValue : public Value { 106 class {{export_macro}} StringValue : public Value {
106 public: 107 public:
107 static std::unique_ptr<StringValue> create(const String16& value) 108 static std::unique_ptr<StringValue> create(const String16& value)
108 { 109 {
109 return wrapUnique(new StringValue(value)); 110 return wrapUnique(new StringValue(value));
110 } 111 }
111 112
112 static std::unique_ptr<StringValue> create(const char* value) 113 static std::unique_ptr<StringValue> create(const char* value)
113 { 114 {
114 return wrapUnique(new StringValue(value)); 115 return wrapUnique(new StringValue(value));
115 } 116 }
116 117
117 bool asString(String16* output) const override; 118 bool asString(String16* output) const override;
118 void writeJSON(String16Builder* output) const override; 119 void writeJSON(String16Builder* output) const override;
119 std::unique_ptr<Value> clone() const override; 120 std::unique_ptr<Value> clone() const override;
120 121
121 private: 122 private:
122 explicit StringValue(const String16& value) : Value(TypeString), m_stringVal ue(value) { } 123 explicit StringValue(const String16& value) : Value(TypeString), m_stringVal ue(value) { }
123 explicit StringValue(const char* value) : Value(TypeString), m_stringValue(v alue) { } 124 explicit StringValue(const char* value) : Value(TypeString), m_stringValue(v alue) { }
124 125
125 String16 m_stringValue; 126 String16 m_stringValue;
126 }; 127 };
127 128
128 class PLATFORM_EXPORT SerializedValue : public Value { 129 class {{export_macro}} SerializedValue : public Value {
129 public: 130 public:
130 static std::unique_ptr<SerializedValue> create(const String16& value) 131 static std::unique_ptr<SerializedValue> create(const String16& value)
131 { 132 {
132 return wrapUnique(new SerializedValue(value)); 133 return wrapUnique(new SerializedValue(value));
133 } 134 }
134 135
135 bool asSerialized(String16* output) const override; 136 bool asSerialized(String16* output) const override;
136 void writeJSON(String16Builder* output) const override; 137 void writeJSON(String16Builder* output) const override;
137 std::unique_ptr<Value> clone() const override; 138 std::unique_ptr<Value> clone() const override;
138 139
139 private: 140 private:
140 explicit SerializedValue(const String16& value) : Value(TypeSerialized), m_s erializedValue(value) { } 141 explicit SerializedValue(const String16& value) : Value(TypeSerialized), m_s erializedValue(value) { }
141 explicit SerializedValue(const char* value) : Value(TypeSerialized), m_seria lizedValue(value) { } 142 explicit SerializedValue(const char* value) : Value(TypeSerialized), m_seria lizedValue(value) { }
142 143
143 String16 m_serializedValue; 144 String16 m_serializedValue;
144 }; 145 };
145 146
146 class PLATFORM_EXPORT DictionaryValue : public Value { 147 class {{export_macro}} DictionaryValue : public Value {
147 public: 148 public:
148 using Entry = std::pair<String16, Value*>; 149 using Entry = std::pair<String16, Value*>;
149 static std::unique_ptr<DictionaryValue> create() 150 static std::unique_ptr<DictionaryValue> create()
150 { 151 {
151 return wrapUnique(new DictionaryValue()); 152 return wrapUnique(new DictionaryValue());
152 } 153 }
153 154
154 static DictionaryValue* cast(Value* value) 155 static DictionaryValue* cast(Value* value)
155 { 156 {
156 if (!value || value->type() != TypeObject) 157 if (!value || value->type() != TypeObject)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 m_data[key] = std::move(value); 204 m_data[key] = std::move(value);
204 if (isNew) 205 if (isNew)
205 m_order.push_back(key); 206 m_order.push_back(key);
206 } 207 }
207 208
208 using Dictionary = protocol::HashMap<String16, std::unique_ptr<Value>>; 209 using Dictionary = protocol::HashMap<String16, std::unique_ptr<Value>>;
209 Dictionary m_data; 210 Dictionary m_data;
210 std::vector<String16> m_order; 211 std::vector<String16> m_order;
211 }; 212 };
212 213
213 class PLATFORM_EXPORT ListValue : public Value { 214 class {{export_macro}} ListValue : public Value {
214 public: 215 public:
215 static std::unique_ptr<ListValue> create() 216 static std::unique_ptr<ListValue> create()
216 { 217 {
217 return wrapUnique(new ListValue()); 218 return wrapUnique(new ListValue());
218 } 219 }
219 220
220 static ListValue* cast(Value* value) 221 static ListValue* cast(Value* value)
221 { 222 {
222 if (!value || value->type() != TypeArray) 223 if (!value || value->type() != TypeArray)
223 return nullptr; 224 return nullptr;
(...skipping 17 matching lines...) Expand all
241 242
242 private: 243 private:
243 ListValue(); 244 ListValue();
244 std::vector<std::unique_ptr<Value>> m_data; 245 std::vector<std::unique_ptr<Value>> m_data;
245 }; 246 };
246 247
247 } // namespace protocol 248 } // namespace protocol
248 } // namespace blink 249 } // namespace blink
249 250
250 #endif // Values_h 251 #endif // Values_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698