| OLD | NEW |
| 1 // This file is generated from {{input_file}} | 1 // This file is generated from {{input_file}} |
| 2 | 2 |
| 3 // Copyright 2017 The Chromium Authors. All rights reserved. | 3 // Copyright 2017 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 | 7 |
| 8 {% set sink_class = (name | to_singular) + "Sink" %} | 8 {% set sink_class = (name | to_singular) + "Sink" %} |
| 9 {% for file in files %} | 9 {% for file in files %} |
| 10 #include "{{file.name}}Inl.h" | 10 #include "{{file.name}}Inl.h" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 {%- for param in probe.params %} | 46 {%- for param in probe.params %} |
| 47 {{param.type}} {{param.name}} | 47 {{param.type}} {{param.name}} |
| 48 {%- if not loop.last %}, {% endif -%} | 48 {%- if not loop.last %}, {% endif -%} |
| 49 {%- endfor -%} | 49 {%- endfor -%} |
| 50 {%- endmacro %} | 50 {%- endmacro %} |
| 51 | 51 |
| 52 {% macro probe_body(probe, common_name) %} | 52 {% macro probe_body(probe, common_name) %} |
| 53 {% set agent_probe_name = common_name or probe.name %} | 53 {% set agent_probe_name = common_name or probe.name %} |
| 54 {{sink_class}}* sink = to{{sink_class}}({{probe.params[0].name}}); | 54 {{sink_class}}* sink = to{{sink_class}}({{probe.params[0].name}}); |
| 55 if (!sink) | 55 if (!sink) |
| 56 return; | 56 return {{probe.default_return_value}}; |
| 57 {% for param in probe.params %} | 57 {% for param in probe.params %} |
| 58 {% if param.is_prp %} | 58 {% if param.is_prp %} |
| 59 RefPtr<{{param.inner_type}}> {{param.value}} = {{param.name}}; | 59 RefPtr<{{param.inner_type}}> {{param.value}} = {{param.name}}; |
| 60 {% endif %} | 60 {% endif %} |
| 61 {% endfor %} | 61 {% endfor %} |
| 62 {% set maybe_return = "return " if probe.returns_value else "" %} |
| 62 {% for agent in probe.agents %} | 63 {% for agent in probe.agents %} |
| 63 {% set class_name = agent | agent_name_to_class %} | 64 {% set class_name = agent | agent_name_to_class %} |
| 64 if (sink->has{{class_name}}s()) { | 65 if (sink->has{{class_name}}s()) { |
| 65 for ({{class_name}}* agent : sink->{{ class_name | to_lower_case }}s()) | 66 for ({{class_name}}* agent : sink->{{ class_name | to_lower_case }}s()) |
| 66 agent->{{agent_probe_name}}({{caller()}}); | 67 {{maybe_return}}agent->{{agent_probe_name}}({{caller()}}); |
| 67 } | 68 } |
| 68 {% endfor %} | 69 {% endfor %} |
| 70 {% if probe.default_return_value %} |
| 71 return {{probe.default_return_value}}; |
| 72 {% endif %} |
| 69 {% endmacro -%} | 73 {% endmacro -%} |
| 70 | 74 |
| 71 {% for file in files %} | 75 {% for file in files %} |
| 72 {% for probe in file.declarations %} | 76 {% for probe in file.declarations %} |
| 73 {% if probe.is_scoped %} | 77 {% if probe.is_scoped %} |
| 74 {{probe.name}}::{{probe.name}}({{ params_list(probe) }}) : | 78 {{probe.name}}::{{probe.name}}({{ params_list(probe) }}) : |
| 75 {% for param in probe.params %} | 79 {% for param in probe.params %} |
| 76 {{param.name}}({{param.name}}) | 80 {{param.name}}({{param.name}}) |
| 77 {%- if not loop.last %}, | 81 {%- if not loop.last %}, |
| 78 {% endif %} | 82 {% endif %} |
| 79 {% endfor %} { | 83 {% endfor %} { |
| 80 {% call probe_body(probe, "will") %}*this{% endcall %} | 84 {% call probe_body(probe, "will") %}*this{% endcall %} |
| 81 } | 85 } |
| 82 | 86 |
| 83 {{probe.name}}::~{{probe.name}}() { | 87 {{probe.name}}::~{{probe.name}}() { |
| 84 {% call probe_body(probe, "did") %}*this{% endcall %} | 88 {% call probe_body(probe, "did") %}*this{% endcall %} |
| 85 } | 89 } |
| 86 | 90 |
| 87 {% else -%} | 91 {% else -%} |
| 88 | 92 |
| 89 CORE_EXPORT void {{probe.name}}({{ params_list(probe) }}) { | 93 CORE_EXPORT {{probe.return_type}} {{probe.name}}({{ params_list(probe) }}) { |
| 90 {% call probe_body(probe, "") %} | 94 {% call probe_body(probe, "") %} |
| 91 {%- for param in probe.params %} | 95 {%- for param in probe.params %} |
| 92 {%- if not loop.first or "Keep" in param.options -%} | 96 {%- if not loop.first or "Keep" in param.options -%} |
| 93 {{param.value}} | 97 {{param.value}} |
| 94 {%- if not loop.last %}, {% endif -%} | 98 {%- if not loop.last %}, {% endif -%} |
| 95 {%- endif -%} | 99 {%- endif -%} |
| 96 {%- endfor %} | 100 {%- endfor %} |
| 97 {%- endcall %} | 101 {%- endcall %} |
| 98 } | 102 } |
| 99 | 103 |
| 100 {% endif %} | 104 {% endif %} |
| 101 {% endfor %} | 105 {% endfor %} |
| 102 {% endfor %} | 106 {% endfor %} |
| 103 | 107 |
| 104 } // namespace probe | 108 } // namespace probe |
| 105 } // namespace blink | 109 } // namespace blink |
| OLD | NEW |