Fence.h (1165B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 #ifndef MOZILLA_GFX_Fence_H 8 #define MOZILLA_GFX_Fence_H 9 10 #include "mozilla/gfx/FileHandleWrapper.h" 11 #include "nsISupportsImpl.h" 12 13 namespace mozilla { 14 15 namespace layers { 16 17 class FenceD3D11; 18 class FenceFileHandle; 19 20 class Fence { 21 public: 22 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(Fence); 23 24 virtual FenceD3D11* AsFenceD3D11() { return nullptr; } 25 virtual FenceFileHandle* AsFenceFileHandle() { return nullptr; } 26 27 protected: 28 virtual ~Fence() = default; 29 }; 30 31 class FenceFileHandle final : public Fence { 32 public: 33 explicit FenceFileHandle(UniqueFileHandle&& aFileHandle); 34 35 FenceFileHandle* AsFenceFileHandle() override { return this; } 36 37 UniqueFileHandle DuplicateFileHandle(); 38 39 protected: 40 virtual ~FenceFileHandle(); 41 42 UniqueFileHandle mFileHandle; 43 }; 44 45 } // namespace layers 46 } // namespace mozilla 47 48 #endif // MOZILLA_GFX_Fence_H