// Copyright 2017 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. {% from 'macros.tmpl' import source_files_for_generated_file %} {{source_files_for_generated_file(template_file, input_files)}} #ifndef {{header_guard}} #define {{header_guard}} #include "third_party/blink/renderer/platform/heap/heap_allocator.h" #include "third_party/blink/renderer/bindings/core/v8/script_source_code.h" {% for include in config["settings"]["includes"] %} #include "{{include}}" {% endfor %} {% set export_symbol = config["settings"]["export_symbol"] %} {% set sink_class = (name | to_singular) + "Sink" %} namespace blink { {% for forward_decl in file.forward_declarations %} {{forward_decl}} {% endfor %} namespace probe { {% for probe in file.declarations %} {%- macro params_decl(probe) %} {%- for param in probe.params %} {{ param.type }} {%- if param.default_value %} = {{ param.default_value }} {%- endif %} {%- if not loop.last %}, {% endif %} {%- endfor %} {%- endmacro -%} {%- macro params_list(probe) %} {%- for param in probe.params %} {{param.type}} {{param.name}} {%- if not loop.last %}, {% endif -%} {%- endfor -%} {%- endmacro %} {% if probe.is_scoped %} class {{export_symbol}} {{probe.name}} : public ProbeBase { STACK_ALLOCATED(); public: explicit {{probe.name}}({{ params_decl(probe) }}); ~{{probe.name}}(); Member<{{sink_class}}> probe_sink; {% for param in probe.params %} {{param.member_type}} {{param.name}}; {% endfor %} }; {%- else %} {{export_symbol}} void {{probe.name}}Impl({{ params_decl(probe) }}); inline void {{probe.name}}({{params_list(probe)}}) { if (!{{sink_class}}::HasAgentsGlobal( {%- for agent in probe.agents %} {% if not loop.first %} | {% endif -%} {{sink_class}}::k{{agent}} {%- endfor %})) return; {{probe.name}}Impl( {%- for param in probe.params %} {% if not loop.first %}, {% endif %}{{param.name}} {%- endfor %}); } {%- endif %} {%- endfor %} } // namespace probe } // namespace blink #endif // {{header_guard}}