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

Unified Diff: lib/Object_cpp.template

Issue 2490733002: [inspector_protocol] Allow custom json parser. (Closed)
Patch Set: 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 | « lib/Forward_h.template ('k') | lib/Parser_cpp.template » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/Object_cpp.template
diff --git a/lib/Object_cpp.template b/lib/Object_cpp.template
index e3f18c3500e2b29422ec6db9f5f332e0e24fb471..46b0c94b2dddc3f95ceebd421620a48b85dca8c8 100644
--- a/lib/Object_cpp.template
+++ b/lib/Object_cpp.template
@@ -10,12 +10,13 @@ namespace {{namespace}} {
std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* errors)
{
- protocol::DictionaryValue* object = DictionaryValue::cast(value);
- if (!object) {
+ protocol::DictionaryValue* dictionary = DictionaryValue::cast(value);
+ if (!dictionary) {
errors->addError("object expected");
return nullptr;
}
- return wrapUnique(new Object(wrapUnique(static_cast<DictionaryValue*>(object->clone().release()))));
+ dictionary = static_cast<protocol::DictionaryValue*>(dictionary->clone().release());
+ return std::unique_ptr<Object>(new Object(std::unique_ptr<DictionaryValue>(dictionary)));
}
std::unique_ptr<protocol::DictionaryValue> Object::serialize() const
@@ -25,7 +26,7 @@ std::unique_ptr<protocol::DictionaryValue> Object::serialize() const
std::unique_ptr<Object> Object::clone() const
{
- return wrapUnique(new Object(DictionaryValue::cast(m_object->clone())));
+ return std::unique_ptr<Object>(new Object(DictionaryValue::cast(m_object->clone())));
}
Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std::move(object)) { }
« no previous file with comments | « lib/Forward_h.template ('k') | lib/Parser_cpp.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698