| OLD | NEW |
| 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 {{"_".join(config.protocol.namespace)}}_DispatcherBase_h | 5 #ifndef {{"_".join(config.protocol.namespace)}}_DispatcherBase_h |
| 6 #define {{"_".join(config.protocol.namespace)}}_DispatcherBase_h | 6 #define {{"_".join(config.protocol.namespace)}}_DispatcherBase_h |
| 7 | 7 |
| 8 //#include "Collections.h" | 8 //#include "Collections.h" |
| 9 //#include "ErrorSupport.h" | 9 //#include "ErrorSupport.h" |
| 10 //#include "Forward.h" | 10 //#include "Forward.h" |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 protocol::HashSet<WeakPtr*> m_weakPtrs; | 106 protocol::HashSet<WeakPtr*> m_weakPtrs; |
| 107 int m_lastCallbackId; | 107 int m_lastCallbackId; |
| 108 bool m_lastCallbackFallThrough; | 108 bool m_lastCallbackFallThrough; |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 class {{config.lib.export_macro}} UberDispatcher { | 111 class {{config.lib.export_macro}} UberDispatcher { |
| 112 PROTOCOL_DISALLOW_COPY(UberDispatcher); | 112 PROTOCOL_DISALLOW_COPY(UberDispatcher); |
| 113 public: | 113 public: |
| 114 explicit UberDispatcher(FrontendChannel*); | 114 explicit UberDispatcher(FrontendChannel*); |
| 115 void registerBackend(const String& name, std::unique_ptr<protocol::Dispatche
rBase>); | 115 void registerBackend(const String& name, std::unique_ptr<protocol::Dispatche
rBase>); |
| 116 DispatchResponse::Status dispatch(std::unique_ptr<Value> message); | 116 void setupRedirects(const HashMap<String, String>&); |
| 117 DispatchResponse::Status dispatch(std::unique_ptr<Value> message, int* callI
d = nullptr, String* method = nullptr); |
| 117 FrontendChannel* channel() { return m_frontendChannel; } | 118 FrontendChannel* channel() { return m_frontendChannel; } |
| 118 bool fallThroughForNotFound() { return m_fallThroughForNotFound; } | 119 bool fallThroughForNotFound() { return m_fallThroughForNotFound; } |
| 119 void setFallThroughForNotFound(bool); | 120 void setFallThroughForNotFound(bool); |
| 120 virtual ~UberDispatcher(); | 121 virtual ~UberDispatcher(); |
| 121 | 122 |
| 122 private: | 123 private: |
| 123 FrontendChannel* m_frontendChannel; | 124 FrontendChannel* m_frontendChannel; |
| 124 bool m_fallThroughForNotFound; | 125 bool m_fallThroughForNotFound; |
| 126 HashMap<String, String> m_redirects; |
| 125 protocol::HashMap<String, std::unique_ptr<protocol::DispatcherBase>> m_dispa
tchers; | 127 protocol::HashMap<String, std::unique_ptr<protocol::DispatcherBase>> m_dispa
tchers; |
| 126 }; | 128 }; |
| 127 | 129 |
| 128 class InternalResponse : public Serializable { | 130 class InternalResponse : public Serializable { |
| 129 PROTOCOL_DISALLOW_COPY(InternalResponse); | 131 PROTOCOL_DISALLOW_COPY(InternalResponse); |
| 130 public: | 132 public: |
| 131 static std::unique_ptr<InternalResponse> createResponse(int callId, std::uni
que_ptr<Serializable> params); | 133 static std::unique_ptr<InternalResponse> createResponse(int callId, std::uni
que_ptr<Serializable> params); |
| 132 static std::unique_ptr<InternalResponse> createNotification(const String& no
tification, std::unique_ptr<Serializable> params = nullptr); | 134 static std::unique_ptr<InternalResponse> createNotification(const String& no
tification, std::unique_ptr<Serializable> params = nullptr); |
| 133 | 135 |
| 134 String serialize() override; | 136 String serialize() override; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 163 } | 165 } |
| 164 | 166 |
| 165 String m_notification; | 167 String m_notification; |
| 166 }; | 168 }; |
| 167 | 169 |
| 168 {% for namespace in config.protocol.namespace %} | 170 {% for namespace in config.protocol.namespace %} |
| 169 } // namespace {{namespace}} | 171 } // namespace {{namespace}} |
| 170 {% endfor %} | 172 {% endfor %} |
| 171 | 173 |
| 172 #endif // !defined({{"_".join(config.protocol.namespace)}}_DispatcherBase_h) | 174 #endif // !defined({{"_".join(config.protocol.namespace)}}_DispatcherBase_h) |
| OLD | NEW |