Bug 1454594 - Follow-up to clear the static pointers on shutdown. r=botond

MozReview-Commit-ID: 5NVaBGIzbMR
This commit is contained in:
Kartikaya Gupta 2018-04-24 12:42:37 -04:00
Родитель d0a67d958e
Коммит 5beb01b971
2 изменённых файлов: 12 добавлений и 0 удалений

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

@ -8,6 +8,7 @@
#include "APZCTreeManager.h"
#include "AsyncPanZoomController.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/LayerMetricsWrapper.h"
@ -52,6 +53,11 @@ APZSampler::SetWebRenderWindowId(const wr::WindowId& aWindowId)
mWindowId = Some(aWindowId);
if (!sWindowIdMap) {
sWindowIdMap = new std::unordered_map<uint64_t, APZSampler*>();
NS_DispatchToMainThread(
NS_NewRunnableFunction("APZUpdater::ClearOnShutdown", [] {
ClearOnShutdown(&sWindowIdMap);
}
));
}
(*sWindowIdMap)[wr::AsUint64(aWindowId)] = this;
}

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

@ -9,6 +9,7 @@
#include "APZCTreeManager.h"
#include "AsyncPanZoomController.h"
#include "base/task.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/layers/APZThreadUtils.h"
#include "mozilla/layers/CompositorThread.h"
#include "mozilla/layers/SynchronousTask.h"
@ -59,6 +60,11 @@ APZUpdater::SetWebRenderWindowId(const wr::WindowId& aWindowId)
mWindowId = Some(aWindowId);
if (!sWindowIdMap) {
sWindowIdMap = new std::unordered_map<uint64_t, APZUpdater*>();
NS_DispatchToMainThread(
NS_NewRunnableFunction("APZUpdater::ClearOnShutdown", [] {
ClearOnShutdown(&sWindowIdMap);
}
));
}
(*sWindowIdMap)[wr::AsUint64(aWindowId)] = this;
}