|
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- |
|
2 * vim: sw=4 ts=8 et : |
|
3 */ |
|
4 /* This Source Code Form is subject to the terms of the Mozilla Public |
|
5 * License, v. 2.0. If a copy of the MPL was not distributed with this |
|
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
|
7 |
|
8 #include "PluginBackgroundDestroyer.h" |
|
9 #include "gfxSharedImageSurface.h" |
|
10 |
|
11 using namespace mozilla; |
|
12 using namespace plugins; |
|
13 |
|
14 PluginBackgroundDestroyerParent::PluginBackgroundDestroyerParent(gfxASurface* aDyingBackground) |
|
15 : mDyingBackground(aDyingBackground) |
|
16 { |
|
17 } |
|
18 |
|
19 PluginBackgroundDestroyerParent::~PluginBackgroundDestroyerParent() |
|
20 { |
|
21 } |
|
22 |
|
23 void |
|
24 PluginBackgroundDestroyerParent::ActorDestroy(ActorDestroyReason why) |
|
25 { |
|
26 switch(why) { |
|
27 case Deletion: |
|
28 case AncestorDeletion: |
|
29 if (gfxSharedImageSurface::IsSharedImage(mDyingBackground)) { |
|
30 gfxSharedImageSurface* s = |
|
31 static_cast<gfxSharedImageSurface*>(mDyingBackground.get()); |
|
32 DeallocShmem(s->GetShmem()); |
|
33 } |
|
34 break; |
|
35 default: |
|
36 // We're shutting down or crashed, let automatic cleanup |
|
37 // take care of our shmem, if we have one. |
|
38 break; |
|
39 } |
|
40 } |