forked from mirrors/gecko-dev
Bug 1605248: Convert LoaderObserver::Clear to LoaderObserver::Disable; r=mhowell
We rename `LoaderObserver::Clear` to `LoaderObserver::Disable` to more accurately reflect the following behaviour change: Not only does the `Disable` call free any enqueued module load events, it also ensures that no further module loads will be saved in the future. This reflects the reality that any `mozglue` client that calls `Disable` has no intention of ever processing these events. Differential Revision: https://phabricator.services.mozilla.com/D57897 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
72918a2e58
commit
844739bc32
3 changed files with 10 additions and 4 deletions
|
|
@ -80,6 +80,10 @@ void LoaderObserver::OnEndDllLoad(void* aContext, NTSTATUS aNtStatus,
|
|||
|
||||
// No dll services, save for later
|
||||
AutoExclusiveLock lock(mLock);
|
||||
if (!mEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mModuleLoads) {
|
||||
mModuleLoads = new ModuleLoadInfoVec();
|
||||
}
|
||||
|
|
@ -116,13 +120,14 @@ void LoaderObserver::Forward(detail::DllServicesBase* aNext) {
|
|||
delete moduleLoads;
|
||||
}
|
||||
|
||||
void LoaderObserver::Clear() {
|
||||
void LoaderObserver::Disable() {
|
||||
ModuleLoadInfoVec* moduleLoads = nullptr;
|
||||
|
||||
{ // Scope for lock
|
||||
AutoExclusiveLock lock(mLock);
|
||||
moduleLoads = mModuleLoads;
|
||||
mModuleLoads = nullptr;
|
||||
mEnabled = false;
|
||||
}
|
||||
|
||||
delete moduleLoads;
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ namespace glue {
|
|||
class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS LoaderObserver final
|
||||
: public nt::LoaderObserver {
|
||||
public:
|
||||
constexpr LoaderObserver() : mModuleLoads(nullptr) {}
|
||||
constexpr LoaderObserver() : mModuleLoads(nullptr), mEnabled(true) {}
|
||||
|
||||
void OnBeginDllLoad(void** aContext,
|
||||
PCUNICODE_STRING aPreliminaryDllName) final;
|
||||
|
|
@ -31,11 +31,12 @@ class MOZ_ONLY_USED_TO_AVOID_STATIC_CONSTRUCTORS LoaderObserver final
|
|||
void OnForward(ModuleLoadInfoVec&& aInfo) final;
|
||||
|
||||
void Forward(mozilla::glue::detail::DllServicesBase* aSvc);
|
||||
void Clear();
|
||||
void Disable();
|
||||
|
||||
private:
|
||||
Win32SRWLock mLock;
|
||||
ModuleLoadInfoVec* mModuleLoads;
|
||||
bool mEnabled;
|
||||
};
|
||||
|
||||
} // namespace glue
|
||||
|
|
|
|||
|
|
@ -769,5 +769,5 @@ MFBT_API void DllBlocklist_SetBasicDllServices(
|
|||
}
|
||||
|
||||
aSvc->SetAuthenticodeImpl(GetAuthenticode());
|
||||
gMozglueLoaderObserver.Clear();
|
||||
gMozglueLoaderObserver.Disable();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue