Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_34031325
engine
提交
17282f63
E
engine
项目概览
qq_34031325
/
engine
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
E
engine
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
17282f63
编写于
12月 29, 2015
作者:
A
Adam Barth
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #2207 from abarth/rm_runtime_settings
Remove RuntimeEnabledFeatures
上级
96e66145
b4377c93
变更
44
隐藏空白更改
内联
并排
Showing
44 changed file
with
84 addition
and
1530 deletion
+84
-1530
sky/engine/build/scripts/hasher.py
sky/engine/build/scripts/hasher.py
+0
-82
sky/engine/build/scripts/in_file.py
sky/engine/build/scripts/in_file.py
+0
-161
sky/engine/build/scripts/in_file_unittest.py
sky/engine/build/scripts/in_file_unittest.py
+0
-88
sky/engine/build/scripts/in_generator.py
sky/engine/build/scripts/in_generator.py
+0
-98
sky/engine/build/scripts/license.py
sky/engine/build/scripts/license.py
+0
-35
sky/engine/build/scripts/make_names.py
sky/engine/build/scripts/make_names.py
+0
-97
sky/engine/build/scripts/make_runtime_features.py
sky/engine/build/scripts/make_runtime_features.py
+0
-99
sky/engine/build/scripts/name_utilities.py
sky/engine/build/scripts/name_utilities.py
+0
-97
sky/engine/build/scripts/scripts.gni
sky/engine/build/scripts/scripts.gni
+0
-29
sky/engine/build/scripts/template_expander.py
sky/engine/build/scripts/template_expander.py
+0
-61
sky/engine/build/scripts/templates/MakeNames.cpp.tmpl
sky/engine/build/scripts/templates/MakeNames.cpp.tmpl
+0
-35
sky/engine/build/scripts/templates/MakeNames.h.tmpl
sky/engine/build/scripts/templates/MakeNames.h.tmpl
+0
-34
sky/engine/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
...e/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
+0
-23
sky/engine/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl
...ine/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl
+0
-51
sky/engine/build/scripts/templates/macros.tmpl
sky/engine/build/scripts/templates/macros.tmpl
+0
-8
sky/engine/core/BUILD.gn
sky/engine/core/BUILD.gn
+0
-1
sky/engine/core/rendering/InlineTextBox.cpp
sky/engine/core/rendering/InlineTextBox.cpp
+3
-6
sky/engine/core/rendering/RenderLayer.cpp
sky/engine/core/rendering/RenderLayer.cpp
+0
-1
sky/engine/core/rendering/RenderObject.cpp
sky/engine/core/rendering/RenderObject.cpp
+0
-1
sky/engine/core/rendering/RenderReplaced.cpp
sky/engine/core/rendering/RenderReplaced.cpp
+1
-5
sky/engine/core/rendering/RenderTheme.cpp
sky/engine/core/rendering/RenderTheme.cpp
+0
-1
sky/engine/core/rendering/RenderView.cpp
sky/engine/core/rendering/RenderView.cpp
+0
-1
sky/engine/core/rendering/style/RenderStyle.cpp
sky/engine/core/rendering/style/RenderStyle.cpp
+0
-1
sky/engine/core/script/dart_init.cc
sky/engine/core/script/dart_init.cc
+3
-3
sky/engine/platform/BUILD.gn
sky/engine/platform/BUILD.gn
+1
-42
sky/engine/platform/RuntimeEnabledFeatures.in
sky/engine/platform/RuntimeEnabledFeatures.in
+0
-123
sky/engine/platform/exported/sky_settings.cc
sky/engine/platform/exported/sky_settings.cc
+24
-0
sky/engine/platform/fonts/Font.cpp
sky/engine/platform/fonts/Font.cpp
+10
-14
sky/engine/platform/fonts/FontCache.cpp
sky/engine/platform/fonts/FontCache.cpp
+0
-1
sky/engine/platform/fonts/FontDescription.cpp
sky/engine/platform/fonts/FontDescription.cpp
+1
-4
sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp
sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp
+0
-5
sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
+0
-4
sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp
sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp
+2
-4
sky/engine/public/BUILD.gn
sky/engine/public/BUILD.gn
+0
-1
sky/engine/public/platform/sky_settings.h
sky/engine/public/platform/sky_settings.h
+20
-0
sky/engine/public/web/WebRuntimeFeatures.h
sky/engine/public/web/WebRuntimeFeatures.h
+0
-105
sky/engine/web/BUILD.gn
sky/engine/web/BUILD.gn
+0
-1
sky/engine/web/Sky.cpp
sky/engine/web/Sky.cpp
+0
-1
sky/engine/web/WebRuntimeFeatures.cpp
sky/engine/web/WebRuntimeFeatures.cpp
+0
-183
sky/shell/platform/mojo/main_mojo.cc
sky/shell/platform/mojo/main_mojo.cc
+5
-2
sky/shell/shell.cc
sky/shell/shell.cc
+12
-7
sky/shell/shell.h
sky/shell/shell.h
+2
-8
sky/shell/testing/testing.cc
sky/shell/testing/testing.cc
+0
-3
sky/shell/ui/engine.cc
sky/shell/ui/engine.cc
+0
-4
未找到文件。
sky/engine/build/scripts/hasher.py
已删除
100644 → 0
浏览文件 @
96e66145
# 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 <https://github.com/vperron/python-superfasthash>.
# 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 <victor@iso3103.net>
"""
if
not
string
:
return
0
result
=
uint32_t
(
0x9E3779B9
L
)
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
sky/engine/build/scripts/in_file.py
已删除
100644 → 0
浏览文件 @
96e66145
# 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
\n
Known 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
\n
Known 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
\n
Known 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
)
sky/engine/build/scripts/in_file_unittest.py
已删除
100755 → 0
浏览文件 @
96e66145
#!/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
()
sky/engine/build/scripts/in_generator.py
已删除
100644 → 0
浏览文件 @
96e66145
# 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
)
sky/engine/build/scripts/license.py
已删除
100644 → 0
浏览文件 @
96e66145
# 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."""
sky/engine/build/scripts/make_names.py
已删除
100755 → 0
浏览文件 @
96e66145
#!/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
)
sky/engine/build/scripts/make_runtime_features.py
已删除
100755 → 0
浏览文件 @
96e66145
#!/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
)
sky/engine/build/scripts/name_utilities.py
已删除
100644 → 0
浏览文件 @
96e66145
# 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
)
sky/engine/build/scripts/scripts.gni
已删除
100644 → 0
浏览文件 @
96e66145
# 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",
]
sky/engine/build/scripts/template_expander.py
已删除
100644 → 0
浏览文件 @
96e66145
# 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
sky/engine/build/scripts/templates/MakeNames.cpp.tmpl
已删除
100644 → 0
浏览文件 @
96e66145
{% 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
sky/engine/build/scripts/templates/MakeNames.h.tmpl
已删除
100644 → 0
浏览文件 @
96e66145
{% 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
sky/engine/build/scripts/templates/RuntimeEnabledFeatures.cpp.tmpl
已删除
100644 → 0
浏览文件 @
96e66145
{% 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
sky/engine/build/scripts/templates/RuntimeEnabledFeatures.h.tmpl
已删除
100644 → 0
浏览文件 @
96e66145
{% 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
sky/engine/build/scripts/templates/macros.tmpl
已删除
100644 → 0
浏览文件 @
96e66145
{#
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 %}
sky/engine/core/BUILD.gn
浏览文件 @
17282f63
...
...
@@ -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")
...
...
sky/engine/core/rendering/InlineTextBox.cpp
浏览文件 @
17282f63
...
...
@@ -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
);
}
...
...
sky/engine/core/rendering/RenderLayer.cpp
浏览文件 @
17282f63
...
...
@@ -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"
...
...
sky/engine/core/rendering/RenderObject.cpp
浏览文件 @
17282f63
...
...
@@ -27,7 +27,6 @@
#include "sky/engine/core/rendering/RenderObject.h"
#include <algorithm>
#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"
...
...
sky/engine/core/rendering/RenderReplaced.cpp
浏览文件 @
17282f63
...
...
@@ -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
())
...
...
sky/engine/core/rendering/RenderTheme.cpp
浏览文件 @
17282f63
...
...
@@ -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"
...
...
sky/engine/core/rendering/RenderView.cpp
浏览文件 @
17282f63
...
...
@@ -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"
...
...
sky/engine/core/rendering/style/RenderStyle.cpp
浏览文件 @
17282f63
...
...
@@ -23,7 +23,6 @@
#include "sky/engine/core/rendering/style/RenderStyle.h"
#include <algorithm>
#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"
...
...
sky/engine/core/script/dart_init.cc
浏览文件 @
17282f63
...
...
@@ -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
...
...
sky/engine/platform/BUILD.gn
浏览文件 @
17282f63
...
...
@@ -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 = [
...
...
sky/engine/platform/RuntimeEnabledFeatures.in
已删除
100644 → 0
浏览文件 @
96e66145
// 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
sky/engine/platform/exported/sky_settings.cc
0 → 100644
浏览文件 @
17282f63
// 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
sky/engine/platform/fonts/Font.cpp
浏览文件 @
17282f63
...
...
@@ -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
()));
...
...
sky/engine/platform/fonts/FontCache.cpp
浏览文件 @
17282f63
...
...
@@ -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"
...
...
sky/engine/platform/fonts/FontDescription.cpp
浏览文件 @
17282f63
...
...
@@ -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.
...
...
sky/engine/platform/fonts/harfbuzz/FontHarfBuzz.cpp
浏览文件 @
17282f63
...
...
@@ -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
);
...
...
sky/engine/platform/fonts/harfbuzz/HarfBuzzShaper.cpp
浏览文件 @
17282f63
...
...
@@ -34,7 +34,6 @@
#include <unicode/normlzr.h>
#include <unicode/uchar.h>
#include <unicode/uscript.h>
#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
;
...
...
sky/engine/platform/fonts/linux/FontPlatformDataLinux.cpp
浏览文件 @
17282f63
...
...
@@ -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.0
f
));
bool
useSubpixelText
=
paint
->
getHinting
()
!=
SkPaint
::
kFull_Hinting
||
(
context
&&
context
->
deviceScaleFactor
()
>
1.0
f
);
// TestRunner specifically toggles the subpixel positioning flag.
if
(
useSubpixelText
&&
!
LayoutTestSupport
::
isRunningLayoutTest
())
...
...
sky/engine/public/BUILD.gn
浏览文件 @
17282f63
...
...
@@ -66,6 +66,5 @@ source_set("platform_headers") {
source_set("web_headers") {
public = [
"web/Sky.h",
"web/WebRuntimeFeatures.h",
]
}
sky/engine/public/platform/sky_settings.h
0 → 100644
浏览文件 @
17282f63
// 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_
sky/engine/public/web/WebRuntimeFeatures.h
已删除
100644 → 0
浏览文件 @
96e66145
/*
* 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_
sky/engine/web/BUILD.gn
浏览文件 @
17282f63
...
...
@@ -17,6 +17,5 @@ source_set("web") {
sources = [
"Sky.cpp",
"WebRuntimeFeatures.cpp",
]
}
sky/engine/web/Sky.cpp
浏览文件 @
17282f63
...
...
@@ -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"
...
...
sky/engine/web/WebRuntimeFeatures.cpp
已删除
100644 → 0
浏览文件 @
96e66145
/*
* 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
sky/shell/platform/mojo/main_mojo.cc
浏览文件 @
17282f63
...
...
@@ -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
(
...
...
sky/shell/shell.cc
浏览文件 @
17282f63
...
...
@@ -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<NonDiscardableMemoryAllocator> 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
));
}
...
...
sky/shell/shell.h
浏览文件 @
17282f63
...
...
@@ -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
<
base
::
SingleThreadTaskRunner
>
ui_task_runner_
;
scoped_refptr
<
base
::
SingleThreadTaskRunner
>
io_task_runner_
;
Settings
settings_
;
TracingController
tracing_controller_
;
DISALLOW_COPY_AND_ASSIGN
(
Shell
);
...
...
sky/shell/testing/testing.cc
浏览文件 @
17282f63
...
...
@@ -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
);
...
...
sky/shell/ui/engine.cc
浏览文件 @
17282f63
...
...
@@ -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> 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
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录