diff --git a/sky/engine/build/scripts/hasher.py b/sky/engine/build/scripts/hasher.py deleted file mode 100644 index a608fb7321f8ea9ac2a51e1075bd7ea29558369d..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/hasher.py +++ /dev/null @@ -1,82 +0,0 @@ -# Copyright (C) 2013 Google, Inc. -# -# This library is free software; you can redistribute it and/or -# modify it under the terms of the GNU Library General Public -# License as published by the Free Software Foundation; either -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with this library; see the file COPYING.LIB. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. - -# This implementaiton of SuperFastHash is based on the Python implementation -# by Victor Perron at . -# We've modified Victor's version to output hash values that match WTFString, -# which involves using a specific seed and some different constants. - -class uint32_t(long): - def __rshift__(self, other): - return uint32_t(long.__rshift__(self, other) & ((1L << 32) - 1)) - - def __lshift__(self, other): - return uint32_t(long.__lshift__(self, other) & ((1L << 32) - 1)) - - def __add__(self, other): - return uint32_t(long.__add__(self, other) & ((1L << 32) - 1)) - - def __xor__(self, other): - return uint32_t(long.__xor__(self, other) & ((1L << 32) - 1)) - - -def hash(string): - """ - Stream-adapted SuperFastHash algorithm from Paul Hsieh, - http://www.azillionmonkeys.com/qed/hash.html - LGPLv2.1 - Python version with no dependencies. - Victor Perron - """ - - if not string: - return 0 - - result = uint32_t(0x9E3779B9L) - length = len(string) - remainder = length & 1 - length >>= 1 - - i = 0 - while length > 0: - length -= 1 - result += ord(string[i]) - temp = (ord(string[i + 1]) << 11) ^ result - result = (result << 16) ^ temp - i += 2 - result += (result >> 11) - - if remainder == 1: - result += ord(string[i]) - result ^= (result << 11) - result += (result >> 17) - - # Force "avalanching" of final 127 bits - result ^= (result << 3) - result += (result >> 5) - result ^= (result << 2) - result += (result >> 15) - result ^= (result << 10) - - # Save 8 bits for StringImpl to use as flags. - result &= 0xffffff - - # This avoids ever returning a hash code of 0, since that is used to - # signal "hash not computed yet". - assert result != 0 - - return result diff --git a/sky/engine/build/scripts/in_file.py b/sky/engine/build/scripts/in_file.py deleted file mode 100644 index b33969ecc44b93207b27a07108b5ce59e3a6c5f6..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/in_file.py +++ /dev/null @@ -1,161 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import copy -import os - -# NOTE: This has only been used to parse -# core/page/RuntimeEnabledFeatures.in and may not be capable -# of parsing other .in files correctly. - -# .in file format is: -# // comment -# name1 arg=value, arg2=value2, arg2=value3 -# -# InFile must be passed a dictionary of default values -# with which to validate arguments against known names. -# Sequence types as default values will produce sequences -# as parse results. -# Bare arguments (no '=') are treated as names with value True. -# The first field will always be labeled 'name'. -# -# InFile.load_from_files(['file.in'], {'arg': None, 'arg2': []}) -# -# Parsing produces an array of dictionaries: -# [ { 'name' : 'name1', 'arg' :' value', arg2=['value2', 'value3'] } - -def _is_comment(line): - return line.startswith("//") or line.startswith("#") - -class InFile(object): - def __init__(self, lines, defaults, valid_values=None, default_parameters=None): - self.name_dictionaries = [] - self.parameters = copy.deepcopy(default_parameters if default_parameters else {}) - self._defaults = defaults - self._valid_values = copy.deepcopy(valid_values if valid_values else {}) - self._parse(map(str.strip, lines)) - - @classmethod - def load_from_files(self, file_paths, defaults, valid_values, default_parameters): - lines = [] - for path in file_paths: - assert path.endswith(".in") - with open(os.path.abspath(path)) as in_file: - lines += in_file.readlines() - return InFile(lines, defaults, valid_values, default_parameters) - - def _is_sequence(self, arg): - return (not hasattr(arg, "strip") - and hasattr(arg, "__getitem__") - or hasattr(arg, "__iter__")) - - def _parse(self, lines): - parsing_parameters = True - indices = {} - for line in lines: - if _is_comment(line): - continue - if not line: - parsing_parameters = False - continue - if parsing_parameters: - self._parse_parameter(line) - else: - entry = self._parse_line(line) - name = entry['name'] - if name in indices: - entry = self._merge_entries(entry, self.name_dictionaries[indices[name]]) - entry['name'] = name - self.name_dictionaries[indices[name]] = entry - else: - indices[name] = len(self.name_dictionaries) - self.name_dictionaries.append(entry) - - - def _merge_entries(self, one, two): - merged = {} - for key in one: - if key not in two: - self._fatal("Expected key '%s' not found in entry: %s" % (key, two)) - if one[key] and two[key]: - val_one = one[key] - val_two = two[key] - if isinstance(val_one, list) and isinstance(val_two, list): - val = val_one + val_two - elif isinstance(val_one, list): - val = val_one + [val_two] - elif isinstance(val_two, list): - val = [val_one] + val_two - else: - val = [val_one, val_two] - merged[key] = val - elif one[key]: - merged[key] = one[key] - else: - merged[key] = two[key] - return merged - - - def _parse_parameter(self, line): - if '=' in line: - name, value = line.split('=') - else: - name, value = line, True - if not name in self.parameters: - self._fatal("Unknown parameter: '%s' in line:\n%s\nKnown parameters: %s" % (name, line, self.parameters.keys())) - self.parameters[name] = value - - def _parse_line(self, line): - args = copy.deepcopy(self._defaults) - parts = line.split(' ') - args['name'] = parts[0] - # re-join the rest of the line and split on ',' - args_list = ' '.join(parts[1:]).strip().split(',') - for arg_string in args_list: - arg_string = arg_string.strip() - if not arg_string: # Ignore empty args - continue - if '=' in arg_string: - arg_name, arg_value = arg_string.split('=') - else: - arg_name, arg_value = arg_string, True - if arg_name not in self._defaults: - self._fatal("Unknown argument: '%s' in line:\n%s\nKnown arguments: %s" % (arg_name, line, self._defaults.keys())) - valid_values = self._valid_values.get(arg_name) - if valid_values and arg_value not in valid_values: - self._fatal("Unknown value: '%s' in line:\n%s\nKnown values: %s" % (arg_value, line, valid_values)) - if self._is_sequence(args[arg_name]): - args[arg_name].append(arg_value) - else: - args[arg_name] = arg_value - return args - - def _fatal(self, message): - # FIXME: This should probably raise instead of exit(1) - print message - exit(1) diff --git a/sky/engine/build/scripts/in_file_unittest.py b/sky/engine/build/scripts/in_file_unittest.py deleted file mode 100755 index 950efb03cc6549eca7283d887f10c1bcbe5ac07a..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/in_file_unittest.py +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import unittest - -from in_file import InFile - -class InFileTest(unittest.TestCase): - def test_basic_parse(self): - contents = """ -name1 arg=value, arg2=value2, arg2=value3 -name2 -""" - lines = contents.split("\n") - defaults = { - 'arg': None, - 'arg2': [], - } - in_file = InFile(lines, defaults, None) - expected_values = [ - {'name': 'name1', 'arg': 'value', 'arg2': ['value2', 'value3']}, - {'name': 'name2', 'arg': None, 'arg2': []}, - ] - self.assertEquals(in_file.name_dictionaries, expected_values) - - def test_with_parameters(self): - contents = """namespace=TestNamespace -fruit - -name1 arg=value, arg2=value2, arg2=value3 -name2 -""" - lines = contents.split("\n") - defaults = { - 'arg': None, - 'arg2': [], - } - default_parameters = { - 'namespace': '', - 'fruit': False, - } - in_file = InFile(lines, defaults, default_parameters=default_parameters) - expected_parameters = { - 'namespace': 'TestNamespace', - 'fruit': True, - } - self.assertEquals(in_file.parameters, expected_parameters) - - def test_assertion_for_non_in_files(self): - in_files = ['some_sample_file.json'] - assertion_thrown = False - try: - in_file = InFile.load_from_files(in_files, None, None, None) - except AssertionError: - assertion_thrown = True - except: - pass - self.assertTrue(assertion_thrown) - - -if __name__ == "__main__": - unittest.main() diff --git a/sky/engine/build/scripts/in_generator.py b/sky/engine/build/scripts/in_generator.py deleted file mode 100644 index 7028ec9fecdce3c6d30d7510df35aa720231f90e..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/in_generator.py +++ /dev/null @@ -1,98 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os.path -import shlex -import shutil -import optparse - -from in_file import InFile - - -class Writer(object): - # Subclasses should override. - class_name = None - defaults = None - valid_values = None - default_parameters = None - - def __init__(self, in_files): - if isinstance(in_files, basestring): - in_files = [in_files] - if in_files: - self.in_file = InFile.load_from_files(in_files, self.defaults, self.valid_values, self.default_parameters) - else: - self.in_file = None - self._outputs = {} # file_name -> generator - - def wrap_with_condition(self, string, condition): - if not condition: - return string - return "#if ENABLE(%(condition)s)\n%(string)s\n#endif" % { 'condition' : condition, 'string' : string } - - def _forcibly_create_text_file_at_path_with_contents(self, file_path, contents): - # FIXME: This method can be made less force-full anytime after 6/1/2013. - # A gyp error was briefly checked into the tree, causing - # a directory to have been generated in place of one of - # our output files. Clean up after that error so that - # all users don't need to clobber their output directories. - shutil.rmtree(file_path, ignore_errors=True) - # The build system should ensure our output directory exists, but just in case. - directory = os.path.dirname(file_path) - if not os.path.exists(directory): - os.makedirs(directory) - - with open(file_path, "w") as file_to_write: - file_to_write.write(contents) - - def _write_file(self, output_dir, contents, file_name): - path = os.path.join(output_dir, file_name) - self._forcibly_create_text_file_at_path_with_contents(path, contents) - - def write_files(self, output_dir): - for file_name, generator in self._outputs.items(): - self._write_file(output_dir, generator(), file_name) - - -class Maker(object): - def __init__(self, writer_class): - self._writer_class = writer_class - - def main(self, argv): - script_name = os.path.basename(argv[0]) - args = argv[1:] - if len(args) < 1: - print "USAGE: %s INPUT_FILES" % script_name - exit(1) - - parser = optparse.OptionParser() - parser.add_option("--output_dir", default=os.getcwd()) - options, args = parser.parse_args() - - writer = self._writer_class(args) - writer.write_files(options.output_dir) diff --git a/sky/engine/build/scripts/license.py b/sky/engine/build/scripts/license.py deleted file mode 100644 index 692e6dd4bc970e80ab330d93c16d52cb7ed4b10f..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/license.py +++ /dev/null @@ -1,35 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -# FIXME: We should either not use license blocks in generated files -# or we should read this from some central license file. - -def license_for_generated_cpp(): - return """// Copyright (c) 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file.""" diff --git a/sky/engine/build/scripts/make_names.py b/sky/engine/build/scripts/make_names.py deleted file mode 100755 index 71e59179af3610b470b21771dc8ad9fcb0a941d3..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/make_names.py +++ /dev/null @@ -1,97 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import sys - -import hasher -import in_generator -import template_expander -import name_utilities - -def _symbol(entry): - if entry['Symbol'] is not None: - return entry['Symbol'] - # FIXME: Remove this special case for the ugly x-webkit-foo attributes. - if entry['name'].startswith('-webkit-'): - return entry['name'].replace('-', '_')[1:] - return name_utilities.cpp_name(entry).replace('-', '_') - - -class MakeNamesWriter(in_generator.Writer): - defaults = { - 'Conditional': None, # FIXME: Add support for Conditional. - 'ImplementedAs': None, - 'RuntimeEnabled': None, # What should we do for runtime-enabled features? - 'Symbol': None, - } - default_parameters = { - 'export': '', - 'namespace': '', - 'suffix': '', - } - filters = { - 'cpp_name': name_utilities.cpp_name, - 'enable_conditional': name_utilities.enable_conditional_if_endif, - 'hash': hasher.hash, - 'script_name': name_utilities.script_name, - 'symbol': _symbol, - 'to_macro_style': name_utilities.to_macro_style, - } - - def __init__(self, in_file_path): - super(MakeNamesWriter, self).__init__(in_file_path) - - namespace = self.in_file.parameters['namespace'].strip('"') - suffix = self.in_file.parameters['suffix'].strip('"') - export = self.in_file.parameters['export'].strip('"') - - assert namespace, 'A namespace is required.' - - self._outputs = { - (namespace + suffix + 'Names.h'): self.generate_header, - (namespace + suffix + 'Names.cpp'): self.generate_implementation, - } - self._template_context = { - 'namespace': namespace, - 'suffix': suffix, - 'export': export, - 'entries': self.in_file.name_dictionaries, - } - - @template_expander.use_jinja("MakeNames.h.tmpl", filters=filters) - def generate_header(self): - return self._template_context - - @template_expander.use_jinja("MakeNames.cpp.tmpl", filters=filters) - def generate_implementation(self): - return self._template_context - - -if __name__ == "__main__": - in_generator.Maker(MakeNamesWriter).main(sys.argv) diff --git a/sky/engine/build/scripts/make_runtime_features.py b/sky/engine/build/scripts/make_runtime_features.py deleted file mode 100755 index 37fb09c891767590199bc2008707d1d4b7f8508a..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/make_runtime_features.py +++ /dev/null @@ -1,99 +0,0 @@ -#!/usr/bin/env python -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import sys - -import in_generator -import name_utilities -from name_utilities import lower_first -import template_expander - - -class RuntimeFeatureWriter(in_generator.Writer): - class_name = 'RuntimeEnabledFeatures' - filters = { - 'enable_conditional': name_utilities.enable_conditional_if_endif, - } - - # FIXME: valid_values and defaults should probably roll into one object. - valid_values = { - 'status': ['stable', 'experimental', 'test', 'deprecated'], - } - defaults = { - 'condition' : None, - 'depends_on' : [], - 'custom': False, - 'status': None, - } - - _status_aliases = { - 'deprecated': 'test', - } - - def __init__(self, in_file_path): - super(RuntimeFeatureWriter, self).__init__(in_file_path) - self._outputs = {(self.class_name + '.h'): self.generate_header, - (self.class_name + '.cpp'): self.generate_implementation, - } - - self._features = self.in_file.name_dictionaries - # Make sure the resulting dictionaries have all the keys we expect. - for feature in self._features: - feature['first_lowered_name'] = lower_first(feature['name']) - feature['status'] = self._status_aliases.get(feature['status'], feature['status']) - # Most features just check their isFooEnabled bool - # but some depend on more than one bool. - enabled_condition = 'is%sEnabled' % feature['name'] - for dependant_name in feature['depends_on']: - enabled_condition += ' && is%sEnabled' % dependant_name - feature['enabled_condition'] = enabled_condition - self._non_custom_features = filter(lambda feature: not feature['custom'], self._features) - - def _feature_sets(self): - # Another way to think of the status levels is as "sets of features" - # which is how we're referring to them in this generator. - return [status for status in self.valid_values['status'] if status not in self._status_aliases] - - @template_expander.use_jinja(class_name + '.h.tmpl', filters=filters) - def generate_header(self): - return { - 'features': self._features, - 'feature_sets': self._feature_sets(), - } - - @template_expander.use_jinja(class_name + '.cpp.tmpl', filters=filters) - def generate_implementation(self): - return { - 'features': self._features, - 'feature_sets': self._feature_sets(), - } - - -if __name__ == '__main__': - in_generator.Maker(RuntimeFeatureWriter).main(sys.argv) diff --git a/sky/engine/build/scripts/name_utilities.py b/sky/engine/build/scripts/name_utilities.py deleted file mode 100644 index 274c5039ddd450de59ece11ed8b3663e00482e66..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/name_utilities.py +++ /dev/null @@ -1,97 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os.path -import re - - -ACRONYMS = [ - 'CSSOM', - 'CSS', - 'DNS', - 'FE', - 'FTP', - 'HTML', - 'IME', - 'JS', - 'SVG', - 'URL', - 'WOFF', - 'XML', - 'XSLT', - 'XSS', -] - - -def lower_first(name): - """Return name with first letter or initial acronym lowercased. - - E.g., 'SetURL' becomes 'setURL', but 'URLFoo' becomes 'urlFoo'. - """ - for acronym in ACRONYMS: - if name.startswith(acronym): - return name.replace(acronym, acronym.lower(), 1) - return name[0].lower() + name[1:] - - -def upper_first(name): - """Return name with first letter or initial acronym uppercased.""" - for acronym in ACRONYMS: - if name.startswith(acronym.lower()): - return name.replace(acronym.lower(), acronym, 1) - return _upper_first(name) - - -def _upper_first(name): - """Return name with first letter uppercased.""" - if not name: - return '' - return name[0].upper() + name[1:] - - -def to_macro_style(name): - s1 = re.sub('(.)([A-Z][a-z]+)', r'\1_\2', name) - return re.sub('([a-z0-9])([A-Z])', r'\1_\2', s1).upper() - - -def script_name(entry): - return os.path.basename(entry['name']) - - -def cpp_name(entry): - return entry['ImplementedAs'] or script_name(entry) - - -def enable_conditional_if_endif(code, feature): - # Jinja2 filter to generate if/endif directive blocks based on a feature - if not feature: - return code - condition = 'ENABLE(%s)' % feature - return ('#if %s\n' % condition + - code + - '#endif // %s\n' % condition) diff --git a/sky/engine/build/scripts/scripts.gni b/sky/engine/build/scripts/scripts.gni deleted file mode 100644 index 957f319bbbafb93b7bca0b8f0c1baf277f733517..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/scripts.gni +++ /dev/null @@ -1,29 +0,0 @@ -# Copyright 2014 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -import("//sky/engine/config.gni") - -# All paths in this file should be absolute so targets in any directory can use -# them without worrying about the current directory. -_scripts_dir = "//sky/engine/build/scripts" - -scripts_for_in_files = [ - # jinja2/__init__.py contains version string, so sufficient as - # dependency for whole jinja2 package - "//third_party/jinja2/__init__.py", - "//third_party/markupsafe/__init__.py", # jinja2 dep - "$_scripts_dir/hasher.py", - "$_scripts_dir/in_file.py", - "$_scripts_dir/in_generator.py", - "$_scripts_dir/license.py", - "$_scripts_dir/name_utilities.py", - "$_scripts_dir/template_expander.py", - "$_scripts_dir/templates/macros.tmpl", -] - -make_names_files = scripts_for_in_files + [ - "$_scripts_dir/make_names.py", - "$_scripts_dir/templates/MakeNames.cpp.tmpl", - "$_scripts_dir/templates/MakeNames.h.tmpl", - ] diff --git a/sky/engine/build/scripts/template_expander.py b/sky/engine/build/scripts/template_expander.py deleted file mode 100644 index bf010f74c5afc0c2c9d32ff226089ab81f1af2b3..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/template_expander.py +++ /dev/null @@ -1,61 +0,0 @@ -# Copyright (C) 2013 Google Inc. All rights reserved. -# -# Redistribution and use in source and binary forms, with or without -# modification, are permitted provided that the following conditions are -# met: -# -# * Redistributions of source code must retain the above copyright -# notice, this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above -# copyright notice, this list of conditions and the following disclaimer -# in the documentation and/or other materials provided with the -# distribution. -# * Neither the name of Google Inc. nor the names of its -# contributors may be used to endorse or promote products derived from -# this software without specific prior written permission. -# -# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -import os -import sys - -_current_dir = os.path.dirname(os.path.realpath(__file__)) -# jinja2 is in chromium's third_party directory -# Insert at front to override system libraries, and after path[0] == script dir -sys.path.insert(1, os.path.join( - _current_dir, os.pardir, os.pardir, os.pardir, os.pardir, 'third_party')) -import jinja2 - - -def apply_template(path_to_template, params, filters=None): - dirname, basename = os.path.split(path_to_template) - path_to_templates = os.path.join(_current_dir, 'templates') - jinja_env = jinja2.Environment( - loader=jinja2.FileSystemLoader([dirname, path_to_templates]), - keep_trailing_newline=True, # newline-terminate generated files - lstrip_blocks=True, # so can indent control flow tags - trim_blocks=True) # so don't need {%- -%} everywhere - if filters: - jinja_env.filters.update(filters) - template = jinja_env.get_template(basename) - return template.render(params) - - -def use_jinja(template_file_name, filters=None): - def real_decorator(generator): - def generator_internal(*args, **kwargs): - parameters = generator(*args, **kwargs) - return apply_template(template_file_name, parameters, filters=filters) - generator_internal.func_name = generator.func_name - return generator_internal - return real_decorator diff --git a/sky/engine/build/scripts/templates/MakeNames.cpp.tmpl b/sky/engine/build/scripts/templates/MakeNames.cpp.tmpl deleted file mode 100644 index a641f33d53057e4403d866117ccf163e27abedd2..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/templates/MakeNames.cpp.tmpl +++ /dev/null @@ -1,35 +0,0 @@ -{% from "macros.tmpl" import license %} -{{ license() }} - -#include "{{namespace}}{{suffix}}Names.h" - -#include "wtf/StaticConstructors.h" - -namespace blink { -namespace {{namespace}}Names { - -using namespace WTF; - -{% for entry in entries|sort %} -{% filter enable_conditional(entry.Conditional) %} -DEFINE_GLOBAL(AtomicString, {{entry|symbol}}) -{% endfilter %} -{% endfor %} - -void init{{suffix}}() -{ - {% for entry in entries|sort %} - {% filter enable_conditional(entry.Conditional) %} - StringImpl* {{entry|symbol}}Impl = StringImpl::createStatic("{{entry|cpp_name}}", {{entry|cpp_name|length}}, {{entry|cpp_name|hash}}); - {% endfilter %} - {% endfor %} - - {% for entry in entries|sort %} - {% filter enable_conditional(entry.Conditional) %} - new ((void*)&{{entry|symbol}}) AtomicString({{entry|symbol}}Impl); - {% endfilter %} - {% endfor %} -} - -} // {{namespace}}Names -} // namespace blink diff --git a/sky/engine/build/scripts/templates/MakeNames.h.tmpl b/sky/engine/build/scripts/templates/MakeNames.h.tmpl deleted file mode 100644 index ce63250b61d2c83269f5c282e9b2e965f9924b1d..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/templates/MakeNames.h.tmpl +++ /dev/null @@ -1,34 +0,0 @@ -{% from "macros.tmpl" import license %} -{{ license() }} - -#ifndef {{namespace}}{{suffix}}Names_h -#define {{namespace}}{{suffix}}Names_h - -{% if suffix %} -#include "core/{{namespace}}Names.h" -{% else %} -{% if export %} -#include "platform/PlatformExport.h" -{% endif %} -#include "wtf/text/AtomicString.h" -{% endif %} - -namespace blink { -namespace {{namespace}}Names { - -{% for entry in entries|sort %} -{% filter enable_conditional(entry.Conditional) %} -{% if export %} -{{export}} extern const WTF::AtomicString& {{entry|symbol}}; -{% else %} -extern const WTF::AtomicString& {{entry|symbol}}; -{% endif %} -{% endfilter %} -{% endfor %} - -{{export}} void init{{suffix}}(); - -} // {{namespace}}Names -} // namespace blink - -#endif diff --git a/sky/engine/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl b/sky/engine/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl deleted file mode 100644 index ff020894be95dd3a8507ec10fb26bace62031500..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl +++ /dev/null @@ -1,23 +0,0 @@ -{% from 'macros.tmpl' import license %} -{{license()}} - -#include "gen/sky/platform/RuntimeEnabledFeatures.h" - -namespace blink { - -{% for feature_set in feature_sets %} -void RuntimeEnabledFeatures::set{{feature_set|capitalize}}FeaturesEnabled(bool enable) -{ - {% for feature in features if feature.status == feature_set %} - set{{feature.name}}Enabled(enable); - {% endfor %} -} - -{% endfor %} -{% for feature in features if not feature.custom %} -{% filter enable_conditional(feature.condition) %} -bool RuntimeEnabledFeatures::is{{feature.name}}Enabled = {{'true' if feature.status == 'stable' else 'false'}}; -{% endfilter %} -{% endfor %} - -} // namespace blink diff --git a/sky/engine/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl b/sky/engine/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl deleted file mode 100644 index da339642eac49b737bf92303e8b8b9c10c44bb02..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl +++ /dev/null @@ -1,51 +0,0 @@ -{% from 'macros.tmpl' import license %} -{{license()}} - -#ifndef RuntimeEnabledFeatures_h -#define RuntimeEnabledFeatures_h - -#include "platform/PlatformExport.h" - -namespace blink { - -// A class that stores static enablers for all experimental features. - -class PLATFORM_EXPORT RuntimeEnabledFeatures { -public: - {% for feature_set in feature_sets %} - static void set{{feature_set|capitalize}}FeaturesEnabled(bool); - {% endfor %} - - - {% 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: - RuntimeEnabledFeatures() { } - - {% for feature in features if not feature.custom %} - {% filter enable_conditional(feature.condition) %} - static bool is{{feature.name}}Enabled; - {% endfilter %} - {% endfor %} -}; - -} // namespace blink - -#endif // RuntimeEnabledFeatures_h diff --git a/sky/engine/build/scripts/templates/macros.tmpl b/sky/engine/build/scripts/templates/macros.tmpl deleted file mode 100644 index 064dd985221d257994df2387b101d11eb14a634d..0000000000000000000000000000000000000000 --- a/sky/engine/build/scripts/templates/macros.tmpl +++ /dev/null @@ -1,8 +0,0 @@ -{# - FIXME: Do we need to put license blocks in generated files? -#} -{% macro license() %} -// Copyright (c) 2014 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -{%- endmacro %} diff --git a/sky/engine/core/BUILD.gn b/sky/engine/core/BUILD.gn index f211572e1e8bce649c6353dc0712ad19afe5f81f..a6aece716169100e7de4ce1b50f3b500beb7b412 100644 --- a/sky/engine/core/BUILD.gn +++ b/sky/engine/core/BUILD.gn @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import("//sky/engine/build/scripts/scripts.gni") import("//sky/engine/core/core.gni") import("//mojo/dart/embedder/embedder.gni") diff --git a/sky/engine/core/rendering/InlineTextBox.cpp b/sky/engine/core/rendering/InlineTextBox.cpp index 3ef4ef10e22baab37a372dff1451601d31ff06b4..389bce21cc723f4d11b80962cac26933a1d42d05 100644 --- a/sky/engine/core/rendering/InlineTextBox.cpp +++ b/sky/engine/core/rendering/InlineTextBox.cpp @@ -22,7 +22,6 @@ #include "sky/engine/core/rendering/InlineTextBox.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/editing/CompositionUnderline.h" #include "sky/engine/core/editing/CompositionUnderlineRangeFilter.h" #include "sky/engine/core/rendering/HitTestResult.h" @@ -397,9 +396,7 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, // subpixel boundaries on the x-axis and thus there is no reason to // snap the x value. We still round the y-axis to ensure consistent // line heights. - LayoutPoint adjustedPaintOffset = RuntimeEnabledFeatures::subpixelFontScalingEnabled() - ? LayoutPoint(paintOffset.x(), paintOffset.y().round()) - : roundedIntPoint(paintOffset); + LayoutPoint adjustedPaintOffset = LayoutPoint(paintOffset.x(), paintOffset.y().round()); if (logicalStart >= paintEnd || logicalStart + logicalExtent <= paintStart) return; @@ -490,13 +487,13 @@ void InlineTextBox::paint(PaintInfo& paintInfo, const LayoutPoint& paintOffset, // FIXME: This cache should probably ultimately be held somewhere else. // A hashmap is convenient to avoid a memory hit when the // RuntimeEnabledFeature is off. - bool textBlobIsCacheable = RuntimeEnabledFeatures::textBlobEnabled() && startOffset == 0 && endOffset == length; + bool textBlobIsCacheable = startOffset == 0 && endOffset == length; TextBlobPtr* cachedTextBlob = textBlobIsCacheable ? &m_cachedTextBlob : nullptr; paintTextWithEmphasisMark(context, font, textStyle, textRun, emphasisMark, emphasisMarkOffset, startOffset, endOffset, length, textOrigin, boxRect, cachedTextBlob); if (paintSelectedTextSeparately && sPos < ePos) { // paint only the text that is selected - bool textBlobIsCacheable = RuntimeEnabledFeatures::textBlobEnabled() && sPos == 0 && ePos == length; + bool textBlobIsCacheable = sPos == 0 && ePos == length; TextBlobPtr* cachedTextBlob = textBlobIsCacheable ? &m_cachedTextBlob : nullptr; paintTextWithEmphasisMark(context, font, selectionStyle, textRun, emphasisMark, emphasisMarkOffset, sPos, ePos, length, textOrigin, boxRect, cachedTextBlob); } diff --git a/sky/engine/core/rendering/RenderLayer.cpp b/sky/engine/core/rendering/RenderLayer.cpp index ebb2315b0c6b99a7097e770ded8d9abb9eaf3033..250340b5724ae391f3dcdac2e78db4fdabfed371 100644 --- a/sky/engine/core/rendering/RenderLayer.cpp +++ b/sky/engine/core/rendering/RenderLayer.cpp @@ -43,7 +43,6 @@ #include "sky/engine/core/rendering/RenderLayer.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/rendering/HitTestRequest.h" #include "sky/engine/core/rendering/HitTestResult.h" #include "sky/engine/core/rendering/HitTestingTransformState.h" diff --git a/sky/engine/core/rendering/RenderObject.cpp b/sky/engine/core/rendering/RenderObject.cpp index cb76d2fd8631573a5dc8bcaabb20c4114970b514..4954a7029bc59a992fa2b8a3d8ded23a8f0d78e0 100644 --- a/sky/engine/core/rendering/RenderObject.cpp +++ b/sky/engine/core/rendering/RenderObject.cpp @@ -27,7 +27,6 @@ #include "sky/engine/core/rendering/RenderObject.h" #include -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/rendering/HitTestResult.h" #include "sky/engine/core/rendering/RenderFlexibleBox.h" #include "sky/engine/core/rendering/RenderGeometryMap.h" diff --git a/sky/engine/core/rendering/RenderReplaced.cpp b/sky/engine/core/rendering/RenderReplaced.cpp index 5984c501fb1df021d0dec73625c6806bbaa758e9..73c30c2f20b694376613beb64518975887bf3d50 100644 --- a/sky/engine/core/rendering/RenderReplaced.cpp +++ b/sky/engine/core/rendering/RenderReplaced.cpp @@ -23,7 +23,6 @@ #include "sky/engine/core/rendering/RenderReplaced.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/rendering/RenderBlock.h" #include "sky/engine/core/rendering/RenderLayer.h" #include "sky/engine/core/rendering/RenderView.h" @@ -203,11 +202,8 @@ LayoutRect RenderReplaced::replacedContentRect(const LayoutSize* overriddenIntri LayoutRect contentRect = contentBoxRect(); ObjectFit objectFit = style()->objectFit(); - if (objectFit == ObjectFitFill && style()->objectPosition() == RenderStyle::initialObjectPosition()) { - if (RuntimeEnabledFeatures::objectFitPositionEnabled()) - return contentRect; + if (objectFit == ObjectFitFill && style()->objectPosition() == RenderStyle::initialObjectPosition()) objectFit = ObjectFitContain; - } LayoutSize intrinsicSize = overriddenIntrinsicSize ? *overriddenIntrinsicSize : this->intrinsicSize(); if (!intrinsicSize.width() || !intrinsicSize.height()) diff --git a/sky/engine/core/rendering/RenderTheme.cpp b/sky/engine/core/rendering/RenderTheme.cpp index 0f65c7e6cce54b26bf134f0b043963e952330689..3ec585878029c95c0370fc1a36283151a28275f3 100644 --- a/sky/engine/core/rendering/RenderTheme.cpp +++ b/sky/engine/core/rendering/RenderTheme.cpp @@ -21,7 +21,6 @@ #include "sky/engine/core/rendering/RenderTheme.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/rendering/PaintInfo.h" #include "sky/engine/core/rendering/RenderView.h" #include "sky/engine/core/rendering/style/RenderStyle.h" diff --git a/sky/engine/core/rendering/RenderView.cpp b/sky/engine/core/rendering/RenderView.cpp index 53da7c5a38cf3b768b4074c24b2d5cd40a98ba02..230b5ddb14f60d5593a1c315585db3541734ef43 100644 --- a/sky/engine/core/rendering/RenderView.cpp +++ b/sky/engine/core/rendering/RenderView.cpp @@ -20,7 +20,6 @@ #include "sky/engine/core/rendering/RenderView.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/rendering/HitTestResult.h" #include "sky/engine/core/rendering/RenderGeometryMap.h" #include "sky/engine/core/rendering/RenderLayer.h" diff --git a/sky/engine/core/rendering/style/RenderStyle.cpp b/sky/engine/core/rendering/style/RenderStyle.cpp index d78e7f34991e8cf753f9b4e3b16d173d367133bb..4436a05dc2034e88ac92e7da967c179d0f6fb225 100644 --- a/sky/engine/core/rendering/style/RenderStyle.cpp +++ b/sky/engine/core/rendering/style/RenderStyle.cpp @@ -23,7 +23,6 @@ #include "sky/engine/core/rendering/style/RenderStyle.h" #include -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/core/rendering/RenderTheme.h" #include "sky/engine/core/rendering/style/AppliedTextDecoration.h" #include "sky/engine/core/rendering/style/DataEquivalency.h" diff --git a/sky/engine/core/script/dart_init.cc b/sky/engine/core/script/dart_init.cc index c245e31d766f8c022b60faf5217eabb2135e1f9c..e4cd612384fb114a9fce62f01f877d93b6991360 100644 --- a/sky/engine/core/script/dart_init.cc +++ b/sky/engine/core/script/dart_init.cc @@ -12,7 +12,6 @@ #include "base/trace_event/trace_event.h" #include "dart/runtime/bin/embedded_dart_io.h" #include "dart/runtime/include/dart_mirrors_api.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "mojo/public/platform/dart/dart_handle_watcher.h" #include "sky/engine/bindings/dart_mojo_internal.h" #include "sky/engine/bindings/dart_runtime_hooks.h" @@ -20,6 +19,7 @@ #include "sky/engine/core/script/dart_debugger.h" #include "sky/engine/core/script/dart_service_isolate.h" #include "sky/engine/core/script/dom_dart_state.h" +#include "sky/engine/public/platform/sky_settings.h" #include "sky/engine/tonic/dart_api_scope.h" #include "sky/engine/tonic/dart_class_library.h" #include "sky/engine/tonic/dart_dependency_catcher.h" @@ -122,7 +122,7 @@ Dart_Isolate IsolateCreateCallback(const char* script_uri, DartUI::InitForIsolate(); DartMojoInternal::InitForIsolate(); DartRuntimeHooks::Install(DartRuntimeHooks::DartIOIsolate); - if (RuntimeEnabledFeatures::observatoryEnabled()) { + if (SkySettings::Get().enable_observatory) { std::string ip = "127.0.0.1"; const intptr_t port = 8181; const bool service_isolate_booted = DartServiceIsolate::Startup( @@ -268,7 +268,7 @@ void InitDartVM() { DartMojoInternal::SetHandleWatcherProducerHandle( mojo::dart::HandleWatcher::Start()); - bool enable_checked_mode = RuntimeEnabledFeatures::dartCheckedModeEnabled(); + bool enable_checked_mode = SkySettings::Get().enable_dart_checked_mode; #if ENABLE(DART_STRICT) enable_checked_mode = true; #endif diff --git a/sky/engine/platform/BUILD.gn b/sky/engine/platform/BUILD.gn index 1e59be4c5e3a7c094049157da02ee1739de641d5..ef7d6a4383c5fd36fb7944ae2544cc5a761b5d5e 100644 --- a/sky/engine/platform/BUILD.gn +++ b/sky/engine/platform/BUILD.gn @@ -3,47 +3,10 @@ # found in the LICENSE file. import("//build/config/ui.gni") -import("//sky/engine/build/scripts/scripts.gni") import("//sky/engine/config.gni") import("//testing/test.gni") -# Most targets in this file are private actions so use that as the default. -visibility = [ ":*" ] - -sky_platform_output_dir = "$root_gen_dir/sky/platform" - -action("runtime_enabled_features") { - script = "../build/scripts/make_runtime_features.py" - - runtime_enabled_features_in = "RuntimeEnabledFeatures.in" - inputs = scripts_for_in_files + [ - runtime_enabled_features_in, - "../build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl", - "../build/scripts/templates/RuntimeEnabledFeatures.h.tmpl", - ] - - outputs = [ - "$sky_platform_output_dir/RuntimeEnabledFeatures.cpp", - "$sky_platform_output_dir/RuntimeEnabledFeatures.h", - ] - - args = [ - rebase_path(runtime_enabled_features_in, root_build_dir), - "--output_dir", - rebase_path(sky_platform_output_dir, root_build_dir), - ] -} - -group("make_platform_generated") { - visibility += [ ":*" ] - deps = [ - ":runtime_enabled_features", - ] -} - source_set("platform") { - visibility += [ "//sky/*" ] - sources = [ "CalculationValue.h", "Decimal.cpp", @@ -92,6 +55,7 @@ source_set("platform") { "animation/UnitBezier.h", "exported/Platform.cpp", "exported/ServiceProvider.cpp", + "exported/sky_settings.cc", "exported/WebArrayBuffer.cpp", "exported/WebCString.cpp", "exported/WebCommon.cpp", @@ -433,9 +397,6 @@ source_set("platform") { sources += [ "fonts/apple/FontPlatformDataApple.cpp" ] } - # Add in the generated files. - sources += get_target_outputs(":runtime_enabled_features") - configs += [ "//sky/engine:config", "//sky/engine:non_test_config", @@ -449,7 +410,6 @@ source_set("platform") { include_dirs = [ "$root_build_dir" ] deps = [ - ":make_platform_generated", "//base:base", "//mojo/application", "//mojo/data_pipe_utils", @@ -497,7 +457,6 @@ source_set("platform") { } test("platform_unittests") { - visibility += [ "//sky/*" ] output_name = "sky_platform_unittests" sources = [ diff --git a/sky/engine/platform/RuntimeEnabledFeatures.in b/sky/engine/platform/RuntimeEnabledFeatures.in deleted file mode 100644 index 00403a060b68c1997ea983f5a79f37414570524a..0000000000000000000000000000000000000000 --- a/sky/engine/platform/RuntimeEnabledFeatures.in +++ /dev/null @@ -1,123 +0,0 @@ -// http://dev.chromium.org/blink/runtime-enabled-features -// -// This list is used to generate RuntimeEnabledFeatures.h/cpp which contains -// a class that stores static enablers for all experimental features. -// -// Each feature can be assigned a "status": -// status=stable -> Enable this in all Blink configurations. We are committed to these APIs indefinitely. -// status=experimental -> In-progress features, Web Developers might play with, but are not on by default in stable. -// status=test -> Enabled in ContentShell for testing, otherwise off. -// status=deprecated -> Alias for "test", will be removed at some point. -// Features without a status are not enabled anywhere by default. -// -// "stable" features listed here should be rare, as anything which we've shipped stable -// can have its runtime flag removed soon after. -// -// condition=ENABLE_NAME is used for wrapping features in compile-time -// #if ENABLE(FEATURE) guards. These are deprecated and should all be removed. - -AnyPointerMediaQueries status=experimental -AudioVideoTracks depends_on=Media, status=experimental -AuthorShadowDOMForAnyElement -Beacon status=stable - -// This feature is deprecated and we are evangalizing affected sites. -// See https://crbug.com/346236 for current status. -PrefixedVideoFullscreen status=stable - -// Enable bleeding-edge code to make Blink draw content faster. -// The changes enabled behind this flag are very likely to break lots of content. -// ** DO NOT use this flag unless you know what you are doing. ** -BleedingEdgeFastPaths - -ClientHintsDpr status=experimental -Crypto status=stable -CSSAttributeCaseSensitivity status=experimental -CSSTouchActionDelay status=test -CSSViewport status=experimental -CSS3Text status=experimental -CSS3TextDecorations status=stable -CustomSchemeHandler depends_on=NavigatorContentUtils, status=experimental -Database status=stable -DeviceLight status=experimental -SVGFontsOnNonGDIPlatforms -EncodingAPI status=stable -EncryptedMedia status=test -EncryptedMediaAnyVersion status=stable -ExecCommandInJavaScript status=test -ExperimentalCanvasFeatures status=test -ExperimentalWebSocket status=stable -FileAPIBlobClose status=experimental -FileConstructor status=stable -FileSystem status=stable -FullscreenUnprefixed status=test -Geofencing status=test -GeometryInterfaces status=test -IMEAPI status=experimental -ImageDataConstructor status=experimental -ImageRenderingPixelated status=stable -IndexedDBExperimental status=experimental -InputModeAttribute status=experimental -LangAttributeAwareFormControlUI -LayerSquashing status=stable -PrefixedEncryptedMedia status=stable -LocalStorage status=stable -Manifest status=test -Media status=stable -MediaCapture -MediaQueryParser status=stable -MediaSource status=stable -MediaSourceExperimental depends_on=MediaSource, status=experimental -NavigationTransitions status=experimental -NavigatorContentUtils -NetworkInformation status=stable -Notifications status=stable -ObjectFitPosition status=stable -OrientationEvent -// Only enabled on Android, and for certain layout tests on Linux. -OverlayFullscreenVideo -PathOpsSVGClipping status=stable -PreciseMemoryInfo -PushMessaging status=experimental -QuotaPromise status=experimental -RegionBasedColumns status=experimental - -RequestAutocomplete status=test -ScreenOrientation status=stable - -SessionStorage status=stable -PictureSizes status=stable -Picture status=stable - -// Lax Mixed Content checking for WebSockets, XHR, etc. is deprecated and slated for removal. crbug.com/389089 -LaxMixedContentChecking status=deprecated - -Stream status=experimental -SubpixelFontScaling status=stable - -// Enable optimizations to recalculate style on the fewest possible number of -// elements when updating classes, ids or attributes of DOM elements. -TargetedStyleRecalc status=stable - -// Many websites disable mouse support when touch APIs are available. We'd -// like to enable this always but can't until more websites fix this bug. -// Chromium sets this conditionally (eg. based on the presence of a -// touchscreen) in ApplyWebPreferences. -Touch status=stable - -// Temporary setting to allow easy rollback of change to hover media feature. -HoverMediaQueryKeywords status=stable - -TextBlob status=stable -TouchIconLoading -UserSelectAll status=experimental -WebGLDraftExtensions status=experimental -WebGLImageChromium -WOFF2 status=stable - -PseudoClassesInMatchingCriteriaInAuthorShadowTrees status=test - -CredentialManager status=test - -Observatory status=stable -DartCheckedMode diff --git a/sky/engine/platform/exported/sky_settings.cc b/sky/engine/platform/exported/sky_settings.cc new file mode 100644 index 0000000000000000000000000000000000000000..50ea2080144e64594591dbd50d77499164ab7d62 --- /dev/null +++ b/sky/engine/platform/exported/sky_settings.cc @@ -0,0 +1,24 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "sky/engine/public/platform/sky_settings.h" + +#include "base/logging.h" + +namespace blink { + +static SkySettings s_settings; +static bool s_have_settings = false; + +const SkySettings& SkySettings::Get() { + return s_settings; +} + +void SkySettings::Set(const SkySettings& settings) { + CHECK(!s_have_settings); + s_settings = settings; + s_have_settings = true; +} + +} // namespace blink diff --git a/sky/engine/platform/fonts/Font.cpp b/sky/engine/platform/fonts/Font.cpp index 8791dc67bbb5dd016cb08ed8936cb5d572a5d13a..eba0973fe1996afce00caa0e00d4525d03d53cfa 100644 --- a/sky/engine/platform/fonts/Font.cpp +++ b/sky/engine/platform/fonts/Font.cpp @@ -23,7 +23,6 @@ #include "sky/engine/platform/fonts/Font.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/platform/LayoutUnit.h" #include "sky/engine/platform/fonts/Character.h" #include "sky/engine/platform/fonts/FontCache.h" @@ -143,7 +142,6 @@ void Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo, return; if (runInfo.cachedTextBlob && runInfo.cachedTextBlob->get()) { - ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); // we have a pre-cached blob -- happy joy! drawTextBlob(context, runInfo.cachedTextBlob->get(), point.data()); return; @@ -157,18 +155,16 @@ void Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo, if (glyphBuffer.isEmpty()) return; - if (RuntimeEnabledFeatures::textBlobEnabled()) { - // Enabling text-blobs forces the blob rendering path even for uncacheable blobs. - TextBlobPtr uncacheableTextBlob; - TextBlobPtr& textBlob = runInfo.cachedTextBlob ? *runInfo.cachedTextBlob : uncacheableTextBlob; - FloatRect blobBounds = runInfo.bounds; - blobBounds.moveBy(-point); - - textBlob = buildTextBlob(glyphBuffer, initialAdvance, blobBounds); - if (textBlob) { - drawTextBlob(context, textBlob.get(), point.data()); - return; - } + // Enabling text-blobs forces the blob rendering path even for uncacheable blobs. + TextBlobPtr uncacheableTextBlob; + TextBlobPtr& textBlob = runInfo.cachedTextBlob ? *runInfo.cachedTextBlob : uncacheableTextBlob; + FloatRect blobBounds = runInfo.bounds; + blobBounds.moveBy(-point); + + textBlob = buildTextBlob(glyphBuffer, initialAdvance, blobBounds); + if (textBlob) { + drawTextBlob(context, textBlob.get(), point.data()); + return; } drawGlyphBuffer(context, runInfo, glyphBuffer, FloatPoint(point.x() + initialAdvance, point.y())); diff --git a/sky/engine/platform/fonts/FontCache.cpp b/sky/engine/platform/fonts/FontCache.cpp index 77b6f5fe40350f150ac4c1e7962168b77faf949f..55668710ac98da261de7038044b595acea9e1c5a 100644 --- a/sky/engine/platform/fonts/FontCache.cpp +++ b/sky/engine/platform/fonts/FontCache.cpp @@ -29,7 +29,6 @@ #include "sky/engine/platform/fonts/FontCache.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/platform/fonts/AlternateFontFamily.h" #include "sky/engine/platform/fonts/FontCacheClient.h" #include "sky/engine/platform/fonts/FontCacheKey.h" diff --git a/sky/engine/platform/fonts/FontDescription.cpp b/sky/engine/platform/fonts/FontDescription.cpp index e36c2d98e61055f033da212c72972f0edbc812d1..575a08edeb30fd6232c4180227febde15904da22 100644 --- a/sky/engine/platform/fonts/FontDescription.cpp +++ b/sky/engine/platform/fonts/FontDescription.cpp @@ -29,7 +29,6 @@ #include "sky/engine/platform/fonts/FontDescription.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/wtf/text/AtomicStringHash.h" #include "sky/engine/wtf/text/StringHash.h" @@ -132,9 +131,7 @@ void FontDescription::setVariantLigatures(const VariantLigatures& ligatures) float FontDescription::effectiveFontSize() const { - float size = (RuntimeEnabledFeatures::subpixelFontScalingEnabled()) - ? computedSize() - : computedPixelSize(); + float size = computedSize(); // Ensure that the effective precision matches the font-cache precision. // This guarantees that the same precision is used regardless of cache status. diff --git a/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp b/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp index 8042ec4a47a33270d2c0f4c759afe0336b31f2b9..2a5bbd1ddb106497b864470387ca08786eecaa03 100644 --- a/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp +++ b/sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp @@ -30,7 +30,6 @@ #include "sky/engine/platform/fonts/Font.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/platform/fonts/FontPlatformFeatures.h" #include "sky/engine/platform/fonts/GlyphBuffer.h" #include "sky/engine/platform/fonts/SimpleFontData.h" @@ -206,8 +205,6 @@ void Font::drawGlyphs(GraphicsContext* gc, const SimpleFontData* font, void Font::drawTextBlob(GraphicsContext* gc, const SkTextBlob* blob, const SkPoint& origin) const { - ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); - // FIXME: It would be good to move this to Font.cpp, if we're sure that none // of the things in FontMac's setupPaint need to apply here. // See also paintGlyphs. @@ -316,8 +313,6 @@ bool buildTextBlobInternal(const GlyphBuffer& glyphBuffer, SkScalar initialAdvan PassTextBlobPtr Font::buildTextBlob(const GlyphBuffer& glyphBuffer, float initialAdvance, const FloatRect& bounds) const { - ASSERT(RuntimeEnabledFeatures::textBlobEnabled()); - SkTextBlobBuilder builder; SkScalar advance = SkFloatToScalar(initialAdvance); diff --git a/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp b/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp index 95538ffc2d629f1495bdd597a62121f011be6179..4d5dfca15d719533d60db59d4e7ed29e77be9fc4 100644 --- a/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp +++ b/sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp @@ -34,7 +34,6 @@ #include #include #include -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "hb.h" #include "sky/engine/platform/LayoutUnit.h" #include "sky/engine/platform/fonts/Character.h" @@ -560,9 +559,6 @@ bool HarfBuzzShaper::shape(GlyphBuffer* glyphBuffer) if (!shapeHarfBuzzRuns()) return false; - if (!RuntimeEnabledFeatures::subpixelFontScalingEnabled()) - m_totalWidth = roundf(m_totalWidth); - if (m_harfBuzzRuns.last()->hasGlyphToCharacterIndexes() && glyphBuffer && !fillGlyphBuffer(glyphBuffer)) return false; diff --git a/sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp b/sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp index 007db766585428437ec3b35161d97862b887897a..1e4d7dec003247917cf4cc316498a36207caa48d 100644 --- a/sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp +++ b/sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp @@ -30,7 +30,6 @@ #include "sky/engine/public/platform/Platform.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "sky/engine/platform/LayoutTestSupport.h" #include "sky/engine/platform/fonts/FontPlatformData.h" #include "sky/engine/platform/graphics/GraphicsContext.h" @@ -82,9 +81,8 @@ void FontPlatformData::setupPaint(SkPaint* paint, GraphicsContext* context) paint->setLCDRenderText(m_style.useSubpixelRendering); // Do not enable subpixel text on low-dpi if full hinting is requested. - bool useSubpixelText = RuntimeEnabledFeatures::subpixelFontScalingEnabled() - && (paint->getHinting() != SkPaint::kFull_Hinting - || (context && context->deviceScaleFactor() > 1.0f)); + bool useSubpixelText = paint->getHinting() != SkPaint::kFull_Hinting + || (context && context->deviceScaleFactor() > 1.0f); // TestRunner specifically toggles the subpixel positioning flag. if (useSubpixelText && !LayoutTestSupport::isRunningLayoutTest()) diff --git a/sky/engine/public/BUILD.gn b/sky/engine/public/BUILD.gn index 7b0904b91afa3a092651740a1e9a398c910786ae..7399df91a8c87def462816913b673a90e9ca6612 100644 --- a/sky/engine/public/BUILD.gn +++ b/sky/engine/public/BUILD.gn @@ -66,6 +66,5 @@ source_set("platform_headers") { source_set("web_headers") { public = [ "web/Sky.h", - "web/WebRuntimeFeatures.h", ] } diff --git a/sky/engine/public/platform/sky_settings.h b/sky/engine/public/platform/sky_settings.h new file mode 100644 index 0000000000000000000000000000000000000000..2431d2a3d507b1395cead011039306e652ffc6d4 --- /dev/null +++ b/sky/engine/public/platform/sky_settings.h @@ -0,0 +1,20 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef SKY_ENGINE_PUBLIC_PLATFORM_SKY_SETTINGS_H_ +#define SKY_ENGINE_PUBLIC_PLATFORM_SKY_SETTINGS_H_ + +namespace blink { + +struct SkySettings { + bool enable_observatory = false; + bool enable_dart_checked_mode = false; + + static const SkySettings& Get(); + static void Set(const SkySettings& settings); +}; + +} // namespace blink + +#endif // SKY_ENGINE_PUBLIC_PLATFORM_SKY_SETTINGS_H_ diff --git a/sky/engine/public/web/WebRuntimeFeatures.h b/sky/engine/public/web/WebRuntimeFeatures.h deleted file mode 100644 index 0feb2319a9d64793523ccdd362350ed1e264a3b9..0000000000000000000000000000000000000000 --- a/sky/engine/public/web/WebRuntimeFeatures.h +++ /dev/null @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#ifndef SKY_ENGINE_PUBLIC_WEB_WEBRUNTIMEFEATURES_H_ -#define SKY_ENGINE_PUBLIC_WEB_WEBRUNTIMEFEATURES_H_ - -#include "../platform/WebCommon.h" - -namespace blink { - -// This class is used to enable runtime features of Blink. -// Stable features are enabled by default. -class WebRuntimeFeatures { -public: - BLINK_EXPORT static void enableExperimentalFeatures(bool); - BLINK_EXPORT static void enableTestOnlyFeatures(bool); - - BLINK_EXPORT static void enableDatabase(bool); - - BLINK_EXPORT static void enableBleedingEdgeFastPaths(bool); - - BLINK_EXPORT static void enableExperimentalCanvasFeatures(bool); - - BLINK_EXPORT static void enableFileSystem(bool); - - BLINK_EXPORT static void enableMediaPlayer(bool); - - BLINK_EXPORT static void enableSubpixelFontScaling(bool); - - BLINK_EXPORT static void enableMediaCapture(bool); - - BLINK_EXPORT static void enableNotifications(bool); - - BLINK_EXPORT static void enableNavigatorContentUtils(bool); - - BLINK_EXPORT static void enableNavigationTransitions(bool); - - BLINK_EXPORT static void enableNetworkInformation(bool); - - BLINK_EXPORT static void enableOrientationEvent(bool); - - BLINK_EXPORT static void enableRequestAutocomplete(bool); - - BLINK_EXPORT static void enableServiceWorker(bool); - - BLINK_EXPORT static void enableSessionStorage(bool); - - BLINK_EXPORT static void enableTouch(bool); - - BLINK_EXPORT static void enableTouchIconLoading(bool); - - BLINK_EXPORT static void enableWebGLDraftExtensions(bool); - - BLINK_EXPORT static void enableWebGLImageChromium(bool); - - BLINK_EXPORT static void enableOverlayFullscreenVideo(bool); - - BLINK_EXPORT static void enableSharedWorker(bool); - - BLINK_EXPORT static void enableTargetedStyleRecalc(bool); - - BLINK_EXPORT static void enablePreciseMemoryInfo(bool); - - BLINK_EXPORT static void enableLayerSquashing(bool); - - BLINK_EXPORT static void enableLaxMixedContentChecking(bool); - - BLINK_EXPORT static void enableObservatory(bool); - - BLINK_EXPORT static void enableDartCheckedMode(bool); - -private: - WebRuntimeFeatures(); -}; - -} // namespace blink - -#endif // SKY_ENGINE_PUBLIC_WEB_WEBRUNTIMEFEATURES_H_ diff --git a/sky/engine/web/BUILD.gn b/sky/engine/web/BUILD.gn index 57185bea3329200514ca357ab79789ac5568d50c..76ec2cfd7a44192b5590c5dc9d8252d951c38b43 100644 --- a/sky/engine/web/BUILD.gn +++ b/sky/engine/web/BUILD.gn @@ -17,6 +17,5 @@ source_set("web") { sources = [ "Sky.cpp", - "WebRuntimeFeatures.cpp", ] } diff --git a/sky/engine/web/Sky.cpp b/sky/engine/web/Sky.cpp index 0d2b773c9258bdfa7a889a302e6da87d1c563e81..754aa6de48fb1e1941c989f8ad1a94ac73e768c2 100644 --- a/sky/engine/web/Sky.cpp +++ b/sky/engine/web/Sky.cpp @@ -32,7 +32,6 @@ #include "base/message_loop/message_loop.h" #include "base/rand_util.h" -#include "gen/sky/platform/RuntimeEnabledFeatures.h" #include "mojo/message_pump/message_pump_mojo.h" #include "sky/engine/core/dom/Microtask.h" #include "sky/engine/core/Init.h" diff --git a/sky/engine/web/WebRuntimeFeatures.cpp b/sky/engine/web/WebRuntimeFeatures.cpp deleted file mode 100644 index 55543b9638ee5e95a141b8118f5a6c045a8d7d2b..0000000000000000000000000000000000000000 --- a/sky/engine/web/WebRuntimeFeatures.cpp +++ /dev/null @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2013 Google Inc. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions are - * met: - * - * * Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * * Redistributions in binary form must reproduce the above - * copyright notice, this list of conditions and the following disclaimer - * in the documentation and/or other materials provided with the - * distribution. - * * Neither the name of Google Inc. nor the names of its - * contributors may be used to endorse or promote products derived from - * this software without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR - * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT - * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT - * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -#include "sky/engine/public/web/WebRuntimeFeatures.h" - -#include "gen/sky/platform/RuntimeEnabledFeatures.h" -#include "sky/engine/wtf/Assertions.h" - -namespace blink { - -void WebRuntimeFeatures::enableExperimentalFeatures(bool enable) -{ - RuntimeEnabledFeatures::setExperimentalFeaturesEnabled(enable); -} - -void WebRuntimeFeatures::enableBleedingEdgeFastPaths(bool enable) -{ - ASSERT(enable); - RuntimeEnabledFeatures::setBleedingEdgeFastPathsEnabled(enable); - RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable || RuntimeEnabledFeatures::subpixelFontScalingEnabled()); -} - -void WebRuntimeFeatures::enableTestOnlyFeatures(bool enable) -{ - RuntimeEnabledFeatures::setTestFeaturesEnabled(enable); -} - -void WebRuntimeFeatures::enableDatabase(bool enable) -{ - RuntimeEnabledFeatures::setDatabaseEnabled(enable); -} - -void WebRuntimeFeatures::enableExperimentalCanvasFeatures(bool enable) -{ - RuntimeEnabledFeatures::setExperimentalCanvasFeaturesEnabled(enable); -} - -void WebRuntimeFeatures::enableFileSystem(bool enable) -{ - RuntimeEnabledFeatures::setFileSystemEnabled(enable); -} - -void WebRuntimeFeatures::enableMediaPlayer(bool enable) -{ - RuntimeEnabledFeatures::setMediaEnabled(enable); -} - -void WebRuntimeFeatures::enableSubpixelFontScaling(bool enable) -{ - RuntimeEnabledFeatures::setSubpixelFontScalingEnabled(enable); -} - -void WebRuntimeFeatures::enableMediaCapture(bool enable) -{ - RuntimeEnabledFeatures::setMediaCaptureEnabled(enable); -} - -void WebRuntimeFeatures::enableNotifications(bool enable) -{ - RuntimeEnabledFeatures::setNotificationsEnabled(enable); -} - -void WebRuntimeFeatures::enableNavigatorContentUtils(bool enable) -{ - RuntimeEnabledFeatures::setNavigatorContentUtilsEnabled(enable); -} - -void WebRuntimeFeatures::enableNavigationTransitions(bool enable) -{ - RuntimeEnabledFeatures::setNavigationTransitionsEnabled(enable); -} - -void WebRuntimeFeatures::enableNetworkInformation(bool enable) -{ - RuntimeEnabledFeatures::setNetworkInformationEnabled(enable); -} - -void WebRuntimeFeatures::enableOrientationEvent(bool enable) -{ - RuntimeEnabledFeatures::setOrientationEventEnabled(enable); -} - -void WebRuntimeFeatures::enableRequestAutocomplete(bool enable) -{ - RuntimeEnabledFeatures::setRequestAutocompleteEnabled(enable); -} - -void WebRuntimeFeatures::enableServiceWorker(bool enable) -{ -} - -void WebRuntimeFeatures::enableSessionStorage(bool enable) -{ - RuntimeEnabledFeatures::setSessionStorageEnabled(enable); -} - -void WebRuntimeFeatures::enableTouch(bool enable) -{ - RuntimeEnabledFeatures::setTouchEnabled(enable); -} - -void WebRuntimeFeatures::enableTouchIconLoading(bool enable) -{ - RuntimeEnabledFeatures::setTouchIconLoadingEnabled(enable); -} - -void WebRuntimeFeatures::enableWebGLDraftExtensions(bool enable) -{ - RuntimeEnabledFeatures::setWebGLDraftExtensionsEnabled(enable); -} - -void WebRuntimeFeatures::enableWebGLImageChromium(bool enable) -{ - RuntimeEnabledFeatures::setWebGLImageChromiumEnabled(enable); -} - -void WebRuntimeFeatures::enableOverlayFullscreenVideo(bool enable) -{ - RuntimeEnabledFeatures::setOverlayFullscreenVideoEnabled(enable); -} - -void WebRuntimeFeatures::enableSharedWorker(bool enable) -{ -} - -void WebRuntimeFeatures::enableTargetedStyleRecalc(bool enable) -{ - RuntimeEnabledFeatures::setTargetedStyleRecalcEnabled(enable); -} - -void WebRuntimeFeatures::enablePreciseMemoryInfo(bool enable) -{ - RuntimeEnabledFeatures::setPreciseMemoryInfoEnabled(enable); -} - -void WebRuntimeFeatures::enableLayerSquashing(bool enable) -{ - RuntimeEnabledFeatures::setLayerSquashingEnabled(enable); -} - -void WebRuntimeFeatures::enableLaxMixedContentChecking(bool enable) -{ - RuntimeEnabledFeatures::setLaxMixedContentCheckingEnabled(enable); -} - -void WebRuntimeFeatures::enableObservatory(bool enable) -{ - RuntimeEnabledFeatures::setObservatoryEnabled(enable); -} - -void WebRuntimeFeatures::enableDartCheckedMode(bool enable) -{ - RuntimeEnabledFeatures::setDartCheckedModeEnabled(enable); -} - -} // namespace blink diff --git a/sky/shell/platform/mojo/main_mojo.cc b/sky/shell/platform/mojo/main_mojo.cc index f84c6354659d6e20ac2f884145f0c3d3fb16ae17..6b8ec2df376d4ed36d0a95bf02731619bea2599f 100644 --- a/sky/shell/platform/mojo/main_mojo.cc +++ b/sky/shell/platform/mojo/main_mojo.cc @@ -14,6 +14,7 @@ #include "mojo/public/cpp/application/application_impl.h" #include "mojo/public/cpp/application/interface_factory_impl.h" #include "mojo/services/content_handler/interfaces/content_handler.mojom.h" +#include "sky/engine/public/platform/sky_settings.h" #include "sky/shell/shell.h" #include "sky/shell/platform/mojo/content_handler_impl.h" @@ -38,10 +39,12 @@ class MojoApp : public mojo::ApplicationDelegate, mojo::icu::Initialize(app); tracing_.Initialize(app); - Shell::Settings settings; + blink::SkySettings settings; + settings.enable_observatory = true; settings.enable_dart_checked_mode = app->HasArg(kEnableCheckedMode); + blink::SkySettings::Set(settings); - Shell::Init(settings); + Shell::Init(); } bool ConfigureIncomingConnection( diff --git a/sky/shell/shell.cc b/sky/shell/shell.cc index 1f7471207d22ec29b9dfbf5bbc5ad23881a7ad22..f1e99507a931122891eae6b89406feb3fe640c52 100644 --- a/sky/shell/shell.cc +++ b/sky/shell/shell.cc @@ -15,6 +15,7 @@ #include "base/single_thread_task_runner.h" #include "base/trace_event/trace_event.h" #include "mojo/message_pump/message_pump_mojo.h" +#include "sky/engine/public/platform/sky_settings.h" #include "sky/shell/switches.h" #include "sky/shell/ui/engine.h" @@ -51,7 +52,7 @@ base::LazyInstance g_discardable; } // namespace -Shell::Shell(const Settings& settings) : settings_(settings) { +Shell::Shell() { DCHECK(!g_shell); base::Thread::Options options; @@ -79,19 +80,23 @@ void Shell::InitStandalone() { base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - Settings settings; + blink::SkySettings settings; + settings.enable_observatory = + !command_line.HasSwitch(switches::kNonInteractive); settings.enable_dart_checked_mode = command_line.HasSwitch(switches::kEnableCheckedMode); - Init(settings); - if (command_line.HasSwitch(switches::kTraceStartup)) { + blink::SkySettings::Set(settings); + + Init(); + + if (command_line.HasSwitch(switches::kTraceStartup)) Shared().tracing_controller().StartTracing(); - } } -void Shell::Init(const Settings& settings) { +void Shell::Init() { base::DiscardableMemoryAllocator::SetInstance(&g_discardable.Get()); DCHECK(!g_shell); - g_shell = new Shell(settings); + g_shell = new Shell(); g_shell->ui_task_runner()->PostTask(FROM_HERE, base::Bind(&Engine::Init)); } diff --git a/sky/shell/shell.h b/sky/shell/shell.h index a95dbf5e4bb706a4d66eb7ce86db0d6b666044a0..ede37ae4394e952bfdc30ef47572a3c39d33e160 100644 --- a/sky/shell/shell.h +++ b/sky/shell/shell.h @@ -19,14 +19,10 @@ class Shell { public: ~Shell(); - struct Settings { - bool enable_dart_checked_mode = false; - }; - // Init the shell to stand alone from MojoShell. static void InitStandalone(); // Init the shell to run inside MojoShell. - static void Init(const Settings& settings); + static void Init(); static Shell& Shared(); @@ -42,11 +38,10 @@ class Shell { return io_task_runner_.get(); } - const Settings& settings() { return settings_; } TracingController& tracing_controller(); private: - explicit Shell(const Settings& settings); + Shell(); void InitGPU(const base::Thread::Options& options); void InitUI(const base::Thread::Options& options); @@ -59,7 +54,6 @@ class Shell { scoped_refptr ui_task_runner_; scoped_refptr io_task_runner_; - Settings settings_; TracingController tracing_controller_; DISALLOW_COPY_AND_ASSIGN(Shell); diff --git a/sky/shell/testing/testing.cc b/sky/shell/testing/testing.cc index f80048c7baa20a4c53ea3682a81ac922f0530be3..afa59eda01a0d27df05aeffde14229a7cd491f8e 100644 --- a/sky/shell/testing/testing.cc +++ b/sky/shell/testing/testing.cc @@ -4,7 +4,6 @@ #include "sky/shell/testing/testing.h" -#include "sky/engine/public/web/WebRuntimeFeatures.h" #include "base/command_line.h" #include "sky/shell/switches.h" #include "sky/shell/testing/test_runner.h" @@ -14,8 +13,6 @@ namespace shell { bool InitForTesting() { base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); - blink::WebRuntimeFeatures::enableObservatory( - !command_line.HasSwitch(switches::kNonInteractive)); TestRunner::TestDescriptor test; test.package_root = command_line.GetSwitchValueASCII(switches::kPackageRoot); diff --git a/sky/shell/ui/engine.cc b/sky/shell/ui/engine.cc index 8bc2c6b1828cc4757bbf465ce90f86cb4f9e7b06..41f0a7f8508171ab338ae3df730992f8a729a107 100644 --- a/sky/shell/ui/engine.cc +++ b/sky/shell/ui/engine.cc @@ -15,7 +15,6 @@ #include "sky/engine/public/platform/sky_display_metrics.h" #include "sky/engine/public/platform/WebInputEvent.h" #include "sky/engine/public/web/Sky.h" -#include "sky/engine/public/web/WebRuntimeFeatures.h" #include "sky/shell/dart/dart_library_provider_files.h" #include "sky/shell/shell.h" #include "sky/shell/ui/animator.h" @@ -74,9 +73,6 @@ base::WeakPtr Engine::GetWeakPtr() { void Engine::Init() { TRACE_EVENT0("flutter", "Engine::Init"); - blink::WebRuntimeFeatures::enableDartCheckedMode( - Shell::Shared().settings().enable_dart_checked_mode); - DCHECK(!g_platform_impl); g_platform_impl = new PlatformImpl(); blink::initialize(g_platform_impl);