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

Side by Side Diff: third_party/inspector_protocol/lib/Object_cpp.template

Issue 2523583005: Roll third_party/inspector_protocol to 4ad35c45aca9834b67ec2cb152c816ea1b7ceb48 (Closed)
Patch Set: added default implementation Created 4 years 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 //#include "Object.h" 5 //#include "Object.h"
6 6
7 {% for namespace in config.protocol.namespace %} 7 {% for namespace in config.protocol.namespace %}
8 namespace {{namespace}} { 8 namespace {{namespace}} {
9 {% endfor %} 9 {% endfor %}
10 10
11 std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* erro rs) 11 std::unique_ptr<Object> Object::fromValue(protocol::Value* value, ErrorSupport* errors)
12 { 12 {
13 protocol::DictionaryValue* dictionary = DictionaryValue::cast(value); 13 protocol::DictionaryValue* dictionary = DictionaryValue::cast(value);
14 if (!dictionary) { 14 if (!dictionary) {
15 errors->addError("object expected"); 15 errors->addError("object expected");
16 return nullptr; 16 return nullptr;
17 } 17 }
18 dictionary = static_cast<protocol::DictionaryValue*>(dictionary->clone().rel ease()); 18 dictionary = static_cast<protocol::DictionaryValue*>(dictionary->clone().rel ease());
19 return std::unique_ptr<Object>(new Object(std::unique_ptr<DictionaryValue>(d ictionary))); 19 return std::unique_ptr<Object>(new Object(std::unique_ptr<DictionaryValue>(d ictionary)));
20 } 20 }
21 21
22 std::unique_ptr<protocol::DictionaryValue> Object::serialize() const 22 std::unique_ptr<protocol::DictionaryValue> Object::toValue() const
23 { 23 {
24 return DictionaryValue::cast(m_object->clone()); 24 return DictionaryValue::cast(m_object->clone());
25 } 25 }
26 26
27 std::unique_ptr<Object> Object::clone() const 27 std::unique_ptr<Object> Object::clone() const
28 { 28 {
29 return std::unique_ptr<Object>(new Object(DictionaryValue::cast(m_object->cl one()))); 29 return std::unique_ptr<Object>(new Object(DictionaryValue::cast(m_object->cl one())));
30 } 30 }
31 31
32 Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std ::move(object)) { } 32 Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std ::move(object)) { }
33 33
34 Object::~Object() { } 34 Object::~Object() { }
35 35
36 {% for namespace in config.protocol.namespace %} 36 {% for namespace in config.protocol.namespace %}
37 } // namespace {{namespace}} 37 } // namespace {{namespace}}
38 {% endfor %} 38 {% endfor %}
OLDNEW
« no previous file with comments | « third_party/inspector_protocol/lib/Maybe_h.template ('k') | third_party/inspector_protocol/lib/Object_h.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698