| OLD | NEW | 
|    1 // This file is generated |    1 // This file is generated | 
|    2  |    2  | 
|    3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |    3 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 
|    4 // Use of this source code is governed by a BSD-style license that can be |    4 // Use of this source code is governed by a BSD-style license that can be | 
|    5 // found in the LICENSE file. |    5 // found in the LICENSE file. | 
|    6  |    6  | 
|    7 #include "{{config.protocol.package}}/{{domain.domain}}.h" |    7 #include "{{config.protocol.package}}/{{domain.domain}}.h" | 
|    8  |    8  | 
|    9 #include "{{config.protocol.package}}/Protocol.h" |    9 #include "{{config.protocol.package}}/Protocol.h" | 
|   10  |   10  | 
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   99 {{config.exported.string_out}} {{type.id}}::toJSONString() const |   99 {{config.exported.string_out}} {{type.id}}::toJSONString() const | 
|  100 { |  100 { | 
|  101     String json = serialize()->toJSONString(); |  101     String json = serialize()->toJSONString(); | 
|  102     return {{config.exported.to_string_out % "json"}}; |  102     return {{config.exported.to_string_out % "json"}}; | 
|  103 } |  103 } | 
|  104  |  104  | 
|  105 // static |  105 // static | 
|  106 std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromJSONString(const {{confi
     g.exported.string_in}}& json) |  106 std::unique_ptr<API::{{type.id}}> API::{{type.id}}::fromJSONString(const {{confi
     g.exported.string_in}}& json) | 
|  107 { |  107 { | 
|  108     ErrorSupport errors; |  108     ErrorSupport errors; | 
|  109     std::unique_ptr<Value> value = parseJSON(json); |  109     std::unique_ptr<Value> value = StringUtil::parseJSON(json); | 
|  110     if (!value) |  110     if (!value) | 
|  111         return nullptr; |  111         return nullptr; | 
|  112     return protocol::{{domain.domain}}::{{type.id}}::parse(value.get(), &errors)
     ; |  112     return protocol::{{domain.domain}}::{{type.id}}::parse(value.get(), &errors)
     ; | 
|  113 } |  113 } | 
|  114     {% endif %} |  114     {% endif %} | 
|  115   {% endfor %} |  115   {% endfor %} | 
|  116  |  116  | 
|  117 // ------------- Enum values from params. |  117 // ------------- Enum values from params. | 
|  118  |  118  | 
|  119   {% for command in join_arrays(domain, ["commands", "events"]) %} |  119   {% for command in join_arrays(domain, ["commands", "events"]) %} | 
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  348         {%- if command.parameters -%}, {% endif -%} |  348         {%- if command.parameters -%}, {% endif -%} | 
|  349         std::move(callback)); |  349         std::move(callback)); | 
|  350     return DispatchResponse::kAsync; |  350     return DispatchResponse::kAsync; | 
|  351     {% endif %} |  351     {% endif %} | 
|  352 } |  352 } | 
|  353   {% endfor %} |  353   {% endfor %} | 
|  354  |  354  | 
|  355 // static |  355 // static | 
|  356 void Dispatcher::wire(UberDispatcher* dispatcher, Backend* backend) |  356 void Dispatcher::wire(UberDispatcher* dispatcher, Backend* backend) | 
|  357 { |  357 { | 
|  358     dispatcher->registerBackend("{{domain.domain}}", wrapUnique(new DispatcherIm
     pl(dispatcher->channel(), backend))); |  358     dispatcher->registerBackend("{{domain.domain}}", std::unique_ptr<protocol::D
     ispatcherBase>(new DispatcherImpl(dispatcher->channel(), backend))); | 
|  359 } |  359 } | 
|  360  |  360  | 
|  361 } // {{domain.domain}} |  361 } // {{domain.domain}} | 
|  362 {% for namespace in config.protocol.namespace %} |  362 {% for namespace in config.protocol.namespace %} | 
|  363 } // namespace {{namespace}} |  363 } // namespace {{namespace}} | 
|  364 {% endfor %} |  364 {% endfor %} | 
| OLD | NEW |