OLD | NEW |
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 namespace blink { | 5 //#include "Object.h" |
6 namespace protocol { | 6 |
| 7 {% for namespace in config.protocol.namespace %} |
| 8 namespace {{namespace}} { |
| 9 {% endfor %} |
7 | 10 |
8 std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* erro
rs) | 11 std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* erro
rs) |
9 { | 12 { |
10 protocol::DictionaryValue* object = DictionaryValue::cast(value); | 13 protocol::DictionaryValue* object = DictionaryValue::cast(value); |
11 if (!object) { | 14 if (!object) { |
12 errors->addError("object expected"); | 15 errors->addError("object expected"); |
13 return nullptr; | 16 return nullptr; |
14 } | 17 } |
15 return wrapUnique(new Object(wrapUnique(static_cast<DictionaryValue*>(object
->clone().release())))); | 18 return wrapUnique(new Object(wrapUnique(static_cast<DictionaryValue*>(object
->clone().release())))); |
16 } | 19 } |
17 | 20 |
18 std::unique_ptr<protocol::DictionaryValue> Object::serialize() const | 21 std::unique_ptr<protocol::DictionaryValue> Object::serialize() const |
19 { | 22 { |
20 return DictionaryValue::cast(m_object->clone()); | 23 return DictionaryValue::cast(m_object->clone()); |
21 } | 24 } |
22 | 25 |
23 std::unique_ptr<Object> Object::clone() const | 26 std::unique_ptr<Object> Object::clone() const |
24 { | 27 { |
25 return wrapUnique(new Object(DictionaryValue::cast(m_object->clone()))); | 28 return wrapUnique(new Object(DictionaryValue::cast(m_object->clone()))); |
26 } | 29 } |
27 | 30 |
28 Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std
::move(object)) { } | 31 Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std
::move(object)) { } |
29 | 32 |
30 Object::~Object() { } | 33 Object::~Object() { } |
31 | 34 |
32 } // namespace protocol | 35 {% for namespace in config.protocol.namespace %} |
33 } // namespace blink | 36 } // namespace {{namespace}} |
| 37 {% endfor %} |
OLD | NEW |