Bug 1321275 - Confirm VRLayerChild is not destroyed before sending destroy message to the parent side; r=kip

MozReview-Commit-ID: v0awwplOQv

--HG--
extra : rebase_source : 3a15b5249ea03e0d64a6229d55d6d418d9b8076f
This commit is contained in:
Daosheng Mu 2017-05-03 18:43:39 +08:00
Родитель 9d0a7da8bc
Коммит 6a807270be
3 изменённых файлов: 19 добавлений и 1 удалений

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

@ -96,7 +96,9 @@ void
VRDisplayPresentation::DestroyLayers() VRDisplayPresentation::DestroyLayers()
{ {
for (VRLayerChild* layer : mLayers) { for (VRLayerChild* layer : mLayers) {
Unused << layer->SendDestroy(); if (layer->IsIPCOpen()) {
Unused << layer->SendDestroy();
}
} }
mLayers.Clear(); mLayers.Clear();
} }

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

@ -20,6 +20,7 @@ VRLayerChild::VRLayerChild(uint32_t aVRDisplayID, VRManagerChild* aVRManagerChil
, mCanvasElement(nullptr) , mCanvasElement(nullptr)
, mShSurfClient(nullptr) , mShSurfClient(nullptr)
, mFront(nullptr) , mFront(nullptr)
, mIPCOpen(true)
{ {
} }
@ -74,6 +75,12 @@ VRLayerChild::SubmitFrame()
SendSubmitFrame(mFront->GetIPDLActor()); SendSubmitFrame(mFront->GetIPDLActor());
} }
bool
VRLayerChild::IsIPCOpen()
{
return mIPCOpen;
}
void void
VRLayerChild::ClearSurfaces() VRLayerChild::ClearSurfaces()
{ {
@ -81,5 +88,11 @@ VRLayerChild::ClearSurfaces()
mShSurfClient = nullptr; mShSurfClient = nullptr;
} }
void
VRLayerChild::ActorDestroy(ActorDestroyReason aWhy)
{
mIPCOpen = false;
}
} // namespace gfx } // namespace gfx
} // namespace mozilla } // namespace mozilla

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

@ -35,16 +35,19 @@ public:
VRLayerChild(uint32_t aVRDisplayID, VRManagerChild* aVRManagerChild); VRLayerChild(uint32_t aVRDisplayID, VRManagerChild* aVRManagerChild);
void Initialize(dom::HTMLCanvasElement* aCanvasElement); void Initialize(dom::HTMLCanvasElement* aCanvasElement);
void SubmitFrame(); void SubmitFrame();
bool IsIPCOpen();
protected: protected:
virtual ~VRLayerChild(); virtual ~VRLayerChild();
void ClearSurfaces(); void ClearSurfaces();
virtual void ActorDestroy(ActorDestroyReason aWhy) override;
uint32_t mVRDisplayID; uint32_t mVRDisplayID;
RefPtr<dom::HTMLCanvasElement> mCanvasElement; RefPtr<dom::HTMLCanvasElement> mCanvasElement;
RefPtr<layers::SharedSurfaceTextureClient> mShSurfClient; RefPtr<layers::SharedSurfaceTextureClient> mShSurfClient;
RefPtr<layers::TextureClient> mFront; RefPtr<layers::TextureClient> mFront;
bool mIPCOpen;
}; };
} // namespace gfx } // namespace gfx