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

Unified Diff: third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template

Issue 1738073002: DevTools: introduce protocol::Value, baseline for hierarchical data in remote debugging protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
diff --git a/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template b/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
index 2654550ac627e3fb86562c4419a4f410e656fb30..8341cc132b3dce36a3af5f4d0225981ea4e009b8 100644
--- a/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
+++ b/third_party/WebKit/Source/platform/inspector_protocol/TypeBuilder_h.template
@@ -7,8 +7,8 @@
#ifndef {{class_name}}_h
#define {{class_name}}_h
-#include "platform/JSONValues.h"
#include "platform/PlatformExport.h"
+#include "platform/inspector_protocol/Values.h"
#include "wtf/Assertions.h"
#include "wtf/PassOwnPtr.h"
#include "wtf/PassRefPtr.h"
@@ -99,15 +99,15 @@ protected:
template<typename T> class Array;
-PLATFORM_EXPORT PassRefPtr<JSONValue> toValue(int value);
-PLATFORM_EXPORT PassRefPtr<JSONValue> toValue(double value);
-PLATFORM_EXPORT PassRefPtr<JSONValue> toValue(bool value);
-PLATFORM_EXPORT PassRefPtr<JSONValue> toValue(const String& param);
-template<typename T> PassRefPtr<JSONValue> toValue(PassRefPtr<T> param) { return param; }
-template<typename T> PassRefPtr<JSONValue> toValue(const RefPtr<T>& param) { return param; }
-template<typename T> PassRefPtr<JSONValue> toValue(T* param) { return param->serialize(); }
-template<typename T> PassRefPtr<JSONValue> toValue(PassOwnPtr<T> param) { return param->serialize(); }
-template<typename T> PassRefPtr<JSONValue> toValue(const OwnPtr<T>& param) { return param->serialize(); }
+PLATFORM_EXPORT PassRefPtr<protocol::Value> toValue(int value);
+PLATFORM_EXPORT PassRefPtr<protocol::Value> toValue(double value);
+PLATFORM_EXPORT PassRefPtr<protocol::Value> toValue(bool value);
+PLATFORM_EXPORT PassRefPtr<protocol::Value> toValue(const String& param);
+template<typename T> PassRefPtr<protocol::Value> toValue(PassRefPtr<T> param) { return param; }
+template<typename T> PassRefPtr<protocol::Value> toValue(const RefPtr<T>& param) { return param; }
+template<typename T> PassRefPtr<protocol::Value> toValue(T* param) { return param->serialize(); }
+template<typename T> PassRefPtr<protocol::Value> toValue(PassOwnPtr<T> param) { return param->serialize(); }
+template<typename T> PassRefPtr<protocol::Value> toValue(const OwnPtr<T>& param) { return param->serialize(); }
class PLATFORM_EXPORT ErrorSupport {
public:
@@ -131,7 +131,7 @@ private:
template<typename T>
struct FromValue
{
- static PassOwnPtr<T> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static PassOwnPtr<T> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
return T::parse(value, errors);
}
@@ -140,7 +140,7 @@ struct FromValue
template<>
struct FromValue<bool>
{
- static bool parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static bool parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
bool result = false;
bool success = value ? value->asBoolean(&result) : false;
@@ -153,7 +153,7 @@ struct FromValue<bool>
template<>
struct FromValue<int>
{
- static int parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static int parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
int result = 0;
bool success = value ? value->asNumber(&result) : false;
@@ -166,7 +166,7 @@ struct FromValue<int>
template<>
struct FromValue<double>
{
- static double parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static double parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
double result = 0;
bool success = value ? value->asNumber(&result) : false;
@@ -179,7 +179,7 @@ struct FromValue<double>
template<>
struct FromValue<String>
{
- static String parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static String parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
String result;
bool success = value ? value->asString(&result) : false;
@@ -192,7 +192,7 @@ struct FromValue<String>
template<typename T>
struct FromValue<RefPtr<T>>
{
- static PassRefPtr<T> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static PassRefPtr<T> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
if (!value)
errors->addError("value expected");
@@ -201,12 +201,12 @@ struct FromValue<RefPtr<T>>
};
template<>
-struct FromValue<RefPtr<JSONObject>>
+struct FromValue<RefPtr<protocol::DictionaryValue>>
{
- static PassRefPtr<JSONObject> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static PassRefPtr<protocol::DictionaryValue> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
- if (value && value->type() == JSONValue::TypeObject)
- return JSONObject::cast(value);
+ if (value && value->type() == protocol::Value::TypeObject)
+ return DictionaryValue::cast(value);
errors->addError("object expected");
return nullptr;
}
@@ -215,7 +215,7 @@ struct FromValue<RefPtr<JSONObject>>
template<typename T>
struct FromValue<protocol::Array<T>>
{
- static PassOwnPtr<protocol::Array<T>> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static PassOwnPtr<protocol::Array<T>> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
return protocol::Array<T>::parse(value, errors);
}
@@ -229,9 +229,9 @@ public:
return adoptPtr(new Array<T>());
}
- static PassOwnPtr<Array<T>> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static PassOwnPtr<Array<T>> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
- RefPtr<JSONArray> array = JSONArray::cast(value);
+ RefPtr<protocol::ListValue> array = ListValue::cast(value);
if (!array) {
errors->addError("array expected");
return nullptr;
@@ -264,9 +264,9 @@ public:
return m_vector[index];
}
- PassRefPtr<JSONArray> serialize()
+ PassRefPtr<protocol::ListValue> serialize()
{
- RefPtr<JSONArray> result = JSONArray::create();
+ RefPtr<protocol::ListValue> result = ListValue::create();
for (auto& item : m_vector)
result->pushValue(toValue(item));
return result.release();
@@ -290,9 +290,9 @@ public:
return adoptPtr(new Array<T>());
}
- static PassOwnPtr<Array<T>> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors)
+ static PassOwnPtr<Array<T>> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors)
{
- RefPtr<JSONArray> array = JSONArray::cast(value);
+ RefPtr<protocol::ListValue> array = ListValue::cast(value);
if (!array) {
errors->addError("array expected");
return nullptr;
@@ -323,9 +323,9 @@ public:
return m_vector[index].get();
}
- PassRefPtr<JSONArray> serialize()
+ PassRefPtr<protocol::ListValue> serialize()
{
- RefPtr<JSONArray> result = JSONArray::create();
+ RefPtr<protocol::ListValue> result = ListValue::create();
for (auto& item : m_vector)
result->pushValue(toValue(item));
return result.release();
@@ -337,14 +337,14 @@ private:
class PLATFORM_EXPORT Object {
public:
- static PassOwnPtr<Object> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors);
+ static PassOwnPtr<Object> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors);
~Object();
- PassRefPtr<JSONObject> serialize() const;
+ PassRefPtr<protocol::DictionaryValue> serialize() const;
PassOwnPtr<Object> clone() const;
private:
- Object(PassRefPtr<JSONObject> object);
- RefPtr<JSONObject> m_object;
+ Object(PassRefPtr<protocol::DictionaryValue> object);
+ RefPtr<protocol::DictionaryValue> m_object;
};
{% for domain in api.domains %}
@@ -416,7 +416,7 @@ namespace {{domain.domain}} {
// {{type.description}}
class PLATFORM_EXPORT {{type.id}} {
public:
- static PassOwnPtr<{{type.id}}> parse(PassRefPtr<JSONValue> value, ErrorSupport* errors);
+ static PassOwnPtr<{{type.id}}> parse(PassRefPtr<protocol::Value> value, ErrorSupport* errors);
~{{type.id}}() { }
{% for property in type.properties %}
@@ -438,7 +438,7 @@ public:
void set{{property.name | to_title_case}}({{resolve_type(property).pass_type}} value) { m_{{property.name}} = value; }
{% endfor %}
- PassRefPtr<JSONObject> serialize() const;
+ PassRefPtr<protocol::DictionaryValue> serialize() const;
PassOwnPtr<{{type.id}}> clone() const;
template<int STATE>

Powered by Google App Engine
This is Rietveld 408576698