Closed Bug 1424816 Opened 8 years ago Closed 8 years ago

The Document state cache is not great, and doesn't look very useful

Categories

(Core :: CSS Parsing and Computation, enhancement)

enhancement
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: emilio, Assigned: emilio)

References

Details

Attachments

(1 file)

See bug 1422633, there are assertions missing, and servo doesn't assert at all anymore. I don't think it's worth optimizing / lazily resolving it, each time the document state changes we usually just restyle the world anyway, and the changes that it's optimizing (nsWindow::SetActive() and xul <browser> attribute changes) aren't common enough to warrant the complexity I'd say.
Comment on attachment 8936330 [details] Bug 1424816: Remove the document state cache. Err, this fails browser_windowactivation.js, but I bet it's because of the method living in nsPresContext...
Attachment #8936330 - Flags: review?(bugs)
Comment on attachment 8936330 [details] Bug 1424816: Remove the document state cache. Manish added ThreadSafeGetDocumentState(), perhaps he recalls why it was done that way.
Attachment #8936330 - Flags: feedback?(manishearth)
(In reply to Olli Pettay [:smaug] (won't be in Austin) from comment #4) > Comment on attachment 8936330 [details] > Bug 1424816: Remove the document state cache. > > Manish added ThreadSafeGetDocumentState(), perhaps he recalls why it was > done that way. The cache was added in bug 508482, fwiw, and there doesn't seem to be any reason for that.
> Manish added ThreadSafeGetDocumentState(), perhaps he recalls why it was done that way. That was just to bypass the cache so that Stylo can safely use this. If you remove the cache you can just remove all the threadsafe stuff.
Attachment #8936330 - Flags: feedback?(manishearth) → feedback+
I still don't understand what ThreadSafeGetDocumentState is about. Nothing there seems to be threadsafe as such. No atomic being used or mutexes or such.
Comment on attachment 8936330 [details] Bug 1424816: Remove the document state cache. I think I should not review this, since I really don't understand what ThreadSafeGetDocumentState() was trying to capture and why the patch removing it is ok.
Attachment #8936330 - Flags: review?(bugs)
It's threadsafe because it *doesn't* hit the cache. It does more work as a tradeoff.
ThreadSafeGetDocumentState doesn't do much work. It just returns mDocumentState. And I don't even understand why accessing that is threadsafe. The underlying code doesn't seem to use atomic or such for the value.
Comment on attachment 8936330 [details] Bug 1424816: Remove the document state cache. (Talked with Olli on IRC)
Attachment #8936330 - Flags: review?(bugs)
It was name ThreadSafeGetDocumentState which is confusing. That method as such isn't thread safe. It is safe only if no one sets the value while that is being called. So, it is safe in Stylo case, but not in general.
Comment on attachment 8936330 [details] Bug 1424816: Remove the document state cache. https://reviewboard.mozilla.org/r/207062/#review213400 ::: dom/base/nsIDocument.h:1567 (Diff revision 2) > { > nsPIDOMWindowInner* window = GetInnerWindow(); > return window ? window->WindowID() : 0; > } > > + bool IsTopLevelWindowInactive() const; Rather oddly named method for nsIDocument, but I see we use similar name in PresContext too, so fine.
Attachment #8936330 - Flags: review?(bugs) → review+
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Assignee: nobody → emilio
Depends on: 1451745
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: