| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 : m_frontendChannel(frontendChannel) { } | 81 : m_frontendChannel(frontendChannel) { } |
| 82 | 82 |
| 83 DispatcherBase::~DispatcherBase() | 83 DispatcherBase::~DispatcherBase() |
| 84 { | 84 { |
| 85 clearFrontend(); | 85 clearFrontend(); |
| 86 } | 86 } |
| 87 | 87 |
| 88 // static | 88 // static |
| 89 bool DispatcherBase::getCommandName(const String& message, String* result) | 89 bool DispatcherBase::getCommandName(const String& message, String* result) |
| 90 { | 90 { |
| 91 std::unique_ptr<protocol::Value> value = parseJSON(message); | 91 std::unique_ptr<protocol::Value> value = StringUtil::parseJSON(message); |
| 92 if (!value) | 92 if (!value) |
| 93 return false; | 93 return false; |
| 94 | 94 |
| 95 protocol::DictionaryValue* object = DictionaryValue::cast(value.get()); | 95 protocol::DictionaryValue* object = DictionaryValue::cast(value.get()); |
| 96 if (!object) | 96 if (!object) |
| 97 return false; | 97 return false; |
| 98 | 98 |
| 99 if (!object->getString("method", result)) | 99 if (!object->getString("method", result)) |
| 100 return false; | 100 return false; |
| 101 | 101 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 return DispatchResponse::kError; | 216 return DispatchResponse::kError; |
| 217 } | 217 } |
| 218 return it->second->dispatch(callId, method, std::move(messageObject)); | 218 return it->second->dispatch(callId, method, std::move(messageObject)); |
| 219 } | 219 } |
| 220 | 220 |
| 221 UberDispatcher::~UberDispatcher() = default; | 221 UberDispatcher::~UberDispatcher() = default; |
| 222 | 222 |
| 223 {% for namespace in config.protocol.namespace %} | 223 {% for namespace in config.protocol.namespace %} |
| 224 } // namespace {{namespace}} | 224 } // namespace {{namespace}} |
| 225 {% endfor %} | 225 {% endfor %} |
| OLD | NEW |