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

Unified Diff: lib/Array_h.template

Issue 2526603002: [inspector_protocol] Introduce protocol::Serializable (Closed)
Patch Set: minor fix Created 4 years, 1 month 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
« no previous file with comments | « CodeGenerator.py ('k') | lib/DispatcherBase_cpp.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Array_h.template
diff --git a/lib/Array_h.template b/lib/Array_h.template
index a258da1cc5630b4831b2ceb44b69074ffcfb079e..3854f6e5cd102e9962e847e2650b0b6d3f8ef161 100644
--- a/lib/Array_h.template
+++ b/lib/Array_h.template
@@ -22,7 +22,7 @@ public:
return std::unique_ptr<Array<T>>(new Array<T>());
}
- static std::unique_ptr<Array<T>> parse(protocol::Value* value, ErrorSupport* errors)
+ static std::unique_ptr<Array<T>> fromValue(protocol::Value* value, ErrorSupport* errors)
{
protocol::ListValue* array = ListValue::cast(value);
if (!array) {
@@ -33,7 +33,7 @@ public:
errors->push();
for (size_t i = 0; i < array->size(); ++i) {
errors->setName(StringUtil::fromInteger(i));
- std::unique_ptr<T> item = ValueConversions<T>::parse(array->at(i), errors);
+ std::unique_ptr<T> item = ValueConversions<T>::fromValue(array->at(i), errors);
result->m_vector.push_back(std::move(item));
}
errors->pop();
@@ -57,11 +57,11 @@ public:
return m_vector[index].get();
}
- std::unique_ptr<protocol::ListValue> serialize()
+ std::unique_ptr<protocol::ListValue> toValue()
{
std::unique_ptr<protocol::ListValue> result = ListValue::create();
for (auto& item : m_vector)
- result->pushValue(ValueConversions<T>::serialize(item));
+ result->pushValue(ValueConversions<T>::toValue(item));
return result;
}
@@ -77,7 +77,7 @@ public:
return std::unique_ptr<Array<T>>(new Array<T>());
}
- static std::unique_ptr<Array<T>> parse(protocol::Value* value, ErrorSupport* errors)
+ static std::unique_ptr<Array<T>> fromValue(protocol::Value* value, ErrorSupport* errors)
{
protocol::ListValue* array = ListValue::cast(value);
if (!array) {
@@ -88,7 +88,7 @@ public:
std::unique_ptr<Array<T>> result(new Array<T>());
for (size_t i = 0; i < array->size(); ++i) {
errors->setName(StringUtil::fromInteger(i));
- T item = ValueConversions<T>::parse(array->at(i), errors);
+ T item = ValueConversions<T>::fromValue(array->at(i), errors);
result->m_vector.push_back(item);
}
errors->pop();
@@ -112,11 +112,11 @@ public:
return m_vector[index];
}
- std::unique_ptr<protocol::ListValue> serialize()
+ std::unique_ptr<protocol::ListValue> toValue()
{
std::unique_ptr<protocol::ListValue> result = ListValue::create();
for (auto& item : m_vector)
- result->pushValue(ValueConversions<T>::serialize(item));
+ result->pushValue(ValueConversions<T>::toValue(item));
return result;
}
« no previous file with comments | « CodeGenerator.py ('k') | lib/DispatcherBase_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698