Bug 1787199 [wpt PR 35620] - Add tests for `VisibilityStateEntry`, a=testonly
[gecko.git] / dom / canvas / WebGLChild.h
blobcbac58a2f0b4b03784a6f5663438eda72a05f3aa
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/. */
6 #ifndef WEBGLCHILD_H_
7 #define WEBGLCHILD_H_
9 #include "mozilla/dom/PWebGLChild.h"
10 #include "mozilla/WeakPtr.h"
12 #include <string>
14 namespace mozilla {
16 class ClientWebGLContext;
18 namespace dom {
20 struct FlushedCmdInfo final {
21 size_t flushes = 0;
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;
32 public:
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;
41 private:
42 friend PWebGLChild;
43 virtual ~WebGLChild();
45 public:
46 mozilla::ipc::IPCResult RecvJsWarning(const std::string&) const;
47 mozilla::ipc::IPCResult RecvOnContextLoss(webgl::ContextLossReason) const;
50 } // namespace dom
51 } // namespace mozilla
53 #endif // WEBGLCHILD_H_