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

Side by Side Diff: third_party/WebKit/Source/build/scripts/templates/InstrumentingProbesImpl.cpp.tmpl

Issue 2800853002: [instrumentation] Turn inspector override "probes" return values into output parameters. (Closed)
Patch Set: update BUILD.gn Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
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
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 {{probe.default_return_value}}; 56 return;
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 "" %}
63 {% for agent in probe.agents %} 62 {% for agent in probe.agents %}
64 {% set class_name = agent | agent_name_to_class %} 63 {% set class_name = agent | agent_name_to_class %}
65 if (sink->has{{class_name}}s()) { 64 if (sink->has{{class_name}}s()) {
66 for ({{class_name}}* agent : sink->{{ class_name | to_lower_case }}s()) 65 for ({{class_name}}* agent : sink->{{ class_name | to_lower_case }}s())
67 {{maybe_return}}agent->{{agent_probe_name}}({{caller()}}); 66 agent->{{agent_probe_name}}({{caller()}});
68 } 67 }
69 {% endfor %} 68 {% endfor %}
70 {% if probe.default_return_value %}
71 return {{probe.default_return_value}};
72 {% endif %}
73 {% endmacro -%} 69 {% endmacro -%}
74 70
75 {% for file in files %} 71 {% for file in files %}
76 {% for probe in file.declarations %} 72 {% for probe in file.declarations %}
77 {% if probe.is_scoped %} 73 {% if probe.is_scoped %}
78 {{probe.name}}::{{probe.name}}({{ params_list(probe) }}) : 74 {{probe.name}}::{{probe.name}}({{ params_list(probe) }}) :
79 {% for param in probe.params %} 75 {% for param in probe.params %}
80 {{param.name}}({{param.name}}) 76 {{param.name}}({{param.name}})
81 {%- if not loop.last %}, 77 {%- if not loop.last %},
82 {% endif %} 78 {% endif %}
83 {% endfor %} { 79 {% endfor %} {
84 {% call probe_body(probe, "will") %}*this{% endcall %} 80 {% call probe_body(probe, "will") %}*this{% endcall %}
85 } 81 }
86 82
87 {{probe.name}}::~{{probe.name}}() { 83 {{probe.name}}::~{{probe.name}}() {
88 {% call probe_body(probe, "did") %}*this{% endcall %} 84 {% call probe_body(probe, "did") %}*this{% endcall %}
89 } 85 }
90 86
91 {% else -%} 87 {% else -%}
92 88
93 CORE_EXPORT {{probe.return_type}} {{probe.name}}({{ params_list(probe) }}) { 89 CORE_EXPORT void {{probe.name}}({{ params_list(probe) }}) {
94 {% call probe_body(probe, "") %} 90 {% call probe_body(probe, "") %}
95 {%- for param in probe.params %} 91 {%- for param in probe.params %}
96 {%- if not loop.first or "Keep" in param.options -%} 92 {%- if not loop.first or "Keep" in param.options -%}
97 {{param.value}} 93 {{param.value}}
98 {%- if not loop.last %}, {% endif -%} 94 {%- if not loop.last %}, {% endif -%}
99 {%- endif -%} 95 {%- endif -%}
100 {%- endfor %} 96 {%- endfor %}
101 {%- endcall %} 97 {%- endcall %}
102 } 98 }
103 99
104 {% endif %} 100 {% endif %}
105 {% endfor %} 101 {% endfor %}
106 {% endfor %} 102 {% endfor %}
107 103
108 } // namespace probe 104 } // namespace probe
109 } // namespace blink 105 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698