Bug 1587797 - Simplify FlushPendingLinkUpdates. r=smaug

It's only called from a runnable nowadays.

Differential Revision: https://phabricator.services.mozilla.com/D48843

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Emilio Cobos Álvarez 2019-10-10 14:29:18 +00:00
parent 3886e9c12c
commit 3c4c6733b5
2 changed files with 5 additions and 26 deletions

View File

@ -11988,8 +11988,8 @@ void Document::RegisterPendingLinkUpdate(Link* aLink) {
if (!mHasLinksToUpdateRunnable && !mFlushingPendingLinkUpdates) {
nsCOMPtr<nsIRunnable> event =
NewRunnableMethod("Document::FlushPendingLinkUpdatesFromRunnable", this,
&Document::FlushPendingLinkUpdatesFromRunnable);
NewRunnableMethod("Document::FlushPendingLinkUpdates", this,
&Document::FlushPendingLinkUpdates);
// Do this work in a second in the worst case.
nsresult rv = NS_DispatchToCurrentThreadQueue(event.forget(), 1000,
EventQueuePriority::Idle);
@ -12004,16 +12004,10 @@ void Document::RegisterPendingLinkUpdate(Link* aLink) {
mLinksToUpdate.InfallibleAppend(aLink);
}
void Document::FlushPendingLinkUpdatesFromRunnable() {
void Document::FlushPendingLinkUpdates() {
MOZ_DIAGNOSTIC_ASSERT(!mFlushingPendingLinkUpdates);
MOZ_ASSERT(mHasLinksToUpdateRunnable);
mHasLinksToUpdateRunnable = false;
FlushPendingLinkUpdates();
}
void Document::FlushPendingLinkUpdates() {
if (mFlushingPendingLinkUpdates) {
return;
}
auto restore = MakeScopeExit([&] { mFlushingPendingLinkUpdates = false; });
mFlushingPendingLinkUpdates = true;

View File

@ -3408,24 +3408,9 @@ class Document : public nsINode,
// Add aLink to the set of links that need their status resolved.
void RegisterPendingLinkUpdate(Link* aLink);
// Update state on links in mLinksToUpdate. This function must be called
// prior to selector matching that needs to differentiate between :link and
// :visited. In particular, it does _not_ need to be called before doing any
// selector matching that uses TreeMatchContext::eNeverMatchVisited. The only
// reason we haven't moved all calls to this function entirely inside the
// TreeMatchContext constructor is to not call it all the time during various
// style system and frame construction operations (though it would likely be a
// no-op for all but the first call).
//
// XXXbz Does this really need to be called before selector matching? All it
// will do is ensure all the links involved are registered to observe history,
// which won't synchronously change their state to :visited anyway! So
// calling this won't affect selector matching done immediately afterward, as
// far as I can tell.
// Update state on links in mLinksToUpdate.
void FlushPendingLinkUpdates();
void FlushPendingLinkUpdatesFromRunnable();
#define DEPRECATED_OPERATION(_op) e##_op,
enum DeprecatedOperations {
#include "nsDeprecatedOperationList.h"