gecko-dev/dom/canvas/WebGLParent.h
Jeff Gilbert a97c615de2 Bug 1632249 - Support compositing out-of-process WebGL. r=handyman,lsalzman,nical,geckoview-reviewers,agi,imanol
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
  to propagate
* Mortgage/strip out more OffscreenCanvas code for now

Differential Revision: https://phabricator.services.mozilla.com/D75055
2020-06-15 18:25:55 +00:00

70 lines
2.0 KiB
C++

/* -*- Mode: C++; tab-width: 4; 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 WEBGLPARENT_H_
#define WEBGLPARENT_H_
#include "mozilla/GfxMessageUtils.h"
#include "mozilla/dom/PWebGLParent.h"
#include "mozilla/WeakPtr.h"
#include "mozilla/dom/IpdlQueue.h"
namespace mozilla {
class HostWebGLContext;
namespace layers {
class SharedSurfaceTextureClient;
}
namespace dom {
class WebGLParent : public PWebGLParent,
public AsyncProducerActor<WebGLParent>,
public SyncConsumerActor<WebGLParent>,
public SupportsWeakPtr<WebGLParent>,
public mozilla::webgl::PcqActor {
friend PWebGLParent;
public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLParent, override);
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(WebGLParent)
using OtherSideActor = WebGLChild;
mozilla::ipc::IPCResult RecvInitialize(
const webgl::InitContextDesc&, UniquePtr<HostWebGLCommandSinkP>&& aSinkP,
UniquePtr<HostWebGLCommandSinkI>&& aSinkI, webgl::InitContextResult* out);
// Drain the command queue now. Used by synchronous IpdlQueue consumers.
bool RunQueue(uint64_t) { return RunCommandQueue(); }
WebGLParent(); // For IPDL
private:
~WebGLParent();
bool BeginCommandQueueDrain();
static bool MaybeRunCommandQueue(const WeakPtr<WebGLParent>& weakWebGLParent);
bool RunCommandQueue();
mozilla::ipc::IPCResult RecvUpdateCompositableHandle(
layers::PLayerTransactionParent* aLayerTransaction,
const CompositableHandle& aHandle);
mozilla::ipc::IPCResult Recv__delete__() override;
void ActorDestroy(ActorDestroyReason aWhy) override;
UniquePtr<HostWebGLContext> mHost;
// Runnable that repeatedly processes our WebGL command queue
RefPtr<Runnable> mRunCommandsRunnable;
};
} // namespace dom
} // namespace mozilla
#endif // WEBGLPARENT_H_