From b1c34e19a38f448467a10ca3e663984f1182e1d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Qu=C3=A8ze?= Date: Tue, 23 Feb 2021 17:52:18 +0000 Subject: [PATCH] Bug 1693101 - Codegen.py should only include ProfilerLabels.h when a profiler label will be generated, r=sg,peterv Differential Revision: https://phabricator.services.mozilla.com/D105341 --- dom/bindings/Codegen.py | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 7e641b0185e2..27b578204bdf 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -18022,8 +18022,23 @@ class CGBindingRoot(CGThing): for d in descriptors ) - # XXX Not sure when we actually need this - bindingHeaders["GeckoProfiler.h"] = True + # The conditions for which we generate profiler labels are fairly + # complicated. The check below is a little imprecise to make it simple. + # It includes the profiler header in all cases where it is necessary and + # generates only a few false positives. + bindingHeaders["mozilla/ProfilerLabels.h"] = any( + # constructor profiler label + d.interface.namedConstructors + or (d.interface.hasInterfaceObject() and d.interface.ctor()) + or any( + # getter/setter profiler labels + m.isAttr() + # method profiler label + or m.isMethod() + for m in d.interface.members + ) + for d in descriptors + ) def descriptorHasCrossOriginProperties(desc): def hasCrossOriginProperty(m):