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

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

Issue 1730383003: DevTools: consistently use Maybe for optional values in the protocol generator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 9 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 10
(...skipping 14 matching lines...) Expand all
25 25
26 class PLATFORM_EXPORT {{domain.domain}} { 26 class PLATFORM_EXPORT {{domain.domain}} {
27 public: 27 public:
28 static {{domain.domain}}* from(Frontend* frontend) { return &(frontend-> m_{{domain.domain | lower}}) ;} 28 static {{domain.domain}}* from(Frontend* frontend) { return &(frontend-> m_{{domain.domain | lower}}) ;}
29 {{domain.domain}}(FrontendChannel* frontendChannel) : m_frontendChannel( frontendChannel) { } 29 {{domain.domain}}(FrontendChannel* frontendChannel) : m_frontendChannel( frontendChannel) { }
30 {% for event in domain.events %} 30 {% for event in domain.events %}
31 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %} 31 {% if "handlers" in event and not ("renderer" in event["handlers"]) %}{% con tinue %}{% endif %}
32 void {{event.name}}( 32 void {{event.name}}(
33 {%- for parameter in event.parameters -%} 33 {%- for parameter in event.parameters -%}
34 {%- if "optional" in parameter -%} 34 {%- if "optional" in parameter -%}
35 {{resolve_type(parameter).optional_pass_type}} 35 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.name} } = Maybe<{{resolve_type(parameter).raw_type}}>()
36 {%- if resolve_type(parameter).nullable -%}
37 {{parameter.name}} = nullptr
38 {%- else -%}
39 {{parameter.name}} = {{resolve_type(parameter).optional_type}}()
40 {%- endif %}
41 {%- else -%} 36 {%- else -%}
42 {{resolve_type(parameter).pass_type}} {{parameter.name}} 37 {{resolve_type(parameter).pass_type}} {{parameter.name}}
43 {%- endif -%}{%- if not loop.last -%}, {% endif -%} 38 {%- endif -%}{%- if not loop.last -%}, {% endif -%}
44 {%- endfor -%} 39 {%- endfor -%}
45 ); 40 );
46 {% endfor %} 41 {% endfor %}
47 42
48 void flush() { m_frontendChannel->flush(); } 43 void flush() { m_frontendChannel->flush(); }
49 private: 44 private:
50 FrontendChannel* m_frontendChannel; 45 FrontendChannel* m_frontendChannel;
51 }; 46 };
52 {% endfor %} 47 {% endfor %}
53 48
54 private: 49 private:
55 FrontendChannel* m_frontendChannel; 50 FrontendChannel* m_frontendChannel;
56 {% for domain in api.domains %} 51 {% for domain in api.domains %}
57 {{domain.domain}} m_{{domain.domain | lower}}; 52 {{domain.domain}} m_{{domain.domain | lower}};
58 {% endfor %} 53 {% endfor %}
59 }; 54 };
60 55
61 } // namespace protocol 56 } // namespace protocol
62 } // namespace blink 57 } // namespace blink
63 58
64 #endif // !defined({{class_name}}_h) 59 #endif // !defined({{class_name}}_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698