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;
25 class WebGLChild final
: public PWebGLChild
, public SupportsWeakPtr
{
26 const WeakPtr
<ClientWebGLContext
> mContext
;
27 const size_t mDefaultCmdsShmemSize
;
28 webgl::RaiiShmem mPendingCmdsShmem
;
29 size_t mPendingCmdsPos
= 0;
30 FlushedCmdInfo mFlushedCmdInfo
;
33 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLChild
, override
);
35 explicit WebGLChild(ClientWebGLContext
&);
37 Maybe
<Range
<uint8_t>> AllocPendingCmdBytes(size_t);
38 void FlushPendingCmds();
39 void ActorDestroy(ActorDestroyReason why
) override
;
43 virtual ~WebGLChild();
46 mozilla::ipc::IPCResult
RecvJsWarning(const std::string
&) const;
47 mozilla::ipc::IPCResult
RecvOnContextLoss(webgl::ContextLossReason
) const;
51 } // namespace mozilla
53 #endif // WEBGLCHILD_H_