dom/plugins/ipc/PluginBackgroundDestroyer.cpp

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/dom/plugins/ipc/PluginBackgroundDestroyer.cpp	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,40 @@
     1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
     1.5 + * vim: sw=4 ts=8 et :
     1.6 + */
     1.7 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.8 + * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.9 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
    1.10 +
    1.11 +#include "PluginBackgroundDestroyer.h"
    1.12 +#include "gfxSharedImageSurface.h"
    1.13 +
    1.14 +using namespace mozilla;
    1.15 +using namespace plugins;
    1.16 +
    1.17 +PluginBackgroundDestroyerParent::PluginBackgroundDestroyerParent(gfxASurface* aDyingBackground)
    1.18 +  : mDyingBackground(aDyingBackground)
    1.19 +{
    1.20 +}
    1.21 +
    1.22 +PluginBackgroundDestroyerParent::~PluginBackgroundDestroyerParent()
    1.23 +{
    1.24 +}
    1.25 +
    1.26 +void
    1.27 +PluginBackgroundDestroyerParent::ActorDestroy(ActorDestroyReason why)
    1.28 +{
    1.29 +    switch(why) {
    1.30 +    case Deletion:
    1.31 +    case AncestorDeletion:
    1.32 +        if (gfxSharedImageSurface::IsSharedImage(mDyingBackground)) {
    1.33 +            gfxSharedImageSurface* s =
    1.34 +                static_cast<gfxSharedImageSurface*>(mDyingBackground.get());
    1.35 +            DeallocShmem(s->GetShmem());
    1.36 +        }
    1.37 +        break;
    1.38 +    default:
    1.39 +        // We're shutting down or crashed, let automatic cleanup
    1.40 +        // take care of our shmem, if we have one.
    1.41 +        break;
    1.42 +    }
    1.43 +}

mercurial