Bug 1885602 - Part 5: Implement navigating to the SUMO help topic from the menu heade...
[gecko.git] / dom / midi / MIDIPortChild.h
blob2ef1059c787e016a33798420abebd288e5d9f248
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:set ts=2 sw=2 sts=2 et cindent: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_MIDIPortChild_h
8 #define mozilla_dom_MIDIPortChild_h
10 #include "mozilla/dom/MIDIPortInterface.h"
11 #include "mozilla/dom/PMIDIPortChild.h"
13 namespace mozilla::dom {
15 class MIDIPort;
16 class MIDIPortInfo;
18 /**
19 * Child actor for a MIDIPort object. Each MIDIPort DOM object in JS has a its
20 * own child actor. The lifetime of the actor object is dependent on the
21 * lifetime of the JS object.
24 class MIDIPortChild final : public PMIDIPortChild, public MIDIPortInterface {
25 public:
26 NS_INLINE_DECL_REFCOUNTING(MIDIPortChild, override);
27 mozilla::ipc::IPCResult RecvReceive(nsTArray<MIDIMessage>&& aMsgs);
29 virtual void ActorDestroy(ActorDestroyReason aWhy) override;
31 mozilla::ipc::IPCResult RecvUpdateStatus(const uint32_t& aDeviceState,
32 const uint32_t& aConnectionState);
34 MIDIPortChild(const MIDIPortInfo& aPortInfo, bool aSysexEnabled,
35 MIDIPort* aPort);
36 nsresult GenerateStableId(const nsACString& aOrigin);
37 const nsString& StableId() { return mStableId; };
39 void DetachOwner() { mDOMPort = nullptr; }
41 private:
42 ~MIDIPortChild() = default;
43 // Pointer to the DOM object this actor represents. The actor cannot outlive
44 // the DOM object.
45 MIDIPort* mDOMPort;
46 nsString mStableId;
48 } // namespace mozilla::dom
50 #endif