mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-06 09:05:45 +00:00
a8939590de
The bulk of this commit was generated by running: run-clang-tidy.py \ -checks='-*,llvm-namespace-comment' \ -header-filter=^/.../mozilla-central/.* \ -fix
53 lines
1.7 KiB
C++
53 lines
1.7 KiB
C++
/* -*- Mode: C++; tab-width: 20; indent-tabs-mode: nil; c-basic-offset: 2 -*-
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H
|
|
#define MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H
|
|
|
|
#include "mozilla/gfx/Types.h"
|
|
#include "mozilla/RefPtr.h"
|
|
#include "TextureClient.h"
|
|
|
|
namespace mozilla {
|
|
namespace layers {
|
|
|
|
class ISurfaceAllocator;
|
|
class TextureClientRecycleAllocatorImp;
|
|
|
|
|
|
/**
|
|
* TextureClientRecycleAllocator provides TextureClients allocation and
|
|
* recycling capabilities. It expects allocations of same sizes and
|
|
* attributres. If a recycled TextureClient is different from
|
|
* requested one, the recycled one is dropped and new TextureClient is allocated.
|
|
*/
|
|
class TextureClientRecycleAllocator
|
|
{
|
|
~TextureClientRecycleAllocator();
|
|
|
|
public:
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(TextureClientRecycleAllocator)
|
|
|
|
explicit TextureClientRecycleAllocator(ISurfaceAllocator* aAllocator);
|
|
|
|
void SetMaxPoolSize(uint32_t aMax);
|
|
|
|
// Creates and allocates a TextureClient.
|
|
already_AddRefed<TextureClient>
|
|
CreateOrRecycleForDrawing(gfx::SurfaceFormat aFormat,
|
|
gfx::IntSize aSize,
|
|
gfx::BackendType aMoz2dBackend,
|
|
TextureFlags aTextureFlags,
|
|
TextureAllocationFlags flags = ALLOC_DEFAULT);
|
|
|
|
private:
|
|
RefPtr<TextureClientRecycleAllocatorImp> mAllocator;
|
|
};
|
|
|
|
} // namespace layers
|
|
} // namespace mozilla
|
|
|
|
#endif /* MOZILLA_GFX_TEXTURECLIENT_RECYCLE_ALLOCATOR_H */
|