| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 } | 269 } |
| 270 | 270 |
| 271 protocol::Value* methodValue = messageObject->get("method"); | 271 protocol::Value* methodValue = messageObject->get("method"); |
| 272 String method; | 272 String method; |
| 273 success = methodValue && methodValue->asString(&method); | 273 success = methodValue && methodValue->asString(&method); |
| 274 if (!success) { | 274 if (!success) { |
| 275 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kInva
lidRequest, "Message must have string 'method' porperty", nullptr); | 275 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kInva
lidRequest, "Message must have string 'method' porperty", nullptr); |
| 276 return DispatchResponse::kError; | 276 return DispatchResponse::kError; |
| 277 } | 277 } |
| 278 | 278 |
| 279 size_t dotIndex = method.find("."); | 279 size_t dotIndex = StringUtil::find(method, "."); |
| 280 if (dotIndex == StringUtil::kNotFound) { | 280 if (dotIndex == StringUtil::kNotFound) { |
| 281 if (m_fallThroughForNotFound) | 281 if (m_fallThroughForNotFound) |
| 282 return DispatchResponse::kFallThrough; | 282 return DispatchResponse::kFallThrough; |
| 283 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kMeth
odNotFound, "'" + method + "' wasn't found", nullptr); | 283 reportProtocolErrorTo(m_frontendChannel, callId, DispatchResponse::kMeth
odNotFound, "'" + method + "' wasn't found", nullptr); |
| 284 return DispatchResponse::kError; | 284 return DispatchResponse::kError; |
| 285 } | 285 } |
| 286 String domain = StringUtil::substring(method, 0, dotIndex); | 286 String domain = StringUtil::substring(method, 0, dotIndex); |
| 287 auto it = m_dispatchers.find(domain); | 287 auto it = m_dispatchers.find(domain); |
| 288 if (it == m_dispatchers.end()) { | 288 if (it == m_dispatchers.end()) { |
| 289 if (m_fallThroughForNotFound) | 289 if (m_fallThroughForNotFound) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 325 InternalResponse::InternalResponse(int callId, const String& notification, std::
unique_ptr<Serializable> params) | 325 InternalResponse::InternalResponse(int callId, const String& notification, std::
unique_ptr<Serializable> params) |
| 326 : m_callId(callId) | 326 : m_callId(callId) |
| 327 , m_notification(notification) | 327 , m_notification(notification) |
| 328 , m_params(params ? std::move(params) : nullptr) | 328 , m_params(params ? std::move(params) : nullptr) |
| 329 { | 329 { |
| 330 } | 330 } |
| 331 | 331 |
| 332 {% for namespace in config.protocol.namespace %} | 332 {% for namespace in config.protocol.namespace %} |
| 333 } // namespace {{namespace}} | 333 } // namespace {{namespace}} |
| 334 {% endfor %} | 334 {% endfor %} |
| OLD | NEW |