NicosiaImageBackingTextureMapperImpl.h [plain text]
#pragma once
#if USE(TEXTURE_MAPPER)
#include "CoordinatedBackingStore.h"
#include "NicosiaBuffer.h"
#include "NicosiaPlatformLayer.h"
#include <wtf/Lock.h>
namespace WebCore {
class Image;
}
namespace Nicosia {
class ImageBackingTextureMapperImpl final : public ImageBacking::Impl {
public:
static Factory createFactory();
ImageBackingTextureMapperImpl();
virtual ~ImageBackingTextureMapperImpl();
bool isTextureMapperImpl() const override { return true; }
struct Update {
Update() = default;
Update(const Update&) = delete;
Update& operator=(const Update&) = delete;
Update(Update&&) = default;
Update& operator=(Update&&) = default;
bool isVisible { false };
RefPtr<Nicosia::Buffer> buffer;
};
struct LayerState {
LayerState() = default;
LayerState(const LayerState&) = delete;
LayerState& operator=(const LayerState&) = delete;
LayerState(LayerState&&) = delete;
LayerState& operator=(LayerState&&) = delete;
uintptr_t imageID { 0 };
uintptr_t nativeImageID { 0 };
Update update;
};
LayerState& layerState() { return m_layerState; }
void flushUpdate();
struct CompositionState {
CompositionState() = default;
CompositionState(const CompositionState&) = delete;
CompositionState& operator=(const CompositionState&) = delete;
CompositionState(CompositionState&&) = delete;
CompositionState& operator=(CompositionState&&) = delete;
RefPtr<WebCore::CoordinatedBackingStore> backingStore;
};
CompositionState& compositionState() { return m_compositionState; }
Update takeUpdate();
private:
LayerState m_layerState;
CompositionState m_compositionState;
struct {
Lock lock;
Update update;
} m_update;
};
}
SPECIALIZE_TYPE_TRAITS_NICOSIA_IMAGEBACKING_IMPL(ImageBackingTextureMapperImpl, isTextureMapperImpl());
#endif // USE(TEXTURE_MAPPER)