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

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

Issue 2251343003: [DevTools] Generate separate copies of inspector_protocol. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: win compile Created 4 years, 3 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 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DispatcherBase_h 5 #ifndef {{"_".join(config.protocol.namespace)}}_DispatcherBase_h
6 #define DispatcherBase_h 6 #define {{"_".join(config.protocol.namespace)}}_DispatcherBase_h
7 7
8 //#include "BackendCallback.h" 8 //#include "BackendCallback.h"
9 //#include "Collections.h" 9 //#include "Collections.h"
10 //#include "ErrorSupport.h" 10 //#include "ErrorSupport.h"
11 //#include "Platform.h" 11 //#include "Forward.h"
12 //#include "String16.h"
13 //#include "Values.h" 12 //#include "Values.h"
14 #include "{{config.class_export.header}}"
15 13
16 namespace blink { 14 {% for namespace in config.protocol.namespace %}
17 namespace protocol { 15 namespace {{namespace}} {
16 {% endfor %}
18 17
19 class FrontendChannel;
20 class WeakPtr; 18 class WeakPtr;
21 19
22 class {{config.class_export.macro}} DispatcherBase { 20 class {{config.class_export.macro}} DispatcherBase {
23 PROTOCOL_DISALLOW_COPY(DispatcherBase); 21 PROTOCOL_DISALLOW_COPY(DispatcherBase);
24 public: 22 public:
25 static const char kInvalidRequest[]; 23 static const char kInvalidRequest[];
26 class {{config.class_export.macro}} WeakPtr { 24 class {{config.class_export.macro}} WeakPtr {
27 public: 25 public:
28 explicit WeakPtr(DispatcherBase*); 26 explicit WeakPtr(DispatcherBase*);
29 ~WeakPtr(); 27 ~WeakPtr();
(...skipping 23 matching lines...) Expand all
53 51
54 enum CommonErrorCode { 52 enum CommonErrorCode {
55 ParseError = -32700, 53 ParseError = -32700,
56 InvalidRequest = -32600, 54 InvalidRequest = -32600,
57 MethodNotFound = -32601, 55 MethodNotFound = -32601,
58 InvalidParams = -32602, 56 InvalidParams = -32602,
59 InternalError = -32603, 57 InternalError = -32603,
60 ServerError = -32000, 58 ServerError = -32000,
61 }; 59 };
62 60
63 static bool getCommandName(const String16& message, String16* result); 61 static bool getCommandName(const String& message, String* result);
64 62
65 virtual void dispatch(int callId, const String16& method, std::unique_ptr<pr otocol::DictionaryValue> messageObject) = 0; 63 virtual void dispatch(int callId, const String& method, std::unique_ptr<prot ocol::DictionaryValue> messageObject) = 0;
66 64
67 void sendResponse(int callId, const ErrorString&, ErrorSupport*, std::unique _ptr<protocol::DictionaryValue> result); 65 void sendResponse(int callId, const ErrorString&, ErrorSupport*, std::unique _ptr<protocol::DictionaryValue> result);
68 void sendResponse(int callId, const ErrorString&, std::unique_ptr<protocol:: DictionaryValue> result); 66 void sendResponse(int callId, const ErrorString&, std::unique_ptr<protocol:: DictionaryValue> result);
69 void sendResponse(int callId, const ErrorString&); 67 void sendResponse(int callId, const ErrorString&);
70 68
71 void reportProtocolError(int callId, CommonErrorCode, const String16& errorM essage, ErrorSupport* errors); 69 void reportProtocolError(int callId, CommonErrorCode, const String& errorMes sage, ErrorSupport* errors);
72 void clearFrontend(); 70 void clearFrontend();
73 71
74 std::unique_ptr<WeakPtr> weakPtr(); 72 std::unique_ptr<WeakPtr> weakPtr();
75 73
76 private: 74 private:
77 FrontendChannel* m_frontendChannel; 75 FrontendChannel* m_frontendChannel;
78 protocol::HashSet<WeakPtr*> m_weakPtrs; 76 protocol::HashSet<WeakPtr*> m_weakPtrs;
79 }; 77 };
80 78
81 class {{config.class_export.macro}} UberDispatcher { 79 class {{config.class_export.macro}} UberDispatcher {
82 PROTOCOL_DISALLOW_COPY(UberDispatcher); 80 PROTOCOL_DISALLOW_COPY(UberDispatcher);
83 public: 81 public:
84 explicit UberDispatcher(FrontendChannel*); 82 explicit UberDispatcher(FrontendChannel*);
85 void registerBackend(const String16& name, std::unique_ptr<protocol::Dispatc herBase>); 83 void registerBackend(const String& name, std::unique_ptr<protocol::Dispatche rBase>);
86 void dispatch(std::unique_ptr<Value> message); 84 void dispatch(std::unique_ptr<Value> message);
87 FrontendChannel* channel() { return m_frontendChannel; } 85 FrontendChannel* channel() { return m_frontendChannel; }
88 virtual ~UberDispatcher(); 86 virtual ~UberDispatcher();
89 87
90 private: 88 private:
91 FrontendChannel* m_frontendChannel; 89 FrontendChannel* m_frontendChannel;
92 protocol::HashMap<String16, std::unique_ptr<protocol::DispatcherBase>> m_dis patchers; 90 protocol::HashMap<String, std::unique_ptr<protocol::DispatcherBase>> m_dispa tchers;
93 }; 91 };
94 92
95 } // namespace platform 93 {% for namespace in config.protocol.namespace %}
96 } // namespace blink 94 } // namespace {{namespace}}
95 {% endfor %}
97 96
98 #endif // !defined(DispatcherBase_h) 97 #endif // !defined({{"_".join(config.protocol.namespace)}}_DispatcherBase_h)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698