| 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 agents_class = name + "Agents" %} |
| 8 {% for file in files %} | 9 {% for file in files %} |
| 9 #include "{{file.header_name}}.h" | 10 #include "{{file.name}}Inl.h" |
| 10 {% endfor %} | 11 {% endfor %} |
| 11 #include "InstrumentingAgents.h" | 12 #include "{{agents_class}}.h" |
| 12 #include "core/CoreExport.h" | |
| 13 {% for agent in agents %} | 13 {% for agent in agents %} |
| 14 {% set class_name = agent | agent_name_to_class %} | 14 {% set class_name = agent | agent_name_to_class %} |
| 15 {% if class_name == "PerformanceMonitor" %} | 15 {% if class_name == "PerformanceMonitor" %} |
| 16 #include "core/frame/PerformanceMonitor.h" | 16 #include "core/frame/PerformanceMonitor.h" |
| 17 {% elif class_name.startswith("Platform") %} |
| 18 #include "platform/instrumentation/{{class_name}}.h" |
| 17 {% else %} | 19 {% else %} |
| 18 #include "core/inspector/{{class_name}}.h" | 20 #include "core/inspector/{{class_name}}.h" |
| 19 {% endif %} | 21 {% endif %} |
| 20 {% endfor %} | 22 {% endfor %} |
| 21 | 23 |
| 22 namespace blink { | 24 namespace blink { |
| 23 | 25 |
| 24 InstrumentingAgents::InstrumentingAgents() {} | 26 {{agents_class}}::{{agents_class}}() {} |
| 25 | 27 |
| 26 {% for agent in agents %} | 28 {% for agent in agents %} |
| 27 {% set class_name = agent | agent_name_to_class %} | 29 {% set class_name = agent | agent_name_to_class %} |
| 28 {% set getter_name = class_name | to_lower_case %} | 30 {% set getter_name = class_name | to_lower_case %} |
| 29 void InstrumentingAgents::add{{class_name}}({{class_name}}* agent) { | 31 void {{agents_class}}::add{{class_name}}({{class_name}}* agent) { |
| 30 m_{{getter_name}}s.insert(agent); | 32 m_{{getter_name}}s.insert(agent); |
| 31 m_has{{class_name}}s = true; | 33 m_has{{class_name}}s = true; |
| 32 } | 34 } |
| 33 | 35 |
| 34 void InstrumentingAgents::remove{{class_name}}({{class_name}}* agent) { | 36 void {{agents_class}}::remove{{class_name}}({{class_name}}* agent) { |
| 35 m_{{getter_name}}s.erase(agent); | 37 m_{{getter_name}}s.erase(agent); |
| 36 m_has{{class_name}}s = !m_{{getter_name}}s.isEmpty(); | 38 m_has{{class_name}}s = !m_{{getter_name}}s.isEmpty(); |
| 37 } | 39 } |
| 38 | 40 |
| 39 {% endfor -%} | 41 {% endfor -%} |
| 40 | 42 |
| 41 DEFINE_TRACE(InstrumentingAgents) | 43 DEFINE_TRACE({{agents_class}}) |
| 42 { | 44 { |
| 43 {% for agent in agents %} | 45 {% for agent in agents %} |
| 44 {% set getter_name = agent | agent_name_to_class | to_lower_case %} | 46 {% set getter_name = agent | agent_name_to_class | to_lower_case %} |
| 45 visitor->trace(m_{{getter_name}}s); | 47 visitor->trace(m_{{getter_name}}s); |
| 46 {% endfor %} | 48 {% endfor %} |
| 47 } | 49 } |
| 48 | 50 |
| 49 namespace probe { | 51 namespace probe { |
| 50 {% macro params_list(probe) -%} | 52 {% macro params_list(probe) -%} |
| 51 {%- for param in probe.params %} | 53 {%- for param in probe.params %} |
| 52 {{param.type}} {{param.name}} | 54 {{param.type}} {{param.name}} |
| 53 {%- if not loop.last %}, {% endif -%} | 55 {%- if not loop.last %}, {% endif -%} |
| 54 {%- endfor -%} | 56 {%- endfor -%} |
| 55 {%- endmacro %} | 57 {%- endmacro %} |
| 56 | 58 |
| 57 {% macro probe_body(probe, common_name) %} | 59 {% macro probe_body(probe, common_name) %} |
| 58 {% set agent_probe_name = common_name or probe.name %} | 60 {% set agent_probe_name = common_name or probe.name %} |
| 59 InstrumentingAgents* agents = instrumentingAgentsFor({{probe.params[0].name}})
; | 61 {{agents_class}}* agents = instrumentingAgentsFor({{probe.params[0].name}}); |
| 60 if (!agents) | 62 if (!agents) |
| 61 return {{probe.default_return_value}}; | 63 return {{probe.default_return_value}}; |
| 62 {% for param in probe.params %} | 64 {% for param in probe.params %} |
| 63 {% if param.is_prp %} | 65 {% if param.is_prp %} |
| 64 RefPtr<{{param.inner_type}}> {{param.value}} = {{param.name}}; | 66 RefPtr<{{param.inner_type}}> {{param.value}} = {{param.name}}; |
| 65 {% endif %} | 67 {% endif %} |
| 66 {% endfor %} | 68 {% endfor %} |
| 67 {% set maybe_return = "return " if probe.returns_value else "" %} | 69 {% set maybe_return = "return " if probe.returns_value else "" %} |
| 68 {% for agent in probe.agents %} | 70 {% for agent in probe.agents %} |
| 69 {% set class_name = agent | agent_name_to_class %} | 71 {% set class_name = agent | agent_name_to_class %} |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 {%- endfor %} | 107 {%- endfor %} |
| 106 {%- endcall %} | 108 {%- endcall %} |
| 107 } | 109 } |
| 108 | 110 |
| 109 {% endif %} | 111 {% endif %} |
| 110 {% endfor %} | 112 {% endfor %} |
| 111 {% endfor %} | 113 {% endfor %} |
| 112 | 114 |
| 113 } // namespace probe | 115 } // namespace probe |
| 114 } // namespace blink | 116 } // namespace blink |
| OLD | NEW |