| 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 {{format_include(config.protocol.package, domain.domain)}} | 7 #include {{format_include(config.protocol.package, domain.domain)}} |
| 8 | 8 |
| 9 #include {{format_include(config.protocol.package, "Protocol")}} | 9 #include {{format_include(config.protocol.package, "Protocol")}} |
| 10 | 10 |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 {% endfor %} | 348 {% endfor %} |
| 349 } | 349 } |
| 350 if (weak->get()) | 350 if (weak->get()) |
| 351 weak->get()->sendResponse(callId, response, std::move(result)); | 351 weak->get()->sendResponse(callId, response, std::move(result)); |
| 352 {% else %} | 352 {% else %} |
| 353 if (weak->get()) | 353 if (weak->get()) |
| 354 weak->get()->sendResponse(callId, response); | 354 weak->get()->sendResponse(callId, response); |
| 355 {% endif %} | 355 {% endif %} |
| 356 return response.status(); | 356 return response.status(); |
| 357 {% else %} | 357 {% else %} |
| 358 std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr(); |
| 358 std::unique_ptr<{{command.name | to_title_case}}CallbackImpl> callback(new {
{command.name | to_title_case}}CallbackImpl(weakPtr(), callId, nextCallbackId())
); | 359 std::unique_ptr<{{command.name | to_title_case}}CallbackImpl> callback(new {
{command.name | to_title_case}}CallbackImpl(weakPtr(), callId, nextCallbackId())
); |
| 359 m_backend->{{command.name | to_method_case}}( | 360 m_backend->{{command.name | to_method_case}}( |
| 360 {%- for property in command.parameters -%} | 361 {%- for property in command.parameters -%} |
| 361 {%- if not loop.first -%}, {% endif -%} | 362 {%- if not loop.first -%}, {% endif -%} |
| 362 {%- if "optional" in property -%} | 363 {%- if "optional" in property -%} |
| 363 std::move(in_{{property.name}}) | 364 std::move(in_{{property.name}}) |
| 364 {%- else -%} | 365 {%- else -%} |
| 365 {{resolve_type(property).to_pass_type % ("in_" + property.name)}} | 366 {{resolve_type(property).to_pass_type % ("in_" + property.name)}} |
| 366 {%- endif -%} | 367 {%- endif -%} |
| 367 {%- endfor -%} | 368 {%- endfor -%} |
| 368 {%- if command.parameters -%}, {% endif -%} | 369 {%- if command.parameters -%}, {% endif -%} |
| 369 std::move(callback)); | 370 std::move(callback)); |
| 370 return lastCallbackFallThrough() ? DispatchResponse::kFallThrough : Dispatch
Response::kAsync; | 371 return (weak->get() && weak->get()->lastCallbackFallThrough()) ? DispatchRes
ponse::kFallThrough : DispatchResponse::kAsync; |
| 371 {% endif %} | 372 {% endif %} |
| 372 } | 373 } |
| 373 {% endfor %} | 374 {% endfor %} |
| 374 | 375 |
| 375 // static | 376 // static |
| 376 void Dispatcher::wire(UberDispatcher* dispatcher, Backend* backend) | 377 void Dispatcher::wire(UberDispatcher* dispatcher, Backend* backend) |
| 377 { | 378 { |
| 378 dispatcher->registerBackend("{{domain.domain}}", std::unique_ptr<protocol::D
ispatcherBase>(new DispatcherImpl(dispatcher->channel(), backend, dispatcher->fa
llThroughForNotFound()))); | 379 dispatcher->registerBackend("{{domain.domain}}", std::unique_ptr<protocol::D
ispatcherBase>(new DispatcherImpl(dispatcher->channel(), backend, dispatcher->fa
llThroughForNotFound()))); |
| 379 } | 380 } |
| 380 | 381 |
| 381 } // {{domain.domain}} | 382 } // {{domain.domain}} |
| 382 {% for namespace in config.protocol.namespace %} | 383 {% for namespace in config.protocol.namespace %} |
| 383 } // namespace {{namespace}} | 384 } // namespace {{namespace}} |
| 384 {% endfor %} | 385 {% endfor %} |
| OLD | NEW |