Bug 1700051: part 26) Correct typo in comment of `mozInlineSpellWordUtil::BuildSoftTe...
[gecko.git] / dom / canvas / WebGLChild.h
blob85f30286763e4b583e3fb9ffe8efbb477576596c
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 <string>
11 #include "mozilla/dom/PWebGLChild.h"
12 #include "mozilla/dom/IpdlQueue.h"
14 // This is a bit weird. Nothing directly in WebGLChild.h necessitates including
15 // WebGLParent.h, but if we don't do this, we get compiler errors in the
16 // generated code inside PWebGLChild.cpp. The error is due to a complex
17 // dependency chain involving IpdlQueue, which I won't go into here. Including
18 // WebGLParent.h inside WebGLChild.h is the simplest way we could think of to
19 // avoid this issue. Including it in any of the code more directly involved in
20 // the breaking dependency chain unfortunately introduces a cyclical dependency
21 // between WebGLParent.h and PWebGLParent.h.
22 #include "mozilla/dom/WebGLParent.h"
24 namespace mozilla {
26 class ClientWebGLContext;
28 namespace dom {
30 struct FlushedCmdInfo final {
31 size_t flushes = 0;
32 size_t flushedCmdBytes = 0;
35 class WebGLChild final : public PWebGLChild, public SupportsWeakPtr {
36 const WeakPtr<ClientWebGLContext> mContext;
37 const size_t mDefaultCmdsShmemSize;
38 webgl::RaiiShmem mPendingCmdsShmem;
39 size_t mPendingCmdsPos = 0;
40 FlushedCmdInfo mFlushedCmdInfo;
42 public:
43 NS_INLINE_DECL_THREADSAFE_REFCOUNTING(WebGLChild, override);
44 using OtherSideActor = WebGLParent;
46 explicit WebGLChild(ClientWebGLContext&);
48 Maybe<Range<uint8_t>> AllocPendingCmdBytes(size_t);
49 void FlushPendingCmds();
50 void ActorDestroy(ActorDestroyReason why) override;
52 private:
53 friend PWebGLChild;
54 virtual ~WebGLChild();
56 public:
57 mozilla::ipc::IPCResult RecvJsWarning(const std::string&) const;
58 mozilla::ipc::IPCResult RecvOnContextLoss(webgl::ContextLossReason) const;
61 } // namespace dom
62 } // namespace mozilla
64 #endif // WEBGLCHILD_H_