Closed
Bug 1333183
Opened 8 years ago
Closed 8 years ago
stylo: nsIDocument::GetRootElement is not thread-safe
Categories
(Core :: CSS Parsing and Computation, defect)
Core
CSS Parsing and Computation
Tracking
()
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: bholley, Assigned: bholley)
References
Details
Attachments
(1 file)
(deleted),
patch
|
emilio
:
review+
|
Details | Diff | Splinter Review |
There's a trivial little cache (mCachedRootElement), which bhackett found in his static analysis in bug 1294915.
I think the best thing to do is just to always call GetRootElement right before Servo_TraverseSubtree, and then we can assert that stylo always gets a cache hit, since the DOM is never mutated during the Servo traversal.
Should be a trivial patch, but will collide with the code in bug 1331294, so I'll block on that to avoid bitrotting heycam.
Comment 1•8 years ago
|
||
Note that the HasPendingRestyles() call already checks for the root element, so we're probably pretty safe here already.
Assignee | ||
Comment 2•8 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #1)
> Note that the HasPendingRestyles() call already checks for the root element,
> so we're probably pretty safe here already.
Yeah, I just want to make it explicit, right before the traversal. The call should be pretty much free if there's a cache hit.
Assignee | ||
Updated•8 years ago
|
Blocks: stylo-static-analysis
Assignee | ||
Comment 3•8 years ago
|
||
Manish added the Servo_TraverseSubtree choke point, so this is unblocked now. I'll write a patch.
Assignee: nobody → bobbyholley
No longer depends on: 1331294
Assignee | ||
Comment 4•8 years ago
|
||
Attachment #8833070 -
Flags: review?(emilio+bugs)
Assignee | ||
Comment 5•8 years ago
|
||
(In reply to Emilio Cobos Álvarez [:emilio] from comment #1)
> Note that the HasPendingRestyles() call already checks for the root element,
> so we're probably pretty safe here already.
(Also, there's still the StyleNewChildren calls that we do during frame construction when adding NAC).
Comment 6•8 years ago
|
||
Comment on attachment 8833070 [details] [diff] [review]
Prime the root element cache before the servo traversal. v1
Review of attachment 8833070 [details] [diff] [review]:
-----------------------------------------------------------------
::: layout/style/ServoStyleSet.cpp
@@ +194,5 @@
>
> + // Get the Document's root element to ensure that the cache is valid before
> + // calling into the (potentially-parallel) Servo traversal, where a cache hit
> + // is necessary to avoid a data race when updating the cache.
> + (void) aRoot->OwnerDoc()->GetRootElement();
mozilla::Unused << ?
Attachment #8833070 -
Flags: review?(emilio+bugs) → review+
Assignee | ||
Comment 7•8 years ago
|
||
Assignee | ||
Comment 8•8 years ago
|
||
Pushed by bholley@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ed7112dfd385
Prime the root element cache before the servo traversal. r=emilio
Comment 10•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•