Index: third_party/inspector_protocol/lib/Object_cpp.template |
diff --git a/third_party/inspector_protocol/lib/Object_cpp.template b/third_party/inspector_protocol/lib/Object_cpp.template |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e3f18c3500e2b29422ec6db9f5f332e0e24fb471 |
--- /dev/null |
+++ b/third_party/inspector_protocol/lib/Object_cpp.template |
@@ -0,0 +1,37 @@ |
+// Copyright 2016 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+//#include "Object.h" |
+ |
+{% for namespace in config.protocol.namespace %} |
+namespace {{namespace}} { |
+{% endfor %} |
+ |
+std::unique_ptr<Object> Object::parse(protocol::Value* value, ErrorSupport* errors) |
+{ |
+ protocol::DictionaryValue* object = DictionaryValue::cast(value); |
+ if (!object) { |
+ errors->addError("object expected"); |
+ return nullptr; |
+ } |
+ return wrapUnique(new Object(wrapUnique(static_cast<DictionaryValue*>(object->clone().release())))); |
+} |
+ |
+std::unique_ptr<protocol::DictionaryValue> Object::serialize() const |
+{ |
+ return DictionaryValue::cast(m_object->clone()); |
+} |
+ |
+std::unique_ptr<Object> Object::clone() const |
+{ |
+ return wrapUnique(new Object(DictionaryValue::cast(m_object->clone()))); |
+} |
+ |
+Object::Object(std::unique_ptr<protocol::DictionaryValue> object) : m_object(std::move(object)) { } |
+ |
+Object::~Object() { } |
+ |
+{% for namespace in config.protocol.namespace %} |
+} // namespace {{namespace}} |
+{% endfor %} |