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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/Imported_h.template

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile Created 4 years, 3 months 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 // This file is generated 1 // This file is generated
2 2
3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 3 // Copyright (c) 2016 The Chromium Authors. All rights reserved.
4 // Use of this source code is governed by a BSD-style license that can be 4 // Use of this source code is governed by a BSD-style license that can be
5 // found in the LICENSE file. 5 // found in the LICENSE file.
6 6
7 #ifndef protocol_{{domain.domain}}_imported_h 7 #ifndef {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h
8 #define protocol_{{domain.domain}}_imported_h 8 #define {{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imported_h
9 9
10 #include "{{config.lib_package}}/InspectorProtocol.h" 10 #include "{{config.protocol.package}}/Protocol.h"
11 #include "{{config.imported.package}}/{{domain.domain}}.h" 11 #include "{{config.imported.package}}/{{domain.domain}}.h"
12 12
13 namespace blink { 13 {% for namespace in config.protocol.namespace %}
14 namespace protocol { 14 namespace {{namespace}} {
15 {% endfor %}
15 {% for type in domain.types %} 16 {% for type in domain.types %}
16 {% if not (type.type == "object") or not ("properties" in type) or not (type .exported) %}{% continue %}{% endif %} 17 {% if not (type.type == "object") or not ("properties" in type) or not (type .exported) %}{% continue %}{% endif %}
17 18
18 template<> 19 template<>
19 struct ValueConversions<{{domain.domain}}::API::{{type.id}}> { 20 struct ValueConversions<{{"::".join(config.imported.namespace)}}::{{domain.domai n}}::API::{{type.id}}> {
20 static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol:: Value* value, ErrorSupport* errors) 21 static std::unique_ptr<{{"::".join(config.imported.namespace)}}::{{domain.do main}}::API::{{type.id}}> parse(protocol::Value* value, ErrorSupport* errors)
21 { 22 {
22 if (!value) { 23 if (!value) {
23 errors->addError("value expected"); 24 errors->addError("value expected");
24 return nullptr; 25 return nullptr;
25 } 26 }
26 std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.d omain}}::API::{{type.id}}::fromJSONString(value->toJSONString()); 27 String json = value->toJSONString();
28 auto result = {{"::".join(config.imported.namespace)}}::{{domain.domain} }::API::{{type.id}}::fromJSONString({{config.imported.to_imported_string % "json "}});
27 if (!result) 29 if (!result)
28 errors->addError("cannot parse"); 30 errors->addError("cannot parse");
29 return result; 31 return result;
30 } 32 }
31 33
32 static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{ type.id}}* value) 34 static std::unique_ptr<protocol::Value> serialize(const {{"::".join(config.i mported.namespace)}}::{{domain.domain}}::API::{{type.id}}* value)
33 { 35 {
34 return SerializedValue::create(value->toJSONString()); 36 auto json = value->toJSONString();
37 return SerializedValue::create({{config.imported.from_imported_string % "std::move(json)"}});
35 } 38 }
36 39
37 static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{do main.domain}}::API::{{type.id}}>& value) 40 static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{": :".join(config.imported.namespace)}}::{{domain.domain}}::API::{{type.id}}>& valu e)
38 { 41 {
39 return SerializedValue::create(value->toJSONString()); 42 return serialize(value.get());
40 } 43 }
41 }; 44 };
42 {% endfor %} 45 {% endfor %}
43 46
44 } // namespace protocol 47 {% for namespace in config.protocol.namespace %}
45 } // namespace blink 48 } // namespace {{namespace}}
49 {% endfor %}
46 50
47 #endif // !defined(protocol_{{domain.domain}}_imported_h) 51 #endif // !defined({{"_".join(config.protocol.namespace)}}_{{domain.domain}}_imp orted_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698