forked from mirrors/gecko-dev
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:
parent
99d9013b12
commit
b17e6b4468
4 changed files with 26 additions and 47 deletions
|
|
@ -138,8 +138,6 @@ nsLayoutStatics::Initialize()
|
||||||
nsCSSProps::AddRefTable();
|
nsCSSProps::AddRefTable();
|
||||||
nsColorNames::AddRefTable();
|
nsColorNames::AddRefTable();
|
||||||
|
|
||||||
NS_SetStaticAtomsDone();
|
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
nsCSSPseudoElements::AssertAtoms();
|
nsCSSPseudoElements::AssertAtoms();
|
||||||
nsCSSAnonBoxes::AssertAtoms();
|
nsCSSAnonBoxes::AssertAtoms();
|
||||||
|
|
|
||||||
|
|
@ -20,34 +20,28 @@ PRELUDE = """
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* 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/. */
|
* 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
|
"""[1:] # NOQA: E501
|
||||||
|
|
||||||
|
|
||||||
def gnu_symbolify(source, ident):
|
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
|
||||||
return "_ZN{}{}{}{}E".format(len(source.CLASS), source.CLASS, len(ident), ident)
|
re.MULTILINE)
|
||||||
|
FILE = "include/nsGkAtomList.h"
|
||||||
|
CLASS = "nsGkAtoms"
|
||||||
|
|
||||||
|
|
||||||
def msvc64_symbolify(source, ident, ty):
|
def gnu_symbolify(ident):
|
||||||
return "?{}@{}@@2PEAV{}@@EA".format(ident, source.CLASS, ty)
|
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 "_".
|
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
|
||||||
# See https://github.com/rust-lang/rust/issues/36097
|
# See https://github.com/rust-lang/rust/issues/36097
|
||||||
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, source.CLASS, ty)
|
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, CLASS, ty)
|
||||||
|
|
||||||
|
|
||||||
class GkAtomSource:
|
|
||||||
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
|
|
||||||
re.MULTILINE)
|
|
||||||
FILE = "include/nsGkAtomList.h"
|
|
||||||
CLASS = "nsGkAtoms"
|
|
||||||
|
|
||||||
|
|
||||||
SOURCES = [
|
|
||||||
GkAtomSource,
|
|
||||||
]
|
|
||||||
|
|
||||||
|
|
||||||
def map_atom(ident):
|
def map_atom(ident):
|
||||||
|
|
@ -58,11 +52,10 @@ def map_atom(ident):
|
||||||
|
|
||||||
|
|
||||||
class Atom:
|
class Atom:
|
||||||
def __init__(self, source, ident, value, ty, atom_type):
|
def __init__(self, ident, value, ty, atom_type):
|
||||||
self.ident = "{}_{}".format(source.CLASS, ident)
|
self.ident = "{}_{}".format(CLASS, ident)
|
||||||
self.original_ident = ident
|
self.original_ident = ident
|
||||||
self.value = value
|
self.value = value
|
||||||
self.source = source
|
|
||||||
# The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
|
# The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
|
||||||
self.ty = ty
|
self.ty = ty
|
||||||
# The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
|
# The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
|
||||||
|
|
@ -73,17 +66,14 @@ class Atom:
|
||||||
if self.is_anon_box():
|
if self.is_anon_box():
|
||||||
assert self.is_inheriting_anon_box() or self.is_non_inheriting_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):
|
def gnu_symbol(self):
|
||||||
return gnu_symbolify(self.source, self.original_ident)
|
return gnu_symbolify(self.original_ident)
|
||||||
|
|
||||||
def msvc32_symbol(self):
|
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):
|
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):
|
def type(self):
|
||||||
return self.ty
|
return self.ty
|
||||||
|
|
@ -109,13 +99,12 @@ class Atom:
|
||||||
|
|
||||||
def collect_atoms(objdir):
|
def collect_atoms(objdir):
|
||||||
atoms = []
|
atoms = []
|
||||||
for source in SOURCES:
|
path = os.path.abspath(os.path.join(objdir, FILE))
|
||||||
path = os.path.abspath(os.path.join(objdir, source.FILE))
|
print("cargo:rerun-if-changed={}".format(path))
|
||||||
print("cargo:rerun-if-changed={}".format(path))
|
with open(path) as f:
|
||||||
with open(path) as f:
|
content = f.read()
|
||||||
content = f.read()
|
for result in PATTERN.finditer(content):
|
||||||
for result in source.PATTERN.finditer(content):
|
atoms.append(Atom(result.group(1), result.group(2), result.group(3), result.group(4)))
|
||||||
atoms.append(Atom(source, result.group(1), result.group(2), result.group(3), result.group(4)))
|
|
||||||
return atoms
|
return atoms
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -235,9 +235,6 @@ nsrefcnt NS_GetNumberOfAtoms();
|
||||||
// static atom for this string.
|
// static atom for this string.
|
||||||
nsStaticAtom* NS_GetStaticAtom(const nsAString& aUTF16String);
|
nsStaticAtom* NS_GetStaticAtom(const nsAString& aUTF16String);
|
||||||
|
|
||||||
// Record that all static atoms have been inserted.
|
|
||||||
void NS_SetStaticAtomsDone();
|
|
||||||
|
|
||||||
class nsAtomString : public nsString
|
class nsAtomString : public nsString
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
||||||
|
|
@ -671,8 +671,10 @@ nsAtomTable::RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
|
||||||
void
|
void
|
||||||
NS_RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
|
NS_RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
|
||||||
{
|
{
|
||||||
|
MOZ_ASSERT(NS_IsMainThread());
|
||||||
MOZ_ASSERT(gAtomTable);
|
MOZ_ASSERT(gAtomTable);
|
||||||
gAtomTable->RegisterStaticAtoms(aAtoms, aAtomsLen);
|
gAtomTable->RegisterStaticAtoms(aAtoms, aAtomsLen);
|
||||||
|
gStaticAtomsDone = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
already_AddRefed<nsAtom>
|
already_AddRefed<nsAtom>
|
||||||
|
|
@ -834,13 +836,6 @@ nsAtomTable::GetStaticAtom(const nsAString& aUTF16String)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
NS_SetStaticAtomsDone()
|
|
||||||
{
|
|
||||||
MOZ_ASSERT(NS_IsMainThread());
|
|
||||||
gStaticAtomsDone = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ToLowerCaseASCII(RefPtr<nsAtom>& aAtom)
|
void ToLowerCaseASCII(RefPtr<nsAtom>& aAtom)
|
||||||
{
|
{
|
||||||
// Assume the common case is that the atom is already ASCII lowercase.
|
// Assume the common case is that the atom is already ASCII lowercase.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue