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

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

Issue 2159633002: [DevTools] Generate public versions of protocol classes to be exposed in v8_inspector/public. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: removed extra files Created 4 years, 4 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
(Empty)
1 // This file is generated
2
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
5 // found in the LICENSE file.
6
7 #ifndef protocol_{{domain.domain}}_imported_h
8 #define protocol_{{domain.domain}}_imported_h
9
10 #include "platform/inspector_protocol/ErrorSupport.h"
11 #include "platform/inspector_protocol/ValueConversions.h"
12 #include "platform/inspector_protocol/Values.h"
13 #include "{{include_package}}/{{domain.domain}}.h"
14
15 namespace blink {
16 namespace protocol {
17 {% for type in domain.types %}
18 {% if not (type.type == "object") or not ("properties" in type) or not (type .exported) %}{% continue %}{% endif %}
19
20 template<>
21 struct ValueConversions<{{domain.domain}}::API::{{type.id}}> {
22 static std::unique_ptr<{{domain.domain}}::API::{{type.id}}> parse(protocol:: Value* value, ErrorSupport* errors)
23 {
24 if (!value) {
25 errors->addError("value expected");
26 return nullptr;
27 }
28 std::unique_ptr<{{domain.domain}}::API::{{type.id}}> result = {{domain.d omain}}::API::{{type.id}}::fromJSONString(value->toJSONString());
29 if (!result)
30 errors->addError("cannot parse");
31 return result;
32 }
33
34 static std::unique_ptr<protocol::Value> serialize({{domain.domain}}::API::{{ type.id}}* value)
35 {
36 return SerializedValue::create(value->toJSONString());
37 }
38
39 static std::unique_ptr<protocol::Value> serialize(const std::unique_ptr<{{do main.domain}}::API::{{type.id}}>& value)
40 {
41 return SerializedValue::create(value->toJSONString());
42 }
43 };
44 {% endfor %}
45
46 } // namespace protocol
47 } // namespace blink
48
49 #endif // !defined(protocol_{{domain.domain}}_imported_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698