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