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"
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class HostWebGLContext;
|
|
|
|
|
|
|
|
namespace layers {
|
|
|
|
class SharedSurfaceTextureClient;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace dom {
|
|
|
|
|
2020-04-30 06:06:33 +03:00
|
|
|
class WebGLParent final : public PWebGLParent,
|
|
|
|
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-04-30 06:06:33 +03:00
|
|
|
static RefPtr<WebGLParent> Create(const webgl::InitContextDesc&,
|
|
|
|
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-04-30 04:30:08 +03:00
|
|
|
private:
|
2020-04-30 06:06:33 +03:00
|
|
|
WebGLParent();
|
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_
|