/* -*- 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 WEBGLCROSSPROCESSCOMMANDQUEUE_H_ #define WEBGLCROSSPROCESSCOMMANDQUEUE_H_ #include "mozilla/dom/WebGLCommandQueue.h" #include "ProducerConsumerQueue.h" #include "IpdlQueue.h" namespace mozilla { namespace dom { class WebGLParent; class WebGLChild; } // namespace dom namespace layers { class PCompositorBridgeParent; } class HostWebGLContext; using mozilla::webgl::ProducerConsumerQueue; /** * The source for the WebGL Command Queue. */ using ClientWebGLCommandSourceP = SyncCommandSource; /** * The sink for the WebGL Command Queue. This object is created in the client * and sent to the host, where it needs to be given a HostWebGLContext that it * then uses for executing methods. Add new commands to DispatchCommand using * the WEBGL_SYNC_COMMAND and WEBGL_ASYNC_COMMAND macros. */ template class HostWebGLCommandSink final : public SyncCommandSink { public: HostWebGLCommandSink(UniquePtr&& aConsumer, UniquePtr&& aResponseProducer) : SyncCommandSink( std::move(aConsumer), std::move(aResponseProducer)) {} HostWebGLContext* mHostContext = nullptr; // For IPDL: HostWebGLCommandSink() = default; protected: friend struct mozilla::ipc::IPDLParamTraits; friend class mozilla::layers::PCompositorBridgeParent; bool DispatchCommand(size_t command) override { MOZ_CRASH("TODO:"); return false; } }; using HostWebGLCommandSinkP = HostWebGLCommandSink; using IpdlWebGLCommandQueue = mozilla::dom::IpdlQueue; using IpdlWebGLResponseQueue = mozilla::dom::IpdlQueue; using ClientWebGLCommandSourceI = SyncCommandSource; using HostWebGLCommandSinkI = HostWebGLCommandSink; namespace ipc { template struct IPDLParamTraits> : public IPDLParamTraits< mozilla::SyncCommandSink> { public: typedef mozilla::HostWebGLCommandSink paramType; }; } // namespace ipc } // namespace mozilla #endif // WEBGLCROSSPROCESSCOMMANDQUEUE_H_