chromium/third_party/blink/renderer/build/scripts/templates/internal_runtime_flags.h.tmpl

{% from 'templates/macros.tmpl' import license, source_files_for_generated_file %}
{{license()}}

{{source_files_for_generated_file(template_file, input_files)}}

#ifndef {{header_guard}}
#define {{header_guard}}

#include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h"

namespace blink {

class InternalRuntimeFlags : public ScriptWrappable {
  DEFINE_WRAPPERTYPEINFO();
 public:
  static InternalRuntimeFlags* create() {
    return MakeGarbageCollected<InternalRuntimeFlags>();
  }

  InternalRuntimeFlags() {}

  // These are reset between web tests from Internals::resetToConsistentState
  // using RuntimeEnabledFeatures::Backup.
  {% for feature in features if feature.settable_from_internals %}
  void set{{feature.name}}Enabled(bool isEnabled) {
    RuntimeEnabledFeatures::Set{{feature.name}}Enabled(isEnabled);
  }
  {% endfor %}

  {% for feature in features %}
  bool {{feature.name.to_lower_camel_case()}}Enabled() {
    {% if feature.in_origin_trial %}
    return RuntimeEnabledFeatures::{{feature.name}}EnabledByRuntimeFlag();
    {% else %}
    return RuntimeEnabledFeatures::{{feature.name}}Enabled();
    {% endif %}
  }
  {% endfor %}
};

}  // namespace blink

#endif  // {{header_guard}}