1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/PluginBackgroundDestroyer.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 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 +#ifndef dom_plugins_PluginBackgroundDestroyer 1.12 +#define dom_plugins_PluginBackgroundDestroyer 1.13 + 1.14 +#include "mozilla/plugins/PPluginBackgroundDestroyerChild.h" 1.15 +#include "mozilla/plugins/PPluginBackgroundDestroyerParent.h" 1.16 + 1.17 +#include "gfxSharedImageSurface.h" 1.18 + 1.19 +class gfxASurface; 1.20 + 1.21 +namespace mozilla { 1.22 +namespace plugins { 1.23 + 1.24 +/** 1.25 + * When instances of this class are destroyed, the old background goes 1.26 + * along with them, completing the destruction process (whether or not 1.27 + * the plugin stayed alive long enough to ack). 1.28 + */ 1.29 +class PluginBackgroundDestroyerParent : public PPluginBackgroundDestroyerParent { 1.30 +public: 1.31 + PluginBackgroundDestroyerParent(gfxASurface* aDyingBackground); 1.32 + 1.33 + virtual ~PluginBackgroundDestroyerParent(); 1.34 + 1.35 +private: 1.36 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; 1.37 + 1.38 + nsRefPtr<gfxASurface> mDyingBackground; 1.39 +}; 1.40 + 1.41 +/** 1.42 + * This class exists solely to instruct its instance to release its 1.43 + * current background, a new one may be coming. 1.44 + */ 1.45 +class PluginBackgroundDestroyerChild : public PPluginBackgroundDestroyerChild { 1.46 +public: 1.47 + PluginBackgroundDestroyerChild() { } 1.48 + virtual ~PluginBackgroundDestroyerChild() { } 1.49 + 1.50 +private: 1.51 + // Implementing this for good hygiene. 1.52 + virtual void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE 1.53 + { } 1.54 +}; 1.55 + 1.56 +} // namespace plugins 1.57 +} // namespace mozilla 1.58 + 1.59 +#endif // dom_plugins_PluginBackgroundDestroyer