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

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

Issue 2008183002: DevTools: generate frontend and backend interfaces under domains. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comment addressed Created 4 years, 7 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 {{class_name}}_h 7 #ifndef {{class_name}}_h
8 #define {{class_name}}_h 8 #define {{class_name}}_h
9 9
10 #include "platform/inspector_protocol/BackendCallback.h"
11 #include "platform/inspector_protocol/ErrorSupport.h"
10 #include "platform/inspector_protocol/TypeBuilder.h" 12 #include "platform/inspector_protocol/TypeBuilder.h"
11 13
12 namespace blink { 14 namespace blink {
13 namespace protocol { 15 namespace protocol {
14 16
15 class FrontendChannel; 17 {% for domain in api.domains %}
16 class BackendImplWeakPtr; 18
19 namespace {{domain.domain}} {
17 20
18 class PLATFORM_EXPORT Backend { 21 class PLATFORM_EXPORT Backend {
19 public: 22 public:
20 class PLATFORM_EXPORT CallbackBase {
21 public:
22 virtual ~CallbackBase() { }
23 virtual void sendFailure(const ErrorString&) = 0;
24 };
25 {% for domain in api.domains %}
26
27 class PLATFORM_EXPORT {{domain.domain}} {
28 public:
29 {% for command in domain.commands %} 23 {% for command in domain.commands %}
30 {% if "redirect" in command %}{% continue %}{% endif %} 24 {% if "redirect" in command %}{% continue %}{% endif %}
31 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %} 25 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %}
32 {% if "async" in command %} 26 {% if "async" in command %}
33 class PLATFORM_EXPORT {{command.name | to_title_case}}Callback : public CallbackBase { 27 class PLATFORM_EXPORT {{command.name | to_title_case}}Callback : public Back endCallback {
34 public: 28 public:
35 virtual void sendSuccess( 29 virtual void sendSuccess(
36 {%- for parameter in command.returns -%} 30 {%- for parameter in command.returns -%}
37 {%- if "optional" in parameter -%} 31 {%- if "optional" in parameter -%}
38 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.n ame}} 32 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name} }
39 {%- else -%} 33 {%- else -%}
40 {{resolve_type(parameter).pass_type}} {{parameter.name}} 34 {{resolve_type(parameter).pass_type}} {{parameter.name}}
41 {%- endif -%} 35 {%- endif -%}
42 {%- if not loop.last -%}, {% endif -%} 36 {%- if not loop.last -%}, {% endif -%}
43 {%- endfor -%} 37 {%- endfor -%}
44 ) = 0; 38 ) = 0;
45 }; 39 };
46 {% endif %} 40 {% endif %}
47 virtual void {{command.name}}(ErrorString* 41 virtual void {{command.name}}(ErrorString*
48 {%- for parameter in command.parameters -%} 42 {%- for parameter in command.parameters -%}
49 {%- if "optional" in parameter -%} 43 {%- if "optional" in parameter -%}
50 , const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter. name}} 44 , const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter.name }}
51 {%- else -%} 45 {%- else -%}
52 , {{resolve_type(parameter).pass_type}} in_{{parameter.name}} 46 , {{resolve_type(parameter).pass_type}} in_{{parameter.name}}
53 {%- endif -%} 47 {%- endif -%}
54 {%- endfor -%} 48 {%- endfor -%}
55 {%- if "async" in command -%} 49 {%- if "async" in command -%}
56 , std::unique_ptr<{{command.name | to_title_case}}Callback> callback 50 , std::unique_ptr<{{command.name | to_title_case}}Callback> callback
57 {%- else -%} 51 {%- else -%}
58 {%- for parameter in command.returns -%} 52 {%- for parameter in command.returns -%}
59 {%- if "optional" in parameter -%} 53 {%- if "optional" in parameter -%}
60 , Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name} } 54 , Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name}}
61 {%- else -%} 55 {%- else -%}
62 , {{resolve_type(parameter).type}}* out_{{parameter.name}} 56 , {{resolve_type(parameter).type}}* out_{{parameter.name}}
63 {%- endif -%} 57 {%- endif -%}
64 {%- endfor -%} 58 {%- endfor -%}
65 {%- endif -%} 59 {%- endif -%}
66 ) = 0; 60 ) = 0;
67 {% endfor %} 61 {% endfor %}
68 62
69 protected: 63 protected:
70 virtual ~{{domain.domain}}() { } 64 virtual ~Backend() { }
71 }; 65 };
66
67 } // namespace {{domain.domain}}
68
72 {% endfor %} 69 {% endfor %}
73 };
74 70
75 } // namespace protocol 71 } // namespace protocol
76 } // namespace blink 72 } // namespace blink
77 73
78 #endif // !defined({{class_name}}_h) 74 #endif // !defined({{class_name}}_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698