michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- michael@0: * vim: sw=4 ts=8 et : michael@0: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "PluginBackgroundDestroyer.h" michael@0: #include "gfxSharedImageSurface.h" michael@0: michael@0: using namespace mozilla; michael@0: using namespace plugins; michael@0: michael@0: PluginBackgroundDestroyerParent::PluginBackgroundDestroyerParent(gfxASurface* aDyingBackground) michael@0: : mDyingBackground(aDyingBackground) michael@0: { michael@0: } michael@0: michael@0: PluginBackgroundDestroyerParent::~PluginBackgroundDestroyerParent() michael@0: { michael@0: } michael@0: michael@0: void michael@0: PluginBackgroundDestroyerParent::ActorDestroy(ActorDestroyReason why) michael@0: { michael@0: switch(why) { michael@0: case Deletion: michael@0: case AncestorDeletion: michael@0: if (gfxSharedImageSurface::IsSharedImage(mDyingBackground)) { michael@0: gfxSharedImageSurface* s = michael@0: static_cast(mDyingBackground.get()); michael@0: DeallocShmem(s->GetShmem()); michael@0: } michael@0: break; michael@0: default: michael@0: // We're shutting down or crashed, let automatic cleanup michael@0: // take care of our shmem, if we have one. michael@0: break; michael@0: } michael@0: }