Skip to content

Commit b17e6b4

Browse files
committed
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
1 parent 99d9013 commit b17e6b4

File tree

4 files changed

+26
-47
lines changed

4 files changed

+26
-47
lines changed

layout/build/nsLayoutStatics.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,8 +138,6 @@ nsLayoutStatics::Initialize()
138138
nsCSSProps::AddRefTable();
139139
nsColorNames::AddRefTable();
140140

141-
NS_SetStaticAtomsDone();
142-
143141
#ifdef DEBUG
144142
nsCSSPseudoElements::AssertAtoms();
145143
nsCSSAnonBoxes::AssertAtoms();

servo/components/style/gecko/regen_atoms.py

Lines changed: 24 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -20,34 +20,28 @@
2020
* License, v. 2.0. If a copy of the MPL was not distributed with this
2121
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
2222
23-
/* Autogenerated file created by components/style/gecko/binding_tools/regen_atoms.py, DO NOT EDIT DIRECTLY */
23+
/* Autogenerated file created by components/style/gecko/regen_atoms.py, DO NOT EDIT DIRECTLY */
2424
"""[1:] # NOQA: E501
2525

2626

27-
def gnu_symbolify(source, ident):
28-
return "_ZN{}{}{}{}E".format(len(source.CLASS), source.CLASS, len(ident), ident)
27+
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
28+
re.MULTILINE)
29+
FILE = "include/nsGkAtomList.h"
30+
CLASS = "nsGkAtoms"
2931

3032

31-
def msvc64_symbolify(source, ident, ty):
32-
return "?{}@{}@@2PEAV{}@@EA".format(ident, source.CLASS, ty)
33+
def gnu_symbolify(ident):
34+
return "_ZN{}{}{}{}E".format(len(CLASS), CLASS, len(ident), ident)
3335

3436

35-
def msvc32_symbolify(source, ident, ty):
36-
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
37-
# See https://github.com/rust-lang/rust/issues/36097
38-
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, source.CLASS, ty)
39-
40-
41-
class GkAtomSource:
42-
PATTERN = re.compile('^GK_ATOM\(([^,]*),[^"]*"([^"]*)",\s*([^,]*),\s*([^)]*)\)',
43-
re.MULTILINE)
44-
FILE = "include/nsGkAtomList.h"
45-
CLASS = "nsGkAtoms"
37+
def msvc64_symbolify(ident, ty):
38+
return "?{}@{}@@2PEAV{}@@EA".format(ident, CLASS, ty)
4639

4740

48-
SOURCES = [
49-
GkAtomSource,
50-
]
41+
def msvc32_symbolify(ident, ty):
42+
# Prepend "\x01" to avoid LLVM prefixing the mangled name with "_".
43+
# See https://github.com/rust-lang/rust/issues/36097
44+
return "\\x01?{}@{}@@2PAV{}@@A".format(ident, CLASS, ty)
5145

5246

5347
def map_atom(ident):
@@ -58,11 +52,10 @@ def map_atom(ident):
5852

5953

6054
class Atom:
61-
def __init__(self, source, ident, value, ty, atom_type):
62-
self.ident = "{}_{}".format(source.CLASS, ident)
55+
def __init__(self, ident, value, ty, atom_type):
56+
self.ident = "{}_{}".format(CLASS, ident)
6357
self.original_ident = ident
6458
self.value = value
65-
self.source = source
6659
# The Gecko type: "nsStaticAtom", "nsICSSPseudoElement", or "nsIAnonBoxPseudo"
6760
self.ty = ty
6861
# The type of atom: "Atom", "PseudoElement", "NonInheritingAnonBox",
@@ -73,17 +66,14 @@ def __init__(self, source, ident, value, ty, atom_type):
7366
if self.is_anon_box():
7467
assert self.is_inheriting_anon_box() or self.is_non_inheriting_anon_box()
7568

76-
def cpp_class(self):
77-
return self.source.CLASS
78-
7969
def gnu_symbol(self):
80-
return gnu_symbolify(self.source, self.original_ident)
70+
return gnu_symbolify(self.original_ident)
8171

8272
def msvc32_symbol(self):
83-
return msvc32_symbolify(self.source, self.original_ident, self.ty)
73+
return msvc32_symbolify(self.original_ident, self.ty)
8474

8575
def msvc64_symbol(self):
86-
return msvc64_symbolify(self.source, self.original_ident, self.ty)
76+
return msvc64_symbolify(self.original_ident, self.ty)
8777

8878
def type(self):
8979
return self.ty
@@ -109,13 +99,12 @@ def is_tree_pseudo_element(self):
10999

110100
def collect_atoms(objdir):
111101
atoms = []
112-
for source in SOURCES:
113-
path = os.path.abspath(os.path.join(objdir, source.FILE))
114-
print("cargo:rerun-if-changed={}".format(path))
115-
with open(path) as f:
116-
content = f.read()
117-
for result in source.PATTERN.finditer(content):
118-
atoms.append(Atom(source, result.group(1), result.group(2), result.group(3), result.group(4)))
102+
path = os.path.abspath(os.path.join(objdir, FILE))
103+
print("cargo:rerun-if-changed={}".format(path))
104+
with open(path) as f:
105+
content = f.read()
106+
for result in PATTERN.finditer(content):
107+
atoms.append(Atom(result.group(1), result.group(2), result.group(3), result.group(4)))
119108
return atoms
120109

121110

xpcom/ds/nsAtom.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ nsrefcnt NS_GetNumberOfAtoms();
235235
// static atom for this string.
236236
nsStaticAtom* NS_GetStaticAtom(const nsAString& aUTF16String);
237237

238-
// Record that all static atoms have been inserted.
239-
void NS_SetStaticAtomsDone();
240-
241238
class nsAtomString : public nsString
242239
{
243240
public:

xpcom/ds/nsAtomTable.cpp

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -671,8 +671,10 @@ nsAtomTable::RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
671671
void
672672
NS_RegisterStaticAtoms(const nsStaticAtom* aAtoms, size_t aAtomsLen)
673673
{
674+
MOZ_ASSERT(NS_IsMainThread());
674675
MOZ_ASSERT(gAtomTable);
675676
gAtomTable->RegisterStaticAtoms(aAtoms, aAtomsLen);
677+
gStaticAtomsDone = true;
676678
}
677679

678680
already_AddRefed<nsAtom>
@@ -834,13 +836,6 @@ nsAtomTable::GetStaticAtom(const nsAString& aUTF16String)
834836
: nullptr;
835837
}
836838

837-
void
838-
NS_SetStaticAtomsDone()
839-
{
840-
MOZ_ASSERT(NS_IsMainThread());
841-
gStaticAtomsDone = true;
842-
}
843-
844839
void ToLowerCaseASCII(RefPtr<nsAtom>& aAtom)
845840
{
846841
// Assume the common case is that the atom is already ASCII lowercase.

0 commit comments

Comments
 (0)