RemoteGraphicsContextGL.h [plain text]
#pragma once
#if ENABLE(GPU_PROCESS) && ENABLE(WEBGL)
#include "Connection.h"
#include "GraphicsContextGLIdentifier.h"
#include "MessageReceiver.h"
#include "MessageSender.h"
#include <WebCore/ExtensionsGL.h>
#include <WebCore/GraphicsContextGLOpenGL.h>
#include <WebCore/NotImplemented.h>
#include <wtf/WeakPtr.h>
#if PLATFORM(COCOA)
#include <WebCore/GraphicsContextGLIOSurfaceSwapChain.h>
#endif
#if PLATFORM(COCOA)
namespace WTF {
class MachSendRight;
}
#endif
namespace WebKit {
class GPUConnectionToWebProcess;
class RemoteGraphicsContextGL
: public IPC::MessageSender
, private IPC::MessageReceiver
, private WebCore::GraphicsContextGL::Client {
public:
static std::unique_ptr<RemoteGraphicsContextGL> create(const WebCore::GraphicsContextGLAttributes&, GPUConnectionToWebProcess&, GraphicsContextGLIdentifier);
~RemoteGraphicsContextGL() override;
GPUConnectionToWebProcess* gpuConnectionToWebProcess() const;
protected:
RemoteGraphicsContextGL(const WebCore::GraphicsContextGLAttributes&, GPUConnectionToWebProcess&, GraphicsContextGLIdentifier, Ref<WebCore::GraphicsContextGLOpenGL>);
IPC::Connection* messageSenderConnection() const final;
uint64_t messageSenderDestinationID() const final;
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) final;
void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) final;
void didComposite() final;
void forceContextLost() final;
void recycleContext() final;
void dispatchContextChangedNotification() final;
void reshape(int32_t width, int32_t height);
void ensureExtensionEnabled(String&&);
void notifyMarkContextChanged();
#if PLATFORM(COCOA)
virtual void prepareForDisplay(CompletionHandler<void(WTF::MachSendRight&&)>&&) = 0;
#else
void prepareForDisplay(CompletionHandler<void()>&&);
#endif
#include "RemoteGraphicsContextGLFunctionsGenerated.h" // NOLINT
Ref<WebCore::GraphicsContextGLOpenGL> m_context;
WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess;
GraphicsContextGLIdentifier m_graphicsContextGLIdentifier;
};
}
#endif