зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1482782 - Part 6: Remove support for multiple static atom sources. r=njn,emilio
Summary: Depends On D3284 Reviewers: njn!, emilio! Tags: #secure-revision Bug #: 1482782 Differential Revision: https://phabricator.services.mozilla.com/D3285
This commit is contained in:
Родитель
d9edae8bde
Коммит
e816227f97
|
@ -138,8 +138,6 @@ nsLayoutStatics::Initialize()
|
|||
nsCSSProps::AddRefTable();
|
||||
nsColorNames::AddRefTable();
|
||||
|
||||
NS_SetStaticAtomsDone();
|
||||
|
||||
#ifdef DEBUG
|
||||
nsCSSPseudoElements::AssertAtoms();
|
||||
nsCSSAnonBoxes::AssertAtoms();
|
||||
|
|
|
@ -20,34 +20,28 @@ PRELUDE = """
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
/* Autogenerated file created by components/style/gecko/binding_tools/regen_atoms.py, DO NOT EDIT DIRECTLY */
|
||||
/* Autogenerated file created by components/style/gecko/regen_atoms.py, DO NOT EDIT DIRECTLY */
|
||||
"""[1:] # NOQA: E501
|
||||
|
||||
|
||||
def gnu_symbolify(source, ident):
|
||||
return "_ZN{}{}{}{}E".format(len(source.CLASS), source.CLASS, len(ident), ident)
|
||||
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
|
||||
re.MULTILINE)
|
||||
FILE = "include/nsGkAtomList.h"
|
||||
CLASS = "nsGkAtoms"
|
||||
|
||||
|
||||
def msvc64_symbolify(source, ident, ty):
|
||||
return "?{}@{}@@2PEAV{}@@EA".format(ident, source.CLASS, ty)
|
||||
def gnu_symbolify(ident):
|
||||
return "_ZN{}{}{}{}E".format(len(CLASS), CLASS, len(ident), ident)
|
||||
|
||||
|
||||
def msvc32_symbolify(source, ident, ty):
|
||||
def msvc64_symbolify(ident, ty):
|
||||
return "?{}@{}@@2PEAV{}@@EA".format(ident, CLASS, ty)
|
||||
|
||||
|
||||
def msvc32_symbolify(ident, ty):
|
||||
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
|
||||
# See https://github.com/rust-lang/rust/issues/36097
|
||||
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, source.CLASS, ty)
|
||||
|
||||
|
||||
class GkAtomSource:
|
||||
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
|
||||
re.MULTILINE)
|
||||
FILE = "include/nsGkAtomList.h"
|
||||
CLASS = "nsGkAtoms"
|
||||
|
||||
|
||||
SOURCES = [
|
||||
GkAtomSource,
|
||||
]
|
||||
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, CLASS, ty)
|
||||
|
||||
|
||||
def map_atom(ident):
|
||||
|
@ -58,11 +52,10 @@ def map_atom(ident):
|
|||
|
||||
|
||||
class Atom:
|
||||
def __init__(self, source, ident, value, ty, atom_type):
|
||||
self.ident = "{}_{}".format(source.CLASS, ident)
|
||||
def __init__(self, ident, value, ty, atom_type):
|
||||
self.ident = "{}_{}".format(CLASS, ident)
|
||||
self.original_ident = ident
|
||||
self.value = value
|
||||
self.source = source
|
||||
# The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
|
||||
self.ty = ty
|
||||
# The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
|
||||
|
@ -73,17 +66,14 @@ class Atom:
|
|||
if self.is_anon_box():
|
||||
assert self.is_inheriting_anon_box() or self.is_non_inheriting_anon_box()
|
||||
|
||||
def cpp_class(self):
|
||||
return self.source.CLASS
|
||||
|
||||
def gnu_symbol(self):
|
||||
return gnu_symbolify(self.source, self.original_ident)
|
||||
return gnu_symbolify(self.original_ident)
|
||||
|
||||
def msvc32_symbol(self):
|
||||
return msvc32_symbolify(self.source, self.original_ident, self.ty)
|
||||
return msvc32_symbolify(self.original_ident, self.ty)
|
||||
|
||||
def msvc64_symbol(self):
|
||||
return msvc64_symbolify(self.source, self.original_ident, self.ty)
|
||||
return msvc64_symbolify(self.original_ident, self.ty)
|
||||
|
||||
def type(self):
|
||||
return self.ty
|
||||
|
@ -109,13 +99,12 @@ class Atom:
|
|||
|
||||
def collect_atoms(objdir):
|
||||
atoms = []
|
||||
for source in SOURCES:
|
||||
path = os.path.abspath(os.path.join(objdir, source.FILE))
|
||||
print("cargo:rerun-if-changed={}".format(path))
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
for result in source.PATTERN.finditer(content):
|
||||
atoms.append(Atom(source, result.group(1), result.group(2), result.group(3), result.group(4)))
|
||||
path = os.path.abspath(os.path.join(objdir, FILE))
|
||||
print("cargo:rerun-if-changed={}".format(path))
|
||||
with open(path) as f:
|
||||
content = f.read()
|
||||
for result in PATTERN.finditer(content):
|
||||
atoms.append(Atom(result.group(1), result.group(2), result.group(3), result.group(4)))
|
||||
return atoms
|
||||
|
||||
|
||||
|
|
|
@ -235,9 +235,6 @@ nsrefcnt NS_GetNumberOfAtoms();
|
|||
// static atom for this string.
|
||||
nsStaticAtom* NS_GetStaticAtom(const nsAString& aUTF16String);
|
||||
|
||||
// Record that all static atoms have been inserted.
|
||||
void NS_SetStaticAtomsDone();
|
||||
|
||||
class nsAtomString : public nsString
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -671,8 +671,10 @@ nsAtomTable::RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
|
|||
void
|
||||
NS_RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(gAtomTable);
|
||||
gAtomTable->RegisterStaticAtoms(aAtoms, aAtomsLen);
|
||||
gStaticAtomsDone = true;
|
||||
}
|
||||
|
||||
already_AddRefed<nsAtom>
|
||||
|
@ -834,13 +836,6 @@ nsAtomTable::GetStaticAtom(const nsAString& aUTF16String)
|
|||
: nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
NS_SetStaticAtomsDone()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
gStaticAtomsDone = true;
|
||||
}
|
||||
|
||||
void ToLowerCaseASCII(RefPtr<nsAtom>& aAtom)
|
||||
{
|
||||
// Assume the common case is that the atom is already ASCII lowercase.
|
||||
|
|
Загрузка…
Ссылка в новой задаче