Commit 977c0041 authored by Amos Lim's avatar Amos Lim Committed by Commit Bot

Let generated header files follow chromium style on header guards

Generated header files need to follow chromium style on header guards.
This CL has no behavior changes.

Bug: 896720
Change-Id: I97dbc277af5fc7b85fef3a6f93facdfce2742927
Reviewed-on: https://chromium-review.googlesource.com/c/1292652Reviewed-by: default avatarKent Tamura <tkent@chromium.org>
Reviewed-by: default avatarDarren Shen <shend@chromium.org>
Commit-Queue: Amos Lim <eui-sang.lim@samsung.com>
Cr-Commit-Position: refs/heads/master@{#601475}
parent 9dbe1c3f
...@@ -14,11 +14,13 @@ import gperf ...@@ -14,11 +14,13 @@ import gperf
class CSSValueKeywordsWriter(json5_generator.Writer): class CSSValueKeywordsWriter(json5_generator.Writer):
_FILE_BASENAME = 'css_value_keywords'
def __init__(self, file_paths, output_dir): def __init__(self, file_paths, output_dir):
json5_generator.Writer.__init__(self, file_paths, output_dir) json5_generator.Writer.__init__(self, file_paths, output_dir)
self._outputs = { self._outputs = {
"css_value_keywords.h": self.generate_header, (self._FILE_BASENAME + '.h'): self.generate_header,
"css_value_keywords.cc": self.generate_implementation (self._FILE_BASENAME + '.cc'): self.generate_implementation,
} }
self._value_keywords = self.json5_file.name_dictionaries self._value_keywords = self.json5_file.name_dictionaries
...@@ -43,6 +45,7 @@ class CSSValueKeywordsWriter(json5_generator.Writer): ...@@ -43,6 +45,7 @@ class CSSValueKeywordsWriter(json5_generator.Writer):
'value_keywords_count': self._keyword_count, 'value_keywords_count': self._keyword_count,
'max_value_keyword_length': 'max_value_keyword_length':
max(len(keyword['name'].original) for keyword in self._value_keywords), max(len(keyword['name'].original) for keyword in self._value_keywords),
'header_guard': self.make_header_guard(self._relative_output_dir + self._FILE_BASENAME + '.h')
} }
def _value_keywords_with_mode(self, mode): def _value_keywords_with_mode(self, mode):
......
...@@ -33,6 +33,7 @@ class MakeMediaFeaturesWriter(json5_generator.Writer): ...@@ -33,6 +33,7 @@ class MakeMediaFeaturesWriter(json5_generator.Writer):
self._template_context = { self._template_context = {
'entries': self.json5_file.name_dictionaries, 'entries': self.json5_file.name_dictionaries,
'input_files': self._input_files, 'input_files': self._input_files,
'header_guard': self.make_header_guard(self._relative_output_dir + 'media_festures.h')
} }
@template_expander.use_jinja('core/css/templates/media_features.h.tmpl', filters=filters) @template_expander.use_jinja('core/css/templates/media_features.h.tmpl', filters=filters)
......
...@@ -40,15 +40,17 @@ import template_expander ...@@ -40,15 +40,17 @@ import template_expander
class StylePropertyShorthandWriter(json5_generator.Writer): class StylePropertyShorthandWriter(json5_generator.Writer):
class_name = 'StylePropertyShorthand' class_name = 'StylePropertyShorthand'
_FILE_BASENAME = 'style_property_shorthand'
def __init__(self, json5_file_paths, output_dir): def __init__(self, json5_file_paths, output_dir):
super(StylePropertyShorthandWriter, self).__init__([], output_dir) super(StylePropertyShorthandWriter, self).__init__([], output_dir)
self._input_files = json5_file_paths self._input_files = json5_file_paths
self._outputs = { self._outputs = {
'style_property_shorthand.cc': (self._FILE_BASENAME + '.cc'):
self.generate_style_property_shorthand_cpp, self.generate_style_property_shorthand_cpp,
'style_property_shorthand.h': (self._FILE_BASENAME + '.h'):
self.generate_style_property_shorthand_h} self.generate_style_property_shorthand_h
}
json5_properties = css_properties.CSSProperties(json5_file_paths) json5_properties = css_properties.CSSProperties(json5_file_paths)
self._shorthands = json5_properties.shorthands self._shorthands = json5_properties.shorthands
...@@ -83,6 +85,7 @@ class StylePropertyShorthandWriter(json5_generator.Writer): ...@@ -83,6 +85,7 @@ class StylePropertyShorthandWriter(json5_generator.Writer):
return { return {
'input_files': self._input_files, 'input_files': self._input_files,
'properties': self._shorthands, 'properties': self._shorthands,
'header_guard': self.make_header_guard(self._relative_output_dir + self._FILE_BASENAME + '.h')
} }
if __name__ == '__main__': if __name__ == '__main__':
......
...@@ -2,12 +2,13 @@ ...@@ -2,12 +2,13 @@
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
#ifndef BLINK_CORE_CSS_VALUE_KEYWORDS_H_ #ifndef {{header_guard}}
#define BLINK_CORE_CSS_VALUE_KEYWORDS_H_ #define {{header_guard}}
#include "third_party/blink/renderer/core/css/parser/css_parser_mode.h"
#include <string.h> #include <string.h>
#include "third_party/blink/renderer/core/css/parser/css_parser_mode.h"
namespace blink { namespace blink {
enum CSSValueID { enum CSSValueID {
...@@ -23,6 +24,6 @@ const size_t maxCSSValueKeywordLength = {{max_value_keyword_length}}; ...@@ -23,6 +24,6 @@ const size_t maxCSSValueKeywordLength = {{max_value_keyword_length}};
const char* getValueName(CSSValueID); const char* getValueName(CSSValueID);
bool isValueAllowedInMode(unsigned short id, CSSParserMode mode); bool isValueAllowedInMode(unsigned short id, CSSParserMode mode);
} // namespace blink } // namespace blink
#endif // BLINK_CORE_CSS_VALUE_KEYWORDS_H_ #endif // {{header_guard}}
{% from "templates/macros.tmpl" import license, source_files_for_generated_file %} {% from "templates/macros.tmpl" import license, source_files_for_generated_file %}
{{ license() }} {{license()}}
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef BLINK_CORE_CSS_MEDIA_FEATURES_H_ #ifndef {{header_guard}}
#define BLINK_CORE_CSS_MEDIA_FEATURES_H_ #define {{header_guard}}
#define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \ #define CSS_MEDIAQUERY_NAMES_FOR_EACH_MEDIAFEATURE(macro) \
{% for entry in entries %} {% for entry in entries %}
...@@ -14,4 +14,4 @@ ...@@ -14,4 +14,4 @@
{% endif %} {% endif %}
{% endfor %} {% endfor %}
#endif // BLINK_CORE_CSS_MEDIA_FEATURES_H_ #endif // {{header_guard}}
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
{% from 'templates/macros.tmpl' import source_files_for_generated_file %} {% from 'templates/macros.tmpl' import source_files_for_generated_file %}
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef BLINK_CORE_STYLE_PROPERTY_SHORTHAND_H_ #ifndef {{header_guard}}
#define BLINK_CORE_STYLE_PROPERTY_SHORTHAND_H_ #define {{header_guard}}
#include "css_property_names.h" #include "css_property_names.h"
#include "third_party/blink/renderer/core/css/properties/css_property.h" #include "third_party/blink/renderer/core/css/properties/css_property.h"
...@@ -74,6 +74,6 @@ void getMatchingShorthandsForLonghand( ...@@ -74,6 +74,6 @@ void getMatchingShorthandsForLonghand(
unsigned indexOfShorthandForLonghand(CSSPropertyID, unsigned indexOfShorthandForLonghand(CSSPropertyID,
const Vector<StylePropertyShorthand, 4>&); const Vector<StylePropertyShorthand, 4>&);
} // namespace blink } // namespace blink
#endif // BLINK_CORE_STYLE_PROPERTY_SHORTHAND_H_ #endif // {{header_guard}}
...@@ -62,6 +62,7 @@ class InternalRuntimeFlagsWriter(make_runtime_features.RuntimeFeatureWriter): ...@@ -62,6 +62,7 @@ class InternalRuntimeFlagsWriter(make_runtime_features.RuntimeFeatureWriter):
'feature_sets': self._feature_sets(), 'feature_sets': self._feature_sets(),
'input_files': self._input_files, 'input_files': self._input_files,
'standard_features': self._standard_features, 'standard_features': self._standard_features,
'header_guard': self._header_guard,
} }
......
...@@ -40,6 +40,7 @@ class MakeInternalSettingsWriter(json5_generator.Writer): ...@@ -40,6 +40,7 @@ class MakeInternalSettingsWriter(json5_generator.Writer):
'to_passing_type': to_passing_type, 'to_passing_type': to_passing_type,
'to_idl_type': to_idl_type, 'to_idl_type': to_idl_type,
} }
_FILE_BASENAME = 'internal_settings_generated'
def __init__(self, json5_file_path, output_dir): def __init__(self, json5_file_path, output_dir):
super(MakeInternalSettingsWriter, self).__init__(json5_file_path, output_dir) super(MakeInternalSettingsWriter, self).__init__(json5_file_path, output_dir)
...@@ -47,14 +48,15 @@ class MakeInternalSettingsWriter(json5_generator.Writer): ...@@ -47,14 +48,15 @@ class MakeInternalSettingsWriter(json5_generator.Writer):
self.json5_file.name_dictionaries.sort(key=lambda entry: entry['name'].original) self.json5_file.name_dictionaries.sort(key=lambda entry: entry['name'].original)
self._outputs = { self._outputs = {
'internal_settings_generated.h': self.generate_header, (self._FILE_BASENAME + '.h'): self.generate_header,
'internal_settings_generated.cc': self.generate_implementation, (self._FILE_BASENAME + '.cc'): self.generate_implementation,
'internal_settings_generated.idl': self.generate_idl, (self._FILE_BASENAME + '.idl'): self.generate_idl,
} }
self._template_context = { self._template_context = {
'input_files': self._input_files, 'input_files': self._input_files,
'primary_header_name': 'internal_settings_generated.h', 'primary_header_name': 'internal_settings_generated.h',
'settings': self.json5_file.name_dictionaries, 'settings': self.json5_file.name_dictionaries,
'header_guard': self.make_header_guard(self._relative_output_dir + self._FILE_BASENAME + '.h')
} }
@template_expander.use_jinja('templates/internal_settings_generated.h.tmpl', filters=filters) @template_expander.use_jinja('templates/internal_settings_generated.h.tmpl', filters=filters)
......
...@@ -89,6 +89,7 @@ class OriginTrialsWriter(make_runtime_features.RuntimeFeatureWriter): ...@@ -89,6 +89,7 @@ class OriginTrialsWriter(make_runtime_features.RuntimeFeatureWriter):
'origin_trial_features': self._origin_trial_features, 'origin_trial_features': self._origin_trial_features,
'implied_origin_trial_features': self._implied_mappings, 'implied_origin_trial_features': self._implied_mappings,
'input_files': self._input_files, 'input_files': self._input_files,
'header_guard': self._header_guard,
} }
......
...@@ -59,6 +59,7 @@ class RuntimeFeatureWriter(json5_generator.Writer): ...@@ -59,6 +59,7 @@ class RuntimeFeatureWriter(json5_generator.Writer):
feature['enabled_condition'] = enabled_condition feature['enabled_condition'] = enabled_condition
self._standard_features = [feature for feature in self._features if not feature['custom']] self._standard_features = [feature for feature in self._features if not feature['custom']]
self._origin_trial_features = [feature for feature in self._features if feature['origin_trial_feature_name']] self._origin_trial_features = [feature for feature in self._features if feature['origin_trial_feature_name']]
self._header_guard = self.make_header_guard(self._relative_output_dir + self.file_basename + '.h')
@staticmethod @staticmethod
def _data_member_name(str_or_converter): def _data_member_name(str_or_converter):
...@@ -77,6 +78,7 @@ class RuntimeFeatureWriter(json5_generator.Writer): ...@@ -77,6 +78,7 @@ class RuntimeFeatureWriter(json5_generator.Writer):
'input_files': self._input_files, 'input_files': self._input_files,
'standard_features': self._standard_features, 'standard_features': self._standard_features,
'origin_trial_controlled_features': self._origin_trial_features, 'origin_trial_controlled_features': self._origin_trial_features,
'header_guard': self._header_guard,
} }
@template_expander.use_jinja('templates/' + file_basename + '.h.tmpl') @template_expander.use_jinja('templates/' + file_basename + '.h.tmpl')
...@@ -95,13 +97,14 @@ class RuntimeFeatureTestHelpersWriter(json5_generator.Writer): ...@@ -95,13 +97,14 @@ class RuntimeFeatureTestHelpersWriter(json5_generator.Writer):
def __init__(self, json5_file_path, output_dir): def __init__(self, json5_file_path, output_dir):
super(RuntimeFeatureTestHelpersWriter, self).__init__(json5_file_path, output_dir) super(RuntimeFeatureTestHelpersWriter, self).__init__(json5_file_path, output_dir)
self._outputs = {('testing/' + self.file_basename + '.h'): self.generate_header} self._outputs = {('testing/' + self.file_basename + '.h'): self.generate_header}
self._features = self.json5_file.name_dictionaries self._features = self.json5_file.name_dictionaries
self._header_guard = self.make_header_guard(self._relative_output_dir + self.file_basename + '.h')
def _template_inputs(self): def _template_inputs(self):
return { return {
'features': self._features, 'features': self._features,
'input_files': self._input_files, 'input_files': self._input_files,
'header_guard': self._header_guard,
} }
@template_expander.use_jinja('templates/' + file_basename + '.h.tmpl') @template_expander.use_jinja('templates/' + file_basename + '.h.tmpl')
......
...@@ -73,6 +73,7 @@ class MakeSettingsWriter(json5_generator.Writer): ...@@ -73,6 +73,7 @@ class MakeSettingsWriter(json5_generator.Writer):
self._template_context = { self._template_context = {
'input_files': self._input_files, 'input_files': self._input_files,
'settings': self.json5_file.name_dictionaries, 'settings': self.json5_file.name_dictionaries,
'header_guard': self.make_header_guard(self._relative_output_dir + 'settings_macros.h')
} }
@template_expander.use_jinja('templates/settings_macros.h.tmpl', filters=filters) @template_expander.use_jinja('templates/settings_macros.h.tmpl', filters=filters)
......
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef InternalRuntimeFlags_h #ifndef {{header_guard}}
#define InternalRuntimeFlags_h #define {{header_guard}}
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
...@@ -43,6 +43,6 @@ class InternalRuntimeFlags : public ScriptWrappable { ...@@ -43,6 +43,6 @@ class InternalRuntimeFlags : public ScriptWrappable {
InternalRuntimeFlags() {} InternalRuntimeFlags() {}
}; };
} // namespace blink } // namespace blink
#endif // InternalRuntimeFlags_h #endif // {{header_guard}}
...@@ -3,13 +3,13 @@ ...@@ -3,13 +3,13 @@
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef InternalSettingsGenerated_h #ifndef {{header_guard}}
#define InternalSettingsGenerated_h #define {{header_guard}}
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/platform/bindings/script_wrappable.h" #include "third_party/blink/renderer/platform/bindings/script_wrappable.h"
#include "third_party/blink/renderer/platform/heap/handle.h" #include "third_party/blink/renderer/platform/heap/handle.h"
#include "third_party/blink/renderer/platform/wtf/ref_counted.h" #include "third_party/blink/renderer/platform/wtf/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "third_party/blink/renderer/platform/wtf/text/wtf_string.h" #include "third_party/blink/renderer/platform/wtf/text/wtf_string.h"
namespace blink { namespace blink {
...@@ -37,6 +37,6 @@ class InternalSettingsGenerated : public ScriptWrappable { ...@@ -37,6 +37,6 @@ class InternalSettingsGenerated : public ScriptWrappable {
{% endfor %} {% endfor %}
}; };
} // namespace blink } // namespace blink
#endif // InternalSettingsGenerated_h #endif // {{header_guard}}
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef BLINK_CORE_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ #ifndef {{header_guard}}
#define BLINK_CORE_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ #define {{header_guard}}
#include "third_party/blink/renderer/core/core_export.h" #include "third_party/blink/renderer/core/core_export.h"
#include "third_party/blink/renderer/platform/wtf/text/atomic_string.h" #include "third_party/blink/renderer/platform/wtf/text/atomic_string.h"
...@@ -35,6 +35,6 @@ CORE_EXPORT Vector<AtomicString> GetImpliedTrials(const String& trial_name); ...@@ -35,6 +35,6 @@ CORE_EXPORT Vector<AtomicString> GetImpliedTrials(const String& trial_name);
} // namespace OriginTrials } // namespace OriginTrials
} // namespace blink } // namespace blink
#endif // BLINK_CORE_ORIGIN_TRIALS_ORIGIN_TRIALS_H_ #endif // {{header_guard}}
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef RuntimeEnabledFeatures_h #ifndef {{header_guard}}
#define RuntimeEnabledFeatures_h #define {{header_guard}}
#include <string> #include <string>
...@@ -76,6 +76,6 @@ class PLATFORM_EXPORT RuntimeEnabledFeatures { ...@@ -76,6 +76,6 @@ class PLATFORM_EXPORT RuntimeEnabledFeatures {
{% endfor %} {% endfor %}
}; };
} // namespace blink } // namespace blink
#endif // RuntimeEnabledFeatures_h #endif // {{header_guard}}
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef BLINK_PLATFORM_TESTING_RUNTIME_ENABLED_FEATURES_TEST_HELPERS_H_ #ifndef {{header_guard}}
#define BLINK_PLATFORM_TESTING_RUNTIME_ENABLED_FEATURES_TEST_HELPERS_H_ #define {{header_guard}}
#include "third_party/blink/renderer/platform/runtime_enabled_features.h" #include "third_party/blink/renderer/platform/runtime_enabled_features.h"
#include "third_party/blink/renderer/platform/wtf/assertions.h" #include "third_party/blink/renderer/platform/wtf/assertions.h"
...@@ -39,6 +39,6 @@ typedef ScopedRuntimeEnabledFeatureForTest< ...@@ -39,6 +39,6 @@ typedef ScopedRuntimeEnabledFeatureForTest<
RuntimeEnabledFeatures::Set{{feature.name}}Enabled> RuntimeEnabledFeatures::Set{{feature.name}}Enabled>
Scoped{{feature.name}}ForTest; Scoped{{feature.name}}ForTest;
{% endfor %} {% endfor %}
} // namespace blink } // namespace blink
#endif // BLINK_PLATFORM_TESTING_RUNTIME_ENABLED_FEATURES_TEST_HELPERS_H_ #endif // {{header_guard}}
...@@ -3,8 +3,8 @@ ...@@ -3,8 +3,8 @@
{{source_files_for_generated_file(template_file, input_files)}} {{source_files_for_generated_file(template_file, input_files)}}
#ifndef SettingsMacros_h #ifndef {{header_guard}}
#define SettingsMacros_h #define {{header_guard}}
#define SETTINGS_GETTERS_AND_SETTERS \ #define SETTINGS_GETTERS_AND_SETTERS \
{% for setting in settings %} {% for setting in settings %}
...@@ -67,4 +67,4 @@ void Settings::SetFromStrings(const String& name, const String& value) { \ ...@@ -67,4 +67,4 @@ void Settings::SetFromStrings(const String& name, const String& value) { \
} }
// End of SETTINGS_SETTER_BODIES. // End of SETTINGS_SETTER_BODIES.
#endif // SettingsMacros_h #endif // {{header_guard}}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment