LayerHostingContext.h [plain text]
#pragma once
#include <wtf/Forward.h>
#include <wtf/Noncopyable.h>
#include <wtf/RetainPtr.h>
OBJC_CLASS CALayer;
OBJC_CLASS CAContext;
namespace WTF {
class MachSendRight;
}
namespace WebKit {
using LayerHostingContextID = uint32_t;
enum class LayerHostingMode : uint8_t;
struct LayerHostingContextOptions {
#if PLATFORM(IOS_FAMILY)
bool canShowWhileLocked { false };
#endif
};
class LayerHostingContext {
WTF_MAKE_NONCOPYABLE(LayerHostingContext); WTF_MAKE_FAST_ALLOCATED;
public:
static std::unique_ptr<LayerHostingContext> createForPort(const WTF::MachSendRight& serverPort);
#if HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
static std::unique_ptr<LayerHostingContext> createForExternalHostingProcess(const LayerHostingContextOptions& = { });
#if PLATFORM(MAC)
static std::unique_ptr<LayerHostingContext> createForExternalPluginHostingProcess();
#endif
static RetainPtr<CALayer> createPlatformLayerForHostingContext(LayerHostingContextID);
#endif // HAVE(OUT_OF_PROCESS_LAYER_HOSTING)
LayerHostingContext();
~LayerHostingContext();
void setRootLayer(CALayer *);
CALayer *rootLayer() const;
LayerHostingContextID contextID() const;
void invalidate();
LayerHostingMode layerHostingMode() { return m_layerHostingMode; }
void setColorSpace(CGColorSpaceRef);
CGColorSpaceRef colorSpace() const;
#if PLATFORM(MAC)
void setColorMatchUntaggedContent(bool);
bool colorMatchUntaggedContent() const;
#endif
void setFencePort(mach_port_t);
WTF::MachSendRight createFencePort();
private:
LayerHostingMode m_layerHostingMode;
RetainPtr<CAContext> m_context;
};
}