Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(479)

Unified Diff: templates/TypeBuilder_cpp.template

Issue 2545613002: [inspector_protocol] always use weak pointer in DispatcherImpl::{command.name} (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: templates/TypeBuilder_cpp.template
diff --git a/templates/TypeBuilder_cpp.template b/templates/TypeBuilder_cpp.template
index 23b6f5399089609af71ac4c5878aae9e171e0a62..f90dbd1064a8e1a8ce055b93d3b39a42367b21a6 100644
--- a/templates/TypeBuilder_cpp.template
+++ b/templates/TypeBuilder_cpp.template
@@ -355,6 +355,7 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
{% endif %}
return response.status();
{% else %}
+ std::unique_ptr<DispatcherBase::WeakPtr> weak = weakPtr();
std::unique_ptr<{{command.name | to_title_case}}CallbackImpl> callback(new {{command.name | to_title_case}}CallbackImpl(weakPtr(), callId, nextCallbackId()));
m_backend->{{command.name | to_method_case}}(
{%- for property in command.parameters -%}
@@ -367,7 +368,7 @@ DispatchResponse::Status DispatcherImpl::{{command.name}}(int callId, std::uniqu
{%- endfor -%}
{%- if command.parameters -%}, {% endif -%}
std::move(callback));
- return lastCallbackFallThrough() ? DispatchResponse::kFallThrough : DispatchResponse::kAsync;
+ return (weak->get() && weak->get()->lastCallbackFallThrough()) ? DispatchResponse::kFallThrough : DispatchResponse::kAsync;
{% endif %}
}
{% endfor %}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698