michael@0: /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* vim: set ts=8 sts=4 et sw=4 tw=80: */ 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: #ifndef TEXTUREGARBAGEBIN_H_ michael@0: #define TEXTUREGARBAGEBIN_H_ michael@0: michael@0: #include michael@0: michael@0: #include "mozilla/Mutex.h" michael@0: #include "nsISupportsImpl.h" michael@0: michael@0: #include "GLContextTypes.h" michael@0: michael@0: namespace mozilla { michael@0: namespace gl { michael@0: michael@0: class TextureGarbageBin MOZ_FINAL { michael@0: NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureGarbageBin) michael@0: michael@0: private: michael@0: // Private destructor, to discourage deletion outside of Release(): michael@0: ~TextureGarbageBin() michael@0: { michael@0: } michael@0: michael@0: GLContext* mGL; michael@0: Mutex mMutex; michael@0: std::stack mGarbageTextures; michael@0: michael@0: public: michael@0: TextureGarbageBin(GLContext* gl) michael@0: : mGL(gl) michael@0: , mMutex("TextureGarbageBin mutex") michael@0: {} michael@0: michael@0: void GLContextTeardown(); michael@0: void Trash(GLuint tex); michael@0: void EmptyGarbage(); michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif // TEXTUREGARBAGEBIN_H_