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

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

Issue 1810843002: DevTools: split protocol Dispatcher into Backend interface and the dispatcher itself. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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/Backend.h"
10 #include "platform/inspector_protocol/TypeBuilder.h" 11 #include "platform/inspector_protocol/TypeBuilder.h"
11 12
12 namespace blink { 13 namespace blink {
13 namespace protocol { 14 namespace protocol {
14 15
15 class FrontendChannel; 16 class FrontendChannel;
16 class DispatcherImplWeakPtr; 17 class DispatcherImplWeakPtr;
17 18
18 class PLATFORM_EXPORT Dispatcher { 19 class PLATFORM_EXPORT Dispatcher {
19 public: 20 public:
(...skipping 10 matching lines...) Expand all
30 protected: 31 protected:
31 void sendIfActive(PassOwnPtr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError); 32 void sendIfActive(PassOwnPtr<protocol::DictionaryValue> partialMessage, const ErrorString& invocationError);
32 33
33 private: 34 private:
34 OwnPtr<DispatcherImplWeakPtr> m_backendImpl; 35 OwnPtr<DispatcherImplWeakPtr> m_backendImpl;
35 int m_sessionId; 36 int m_sessionId;
36 int m_id; 37 int m_id;
37 }; 38 };
38 39
39 {% for domain in api.domains %} 40 {% for domain in api.domains %}
40 class PLATFORM_EXPORT {{domain.domain}}CommandHandler { 41 virtual void registerAgent(blink::protocol::Backend::{{domain.domain}}*) = 0 ;
41 public:
42 {% for command in domain.commands %}
43 {% if "redirect" in command %}{% continue %}{% endif %}
44 {% if ("handlers" in command) and not ("renderer" in command["handlers"]) %} {% continue %}{% endif %}
45 {% if "async" in command %}
46 class PLATFORM_EXPORT {{command.name | to_title_case}}Callback : public CallbackBase {
47 public:
48 {{command.name | to_title_case}}Callback(PassOwnPtr<DispatcherImplWe akPtr>, int sessionId, int id);
49 void sendSuccess(
50 {%- for parameter in command.returns -%}
51 {%- if "optional" in parameter -%}
52 const Maybe<{{resolve_type(parameter).raw_type}}>& {{parameter.n ame}}
53 {%- else -%}
54 {{resolve_type(parameter).pass_type}} {{parameter.name}}
55 {%- endif -%}
56 {%- if not loop.last -%}, {% endif -%}
57 {%- endfor -%}
58 );
59 };
60 {% endif %}
61 virtual void {{command.name}}(ErrorString*
62 {%- for parameter in command.parameters -%}
63 {%- if "optional" in parameter -%}
64 , const Maybe<{{resolve_type(parameter).raw_type}}>& in_{{parameter. name}}
65 {%- else -%}
66 , {{resolve_type(parameter).pass_type}} in_{{parameter.name}}
67 {%- endif -%}
68 {%- endfor -%}
69 {%- if "async" in command -%}
70 , PassOwnPtr<{{command.name | to_title_case}}Callback> callback
71 {%- else -%}
72 {%- for parameter in command.returns -%}
73 {%- if "optional" in parameter -%}
74 , Maybe<{{resolve_type(parameter).raw_type}}>* out_{{parameter.name} }
75 {%- else -%}
76 , {{resolve_type(parameter).type}}* out_{{parameter.name}}
77 {%- endif -%}
78 {%- endfor -%}
79 {%- endif -%}
80 ) = 0;
81 {% endfor %}
82
83 protected:
84 virtual ~{{domain.domain}}CommandHandler() { }
85 };
86 {% endfor %}
87
88 {% for domain in api.domains %}
89 virtual void registerAgent({{domain.domain | to_title_case}}CommandHandler*) = 0;
90 {% endfor %} 42 {% endfor %}
91 43
92 virtual void clearFrontend() = 0; 44 virtual void clearFrontend() = 0;
93 45
94 enum CommonErrorCode { 46 enum CommonErrorCode {
95 ParseError = 0, 47 ParseError = 0,
96 InvalidRequest, 48 InvalidRequest,
97 MethodNotFound, 49 MethodNotFound,
98 InvalidParams, 50 InvalidParams,
99 InternalError, 51 InternalError,
100 ServerError, 52 ServerError,
101 LastEntry, 53 LastEntry,
102 }; 54 };
103 55
104 void reportProtocolError(int sessionId, int callId, CommonErrorCode, const S tring16& errorMessage) const; 56 void reportProtocolError(int sessionId, int callId, CommonErrorCode, const S tring16& errorMessage) const;
105 virtual void reportProtocolError(int sessionId, int callId, CommonErrorCode, const String16& errorMessage, ErrorSupport*) const = 0; 57 virtual void reportProtocolError(int sessionId, int callId, CommonErrorCode, const String16& errorMessage, ErrorSupport*) const = 0;
106 virtual void dispatch(int sessionId, const String16& message) = 0; 58 virtual void dispatch(int sessionId, const String16& message) = 0;
107 static bool getCommandName(const String16& message, String16* result); 59 static bool getCommandName(const String16& message, String16* result);
108 }; 60 };
109 61
110 } // namespace protocol 62 } // namespace protocol
111 } // namespace blink 63 } // namespace blink
112 64
113 #endif // !defined({{class_name}}_h) 65 #endif // !defined({{class_name}}_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698