Bug 1874684 - Part 4: Prefer const references instead of copying Instant values....
[gecko.git] / dom / midi / MIDIOutput.h
blob7c39d7a4a9934ad68feaede874ff36918a0a00da
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_MIDIOutput_h
8 #define mozilla_dom_MIDIOutput_h
10 #include "mozilla/dom/MIDIPort.h"
12 struct JSContext;
14 namespace mozilla {
15 class ErrorResult;
17 namespace dom {
19 class MIDIPortInfo;
20 class MIDIMessage;
22 /**
23 * Represents a MIDI Output Port, handles sending message to devices.
26 class MIDIOutput final : public MIDIPort {
27 public:
28 static RefPtr<MIDIOutput> Create(nsPIDOMWindowInner* aWindow,
29 MIDIAccess* aMIDIAccessParent,
30 const MIDIPortInfo& aPortInfo,
31 const bool aSysexEnabled);
32 ~MIDIOutput() = default;
34 JSObject* WrapObject(JSContext* aCx,
35 JS::Handle<JSObject*> aGivenProto) override;
37 // Send a message to an output port
38 void Send(const Sequence<uint8_t>& aData, const Optional<double>& aTimestamp,
39 ErrorResult& aRv);
40 // Clear any partially sent messages from the send queue
41 void Clear();
43 private:
44 explicit MIDIOutput(nsPIDOMWindowInner* aWindow);
47 } // namespace dom
48 } // namespace mozilla
50 #endif // mozilla_dom_MIDIOutput_h