Bug 1516366 - Move BlockOnload and UnlockOnload to nsIDocument, and devirtualize them. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D15361
This commit is contained in:
Emilio Cobos Álvarez 2018-12-26 03:34:32 +01:00
Родитель a9e10105d5
Коммит 6d77395190
3 изменённых файлов: 10 добавлений и 13 удалений

Просмотреть файл

@ -7607,14 +7607,14 @@ void nsIDocument::EnsureOnloadBlocker() {
}
}
void nsDocument::AsyncBlockOnload() {
void nsIDocument::AsyncBlockOnload() {
while (mAsyncOnloadBlockCount) {
--mAsyncOnloadBlockCount;
BlockOnload();
}
}
void nsDocument::BlockOnload() {
void nsIDocument::BlockOnload() {
if (mDisplayDocument) {
mDisplayDocument->BlockOnload();
return;
@ -7629,8 +7629,8 @@ void nsDocument::BlockOnload() {
++mAsyncOnloadBlockCount;
if (mAsyncOnloadBlockCount == 1) {
nsContentUtils::AddScriptRunner(
NewRunnableMethod("nsDocument::AsyncBlockOnload", this,
&nsDocument::AsyncBlockOnload));
NewRunnableMethod("nsIDocument::AsyncBlockOnload", this,
&nsIDocument::AsyncBlockOnload));
}
return;
}
@ -7642,7 +7642,7 @@ void nsDocument::BlockOnload() {
++mOnloadBlockCount;
}
void nsDocument::UnblockOnload(bool aFireSync) {
void nsIDocument::UnblockOnload(bool aFireSync) {
if (mDisplayDocument) {
mDisplayDocument->UnblockOnload(aFireSync);
return;

Просмотреть файл

@ -112,17 +112,11 @@ class nsDocument : public nsIDocument {
virtual void Destroy() override;
virtual void RemovedFromDocShell() override;
virtual void BlockOnload() override;
virtual void UnblockOnload(bool aFireSync) override;
NS_DECL_CYCLE_COLLECTION_SKIPPABLE_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsDocument,
nsINode)
nsresult CloneDocHelper(nsDocument* clone) const;
// Only BlockOnload should call this!
void AsyncBlockOnload();
protected:
friend class nsNodeUtils;

Просмотреть файл

@ -2147,14 +2147,17 @@ class nsIDocument : public nsINode,
* UnblockOnload() or the load has been stopped altogether (by the user
* pressing the Stop button, say).
*/
virtual void BlockOnload() = 0;
void BlockOnload();
/**
* @param aFireSync whether to fire onload synchronously. If false,
* onload will fire asynchronously after all onload blocks have been
* removed. It will NOT fire from inside UnblockOnload. If true,
* onload may fire from inside UnblockOnload.
*/
virtual void UnblockOnload(bool aFireSync) = 0;
void UnblockOnload(bool aFireSync);
// Only BlockOnload should call this!
void AsyncBlockOnload();
void BlockDOMContentLoaded() { ++mBlockDOMContentLoaded; }