blob: d531966917b1c4c856446a25cadb6c71d76d4766 [file] [log] [blame]
{% from 'macros.tmpl' import license %}
{{license()}}
#ifndef RuntimeEnabledFeatures_h
#define RuntimeEnabledFeatures_h
#include <string>
#include "platform/PlatformExport.h"
#include "wtf/Allocator.h"
#include "wtf/Forward.h"
#include "wtf/build_config.h"
namespace blink {
// A class that stores static enablers for all experimental features.
class PLATFORM_EXPORT RuntimeEnabledFeatures {
STATIC_ONLY(RuntimeEnabledFeatures);
public:
class PLATFORM_EXPORT Backup {
public:
explicit Backup();
void restore();
private:
{% for feature in standard_features %}
bool m_{{feature.first_lowered_name}};
{% endfor %}
};
{% for feature_set in feature_sets %}
static void set{{feature_set|capitalize}}FeaturesEnabled(bool);
{% endfor %}
static void setFeatureEnabledFromString(const std::string& name, bool isEnabled);
{% for feature in features %}
{% if feature.custom %}
static bool {{feature.first_lowered_name}}Enabled();
{% else %}
{% if feature.condition %}
#if ENABLE({{feature.condition}})
{% endif %}
static void set{{feature.name}}Enabled(bool isEnabled) { is{{feature.name}}Enabled = isEnabled; }
static bool {{feature.first_lowered_name}}Enabled() { return {{feature.enabled_condition}}; }
{% if feature.condition %}
#else
static void set{{feature.name}}Enabled(bool) { }
static bool {{feature.first_lowered_name}}Enabled() { return false; }
#endif
{% endif %}
{% endif %}
{% endfor %}
private:
{% for feature in standard_features %}
static bool is{{feature.name}}Enabled;
{% endfor %}
};
} // namespace blink
#endif // RuntimeEnabledFeatures_h