1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
9 #include "mozilla/dom/PWebGLChild.h"
10 #include "mozilla/WeakPtr.h"
16 class ClientWebGLContext
;
20 struct FlushedCmdInfo final
{
22 size_t flushedCmdBytes
= 0;
26 class WebGLChild final
: public PWebGLChild
, public SupportsWeakPtr
{
27 const WeakPtr
<ClientWebGLContext
> mContext
;
28 const size_t mDefaultCmdsShmemSize
;
29 webgl::RaiiShmem mPendingCmdsShmem
;
30 size_t mPendingCmdsPos
= 0;
31 size_t mPendingCmdsAlignmentOverhead
= 0;
32 FlushedCmdInfo mFlushedCmdInfo
;
35 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLChild
, override
);
37 explicit WebGLChild(ClientWebGLContext
&);
39 Maybe
<Range
<uint8_t>> AllocPendingCmdBytes(size_t,
40 size_t fyiAlignmentOverhead
);
41 void FlushPendingCmds();
42 void ActorDestroy(ActorDestroyReason why
) override
;
46 virtual ~WebGLChild();
49 mozilla::ipc::IPCResult
RecvJsWarning(const std::string
&) const;
50 mozilla::ipc::IPCResult
RecvOnContextLoss(webgl::ContextLossReason
) const;
54 } // namespace mozilla
56 #endif // WEBGLCHILD_H_