2020-01-09 01:19:14 +03:00
|
|
|
/* -*- 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"
|
2020-05-01 01:24:44 +03:00
|
|
|
#include "mozilla/dom/IpdlQueue.h"
|
2020-01-09 01:19:14 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class HostWebGLContext;
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
class SharedSurfaceTextureClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
2020-05-01 01:24:44 +03:00
|
|
|
class WebGLParent : public PWebGLParent,
|
|
|
|
public AsyncProducerActor<WebGLParent>,
|
|
|
|
public SyncConsumerActor<WebGLParent>,
|
|
|
|
public SupportsWeakPtr<WebGLParent> {
|
2020-01-09 01:19:16 +03:00
|
|
|
friend PWebGLParent;
|
|
|
|
|
2020-01-09 01:19:14 +03:00
|
|
|
public:
|
2020-01-09 01:19:16 +03:00
|
|
|
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLParent, override);
|
2020-01-09 01:19:14 +03:00
|
|
|
MOZ_DECLARE_WEAKREFERENCE_TYPENAME(WebGLParent)
|
2020-05-01 01:24:44 +03:00
|
|
|
using OtherSideActor = WebGLChild;
|
2020-01-09 01:19:14 +03:00
|
|
|
|
2020-05-01 01:24:44 +03:00
|
|
|
mozilla::ipc::IPCResult RecvInitialize(
|
|
|
|
const webgl::InitContextDesc&, UniquePtr<HostWebGLCommandSinkP>&& aSinkP,
|
|
|
|
UniquePtr<HostWebGLCommandSinkI>&& aSinkI, webgl::InitContextResult* out);
|
2020-01-09 01:19:14 +03:00
|
|
|
|
2020-04-07 21:48:13 +03:00
|
|
|
RefPtr<layers::SharedSurfaceTextureClient> GetVRFrame(webgl::ObjectId);
|
2020-01-09 01:19:14 +03:00
|
|
|
|
2020-05-01 01:24:44 +03:00
|
|
|
// Drain the command queue now. Used by synchronous IpdlQueue consumers.
|
|
|
|
bool RunQueue(uint64_t) { return RunCommandQueue(); }
|
|
|
|
|
2020-05-01 01:23:48 +03:00
|
|
|
// For IPDL:
|
2020-04-30 06:06:33 +03:00
|
|
|
WebGLParent();
|
2020-05-01 01:23:48 +03:00
|
|
|
|
|
|
|
private:
|
2020-01-09 01:19:16 +03:00
|
|
|
~WebGLParent();
|
2020-01-09 01:19:14 +03:00
|
|
|
|
|
|
|
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_
|