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 //#include "DispatcherBase.h" | 5 //#include "DispatcherBase.h" |
6 //#include "Parser.h" | 6 //#include "Parser.h" |
7 | 7 |
8 {% for namespace in config.protocol.namespace %} | 8 {% for namespace in config.protocol.namespace %} |
9 namespace {{namespace}} { | 9 namespace {{namespace}} { |
10 {% endfor %} | 10 {% endfor %} |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 *outMethod = method; | 283 *outMethod = method; |
284 if (!success) { | 284 if (!success) { |
285 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kInva
lidRequest, "Message must have string 'method' porperty", nullptr); | 285 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kInva
lidRequest, "Message must have string 'method' porperty", nullptr); |
286 return DispatchResponse::kError; | 286 return DispatchResponse::kError; |
287 } | 287 } |
288 | 288 |
289 HashMap<String, String>::iterator redirectIt = m_redirects.find(method); | 289 HashMap<String, String>::iterator redirectIt = m_redirects.find(method); |
290 if (redirectIt != m_redirects.end()) | 290 if (redirectIt != m_redirects.end()) |
291 method = redirectIt->second; | 291 method = redirectIt->second; |
292 | 292 |
293 size_t dotIndex = method.find("."); | 293 size_t dotIndex = StringUtil::find(method, "."); |
294 if (dotIndex == StringUtil::kNotFound) { | 294 if (dotIndex == StringUtil::kNotFound) { |
295 if (m_fallThroughForNotFound) | 295 if (m_fallThroughForNotFound) |
296 return DispatchResponse::kFallThrough; | 296 return DispatchResponse::kFallThrough; |
297 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kMeth
odNotFound, "'" + method + "' wasn't found", nullptr); | 297 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kMeth
odNotFound, "'" + method + "' wasn't found", nullptr); |
298 return DispatchResponse::kError; | 298 return DispatchResponse::kError; |
299 } | 299 } |
300 String domain = StringUtil::substring(method, 0, dotIndex); | 300 String domain = StringUtil::substring(method, 0, dotIndex); |
301 auto it = m_dispatchers.find(domain); | 301 auto it = m_dispatchers.find(domain); |
302 if (it == m_dispatchers.end()) { | 302 if (it == m_dispatchers.end()) { |
303 if (m_fallThroughForNotFound) | 303 if (m_fallThroughForNotFound) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 InternalResponse::InternalResponse(int callId, const String& notification, std::
unique_ptr<Serializable> params) | 339 InternalResponse::InternalResponse(int callId, const String& notification, std::
unique_ptr<Serializable> params) |
340 : m_callId(callId) | 340 : m_callId(callId) |
341 , m_notification(notification) | 341 , m_notification(notification) |
342 , m_params(params ? std::move(params) : nullptr) | 342 , m_params(params ? std::move(params) : nullptr) |
343 { | 343 { |
344 } | 344 } |
345 | 345 |
346 {% for namespace in config.protocol.namespace %} | 346 {% for namespace in config.protocol.namespace %} |
347 } // namespace {{namespace}} | 347 } // namespace {{namespace}} |
348 {% endfor %} | 348 {% endfor %} |
OLD | NEW |