зеркало из https://github.com/mozilla/gecko-dev.git
Bug 801176 - part8-v1: Fix memory leak in OffscreenCanvas. r=roc
--- dom/canvas/CanvasRenderingContext2D.cpp | 2 ++ dom/canvas/OffscreenCanvas.cpp | 12 +++++++----- 2 files changed, 9 insertions(+), 5 deletions(-)
This commit is contained in:
Родитель
34112c9d96
Коммит
b690233730
|
@ -886,6 +886,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CanvasRenderingContext2D)
|
|||
// since we're logically destructed at this point.
|
||||
CanvasRenderingContext2D::RemoveDemotableContext(tmp);
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCanvasElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mOffscreenCanvas)
|
||||
for (uint32_t i = 0; i < tmp->mStyleStack.Length(); i++) {
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].patternStyles[Style::STROKE]);
|
||||
ImplCycleCollectionUnlink(tmp->mStyleStack[i].patternStyles[Style::FILL]);
|
||||
|
@ -903,6 +904,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CanvasRenderingContext2D)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCanvasElement)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOffscreenCanvas)
|
||||
for (uint32_t i = 0; i < tmp->mStyleStack.Length(); i++) {
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].patternStyles[Style::STROKE], "Stroke CanvasPattern");
|
||||
ImplCycleCollectionTraverse(cb, tmp->mStyleStack[i].patternStyles[Style::FILL], "Fill CanvasPattern");
|
||||
|
|
|
@ -89,11 +89,13 @@ OffscreenCanvas::ClearResources()
|
|||
mCanvasClient = nullptr;
|
||||
|
||||
if (mCanvasRenderer) {
|
||||
nsCOMPtr<nsIThread> activeThread = mCanvasRenderer->GetActiveThread();
|
||||
MOZ_RELEASE_ASSERT(activeThread);
|
||||
bool current;
|
||||
activeThread->IsOnCurrentThread(¤t);
|
||||
MOZ_RELEASE_ASSERT(current);
|
||||
if (mCanvasRenderer->mGLContext) {
|
||||
nsCOMPtr<nsIThread> activeThread = mCanvasRenderer->GetActiveThread();
|
||||
MOZ_RELEASE_ASSERT(activeThread);
|
||||
bool current;
|
||||
activeThread->IsOnCurrentThread(¤t);
|
||||
MOZ_RELEASE_ASSERT(current);
|
||||
}
|
||||
mCanvasRenderer->SetCanvasClient(nullptr);
|
||||
mCanvasRenderer->mContext = nullptr;
|
||||
mCanvasRenderer->mGLContext = nullptr;
|
||||
|
|
Загрузка…
Ссылка в новой задаче