| Index: third_party/WebKit/Source/platform/inspector_protocol/Values_h.template
|
| diff --git a/third_party/WebKit/Source/platform/inspector_protocol/Values_h.template b/third_party/WebKit/Source/platform/inspector_protocol/Values_h.template
|
| index 9874183a7736289c056a84b4d3d97cac444ee46b..9199ab2567974a64209658002d004581ebe383ec 100644
|
| --- a/third_party/WebKit/Source/platform/inspector_protocol/Values_h.template
|
| +++ b/third_party/WebKit/Source/platform/inspector_protocol/Values_h.template
|
| @@ -2,19 +2,16 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#ifndef Values_h
|
| -#define Values_h
|
| +#ifndef {{"_".join(config.protocol.namespace)}}_Values_h
|
| +#define {{"_".join(config.protocol.namespace)}}_Values_h
|
|
|
| //#include "Allocator.h"
|
| //#include "Collections.h"
|
| -//#include "Platform.h"
|
| -//#include "String16.h"
|
| -#include "{{config.class_export.header}}"
|
| +//#include "Forward.h"
|
|
|
| -#include <vector>
|
| -
|
| -namespace blink {
|
| -namespace protocol {
|
| +{% for namespace in config.protocol.namespace %}
|
| +namespace {{namespace}} {
|
| +{% endfor %}
|
|
|
| class ListValue;
|
| class DictionaryValue;
|
| @@ -23,8 +20,6 @@ class Value;
|
| class {{config.class_export.macro}} Value {
|
| PROTOCOL_DISALLOW_COPY(Value);
|
| public:
|
| - static const int maxDepth = 1000;
|
| -
|
| virtual ~Value() { }
|
|
|
| static std::unique_ptr<Value> null()
|
| @@ -50,11 +45,11 @@ public:
|
| virtual bool asBoolean(bool* output) const;
|
| virtual bool asDouble(double* output) const;
|
| virtual bool asInteger(int* output) const;
|
| - virtual bool asString(String16* output) const;
|
| - virtual bool asSerialized(String16* output) const;
|
| + virtual bool asString(String* output) const;
|
| + virtual bool asSerialized(String* output) const;
|
|
|
| - String16 toJSONString() const;
|
| - virtual void writeJSON(String16Builder* output) const;
|
| + String toJSONString() const;
|
| + virtual void writeJSON(StringBuilder* output) const;
|
| virtual std::unique_ptr<Value> clone() const;
|
|
|
| protected:
|
| @@ -88,7 +83,7 @@ public:
|
| bool asBoolean(bool* output) const override;
|
| bool asDouble(double* output) const override;
|
| bool asInteger(int* output) const override;
|
| - void writeJSON(String16Builder* output) const override;
|
| + void writeJSON(StringBuilder* output) const override;
|
| std::unique_ptr<Value> clone() const override;
|
|
|
| private:
|
| @@ -105,7 +100,7 @@ private:
|
|
|
| class {{config.class_export.macro}} StringValue : public Value {
|
| public:
|
| - static std::unique_ptr<StringValue> create(const String16& value)
|
| + static std::unique_ptr<StringValue> create(const String& value)
|
| {
|
| return wrapUnique(new StringValue(value));
|
| }
|
| @@ -115,38 +110,37 @@ public:
|
| return wrapUnique(new StringValue(value));
|
| }
|
|
|
| - bool asString(String16* output) const override;
|
| - void writeJSON(String16Builder* output) const override;
|
| + bool asString(String* output) const override;
|
| + void writeJSON(StringBuilder* output) const override;
|
| std::unique_ptr<Value> clone() const override;
|
|
|
| private:
|
| - explicit StringValue(const String16& value) : Value(TypeString), m_stringValue(value) { }
|
| + explicit StringValue(const String& value) : Value(TypeString), m_stringValue(value) { }
|
| explicit StringValue(const char* value) : Value(TypeString), m_stringValue(value) { }
|
|
|
| - String16 m_stringValue;
|
| + String m_stringValue;
|
| };
|
|
|
| class {{config.class_export.macro}} SerializedValue : public Value {
|
| public:
|
| - static std::unique_ptr<SerializedValue> create(const String16& value)
|
| + static std::unique_ptr<SerializedValue> create(const String& value)
|
| {
|
| return wrapUnique(new SerializedValue(value));
|
| }
|
|
|
| - bool asSerialized(String16* output) const override;
|
| - void writeJSON(String16Builder* output) const override;
|
| + bool asSerialized(String* output) const override;
|
| + void writeJSON(StringBuilder* output) const override;
|
| std::unique_ptr<Value> clone() const override;
|
|
|
| private:
|
| - explicit SerializedValue(const String16& value) : Value(TypeSerialized), m_serializedValue(value) { }
|
| - explicit SerializedValue(const char* value) : Value(TypeSerialized), m_serializedValue(value) { }
|
| + explicit SerializedValue(const String& value) : Value(TypeSerialized), m_serializedValue(value) { }
|
|
|
| - String16 m_serializedValue;
|
| + String m_serializedValue;
|
| };
|
|
|
| class {{config.class_export.macro}} DictionaryValue : public Value {
|
| public:
|
| - using Entry = std::pair<String16, Value*>;
|
| + using Entry = std::pair<String, Value*>;
|
| static std::unique_ptr<DictionaryValue> create()
|
| {
|
| return wrapUnique(new DictionaryValue());
|
| @@ -164,40 +158,40 @@ public:
|
| return wrapUnique(DictionaryValue::cast(value.release()));
|
| }
|
|
|
| - void writeJSON(String16Builder* output) const override;
|
| + void writeJSON(StringBuilder* output) const override;
|
| std::unique_ptr<Value> clone() const override;
|
|
|
| size_t size() const { return m_data.size(); }
|
|
|
| - void setBoolean(const String16& name, bool);
|
| - void setInteger(const String16& name, int);
|
| - void setDouble(const String16& name, double);
|
| - void setString(const String16& name, const String16&);
|
| - void setValue(const String16& name, std::unique_ptr<Value>);
|
| - void setObject(const String16& name, std::unique_ptr<DictionaryValue>);
|
| - void setArray(const String16& name, std::unique_ptr<ListValue>);
|
| -
|
| - bool getBoolean(const String16& name, bool* output) const;
|
| - bool getInteger(const String16& name, int* output) const;
|
| - bool getDouble(const String16& name, double* output) const;
|
| - bool getString(const String16& name, String16* output) const;
|
| -
|
| - DictionaryValue* getObject(const String16& name) const;
|
| - ListValue* getArray(const String16& name) const;
|
| - Value* get(const String16& name) const;
|
| + void setBoolean(const String& name, bool);
|
| + void setInteger(const String& name, int);
|
| + void setDouble(const String& name, double);
|
| + void setString(const String& name, const String&);
|
| + void setValue(const String& name, std::unique_ptr<Value>);
|
| + void setObject(const String& name, std::unique_ptr<DictionaryValue>);
|
| + void setArray(const String& name, std::unique_ptr<ListValue>);
|
| +
|
| + bool getBoolean(const String& name, bool* output) const;
|
| + bool getInteger(const String& name, int* output) const;
|
| + bool getDouble(const String& name, double* output) const;
|
| + bool getString(const String& name, String* output) const;
|
| +
|
| + DictionaryValue* getObject(const String& name) const;
|
| + ListValue* getArray(const String& name) const;
|
| + Value* get(const String& name) const;
|
| Entry at(size_t index) const;
|
|
|
| - bool booleanProperty(const String16& name, bool defaultValue) const;
|
| - int integerProperty(const String16& name, int defaultValue) const;
|
| - double doubleProperty(const String16& name, double defaultValue) const;
|
| - void remove(const String16& name);
|
| + bool booleanProperty(const String& name, bool defaultValue) const;
|
| + int integerProperty(const String& name, int defaultValue) const;
|
| + double doubleProperty(const String& name, double defaultValue) const;
|
| + void remove(const String& name);
|
|
|
| ~DictionaryValue() override;
|
|
|
| private:
|
| DictionaryValue();
|
| template<typename T>
|
| - void set(const String16& key, std::unique_ptr<T>& value)
|
| + void set(const String& key, std::unique_ptr<T>& value)
|
| {
|
| DCHECK(value);
|
| bool isNew = m_data.find(key) == m_data.end();
|
| @@ -206,9 +200,9 @@ private:
|
| m_order.push_back(key);
|
| }
|
|
|
| - using Dictionary = protocol::HashMap<String16, std::unique_ptr<Value>>;
|
| + using Dictionary = protocol::HashMap<String, std::unique_ptr<Value>>;
|
| Dictionary m_data;
|
| - std::vector<String16> m_order;
|
| + std::vector<String> m_order;
|
| };
|
|
|
| class {{config.class_export.macro}} ListValue : public Value {
|
| @@ -232,7 +226,7 @@ public:
|
|
|
| ~ListValue() override;
|
|
|
| - void writeJSON(String16Builder* output) const override;
|
| + void writeJSON(StringBuilder* output) const override;
|
| std::unique_ptr<Value> clone() const override;
|
|
|
| void pushValue(std::unique_ptr<Value>);
|
| @@ -245,7 +239,8 @@ private:
|
| std::vector<std::unique_ptr<Value>> m_data;
|
| };
|
|
|
| -} // namespace protocol
|
| -} // namespace blink
|
| +{% for namespace in config.protocol.namespace %}
|
| +} // namespace {{namespace}}
|
| +{% endfor %}
|
|
|
| -#endif // Values_h
|
| +#endif // {{"_".join(config.protocol.namespace)}}_Values_h
|
|
|