Bug 1568950 - Part 1: Record use counters in Document::Destroy, instead of in ~Document; r=smaug

Recording use counters in ~Document doesn't work as expected for some cases, for instance,
user closes tab right after using them:
- In opt build, Document destructor isn't even reached given that we just kill the process
  without doing cleanup;
- In debug build, we reach the recording code, but it doesn't report use counters successfully
  due to it is unable to send the IPC message.

Document::Destroy is a better place that happens earlier and gives us more time to report the use counters.

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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Edgar Chen 2019-08-21 12:59:56 +00:00
Родитель b511871ba6
Коммит da423b7334
1 изменённых файлов: 2 добавлений и 2 удалений

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

@ -1761,8 +1761,6 @@ Document::~Document() {
}
}
ReportUseCounters();
mInDestructor = true;
mInUnlinkOrDeletion = true;
@ -10457,6 +10455,8 @@ void Document::Destroy() {
}
}
ReportUseCounters();
mIsGoingAway = true;
ScriptLoader()->Destroy();