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

Side by Side Diff: third_party/WebKit/Source/platform/inspector_protocol/Dispatcher_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 #include "platform/inspector_protocol/TypeBuilder.h" 10 #include "platform/inspector_protocol/TypeBuilder.h"
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
48 {% for command in domain.commands %} 48 {% for command in domain.commands %}
49 {% if "redirect" in command %}{% continue %}{% endif %} 49 {% if "redirect" in command %}{% continue %}{% endif %}
50 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %} 50 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %}
51 {% if "async" in command %} 51 {% if "async" in command %}
52 class PLATFORM_EXPORT {{command.name | to_title_case}}Callback : public CallbackBase { 52 class PLATFORM_EXPORT {{command.name | to_title_case}}Callback : public CallbackBase {
53 public: 53 public:
54 {{command.name | to_title_case}}Callback(PassRefPtr<DispatcherImpl>, int sessionId, int id); 54 {{command.name | to_title_case}}Callback(PassRefPtr<DispatcherImpl>, int sessionId, int id);
55 void sendSuccess( 55 void sendSuccess(
56 {%- for parameter in command.returns -%} 56 {%- for parameter in command.returns -%}
57 {%- if "optional" in parameter -%} 57 {%- if "optional" in parameter -%}
58 {{resolve_type(parameter).optional_pass_type}} {{parameter.name} } 58 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.n ame}}
59 {%- else -%} 59 {%- else -%}
60 {{resolve_type(parameter).pass_type}} {{parameter.name}} 60 {{resolve_type(parameter).pass_type}} {{parameter.name}}
61 {%- endif -%} 61 {%- endif -%}
62 {%- if not loop.last -%}, {% endif -%} 62 {%- if not loop.last -%}, {% endif -%}
63 {%- endfor -%} 63 {%- endfor -%}
64 ); 64 );
65 }; 65 };
66 {% endif %} 66 {% endif %}
67 virtual void {{command.name}}(ErrorString* 67 virtual void {{command.name}}(ErrorString*
68 {%- for parameter in command.parameters -%} 68 {%- for parameter in command.parameters -%}
69 {%- if "optional" in parameter -%} 69 {%- if "optional" in parameter -%}
70 , {{resolve_type(parameter).optional_pass_type}} in_{{parameter.name }} 70 , const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter. name}}
71 {%- else -%} 71 {%- else -%}
72 , {{resolve_type(parameter).pass_type}} in_{{parameter.name}} 72 , {{resolve_type(parameter).pass_type}} in_{{parameter.name}}
73 {%- endif -%} 73 {%- endif -%}
74 {%- endfor -%} 74 {%- endfor -%}
75 {%- if "async" in command -%} 75 {%- if "async" in command -%}
76 , PassRefPtr<{{command.name | to_title_case}}Callback> callback 76 , PassRefPtr<{{command.name | to_title_case}}Callback> callback
77 {%- else -%} 77 {%- else -%}
78 {%- for parameter in command.returns -%} 78 {%- for parameter in command.returns -%}
79 {%- if "optional" in parameter -%} 79 {%- if "optional" in parameter -%}
80 , {{resolve_type(parameter).optional_type}}* out_{{parameter.name}} 80 , Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name} }
81 {%- else -%} 81 {%- else -%}
82 , {{resolve_type(parameter).type}}* out_{{parameter.name}} 82 , {{resolve_type(parameter).type}}* out_{{parameter.name}}
83 {%- endif -%} 83 {%- endif -%}
84 {%- endfor -%} 84 {%- endfor -%}
85 {%- endif -%} 85 {%- endif -%}
86 ) = 0; 86 ) = 0;
87 {% endfor %} 87 {% endfor %}
88 88
89 protected: 89 protected:
90 virtual ~{{domain.domain}}CommandHandler() { } 90 virtual ~{{domain.domain}}CommandHandler() { }
(...skipping 21 matching lines...) Expand all
112 virtual void dispatch(int sessionId, const String& message) = 0; 112 virtual void dispatch(int sessionId, const String& message) = 0;
113 static bool getCommandName(const String& message, String* result); 113 static bool getCommandName(const String& message, String* result);
114 }; 114 };
115 115
116 } // namespace protocol 116 } // namespace protocol
117 } // namespace blink 117 } // namespace blink
118 118
119 using blink::protocol::ErrorString; 119 using blink::protocol::ErrorString;
120 120
121 #endif // !defined({{class_name}}_h) 121 #endif // !defined({{class_name}}_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698