Skip to content

Commit 41d3d5a

Browse files
Bug 1741568 - Fix all clang-tidy warnings in dom/midi r=padenot
Depends on D131222 Differential Revision: https://phabricator.services.mozilla.com/D131328
1 parent 2a94618 commit 41d3d5a

24 files changed

+54
-88
lines changed

dom/midi/MIDIAccess.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,15 @@ NS_IMPL_ADDREF_INHERITED(MIDIAccess, DOMEventTargetHelper)
5454
NS_IMPL_RELEASE_INHERITED(MIDIAccess, DOMEventTargetHelper)
5555

5656
MIDIAccess::MIDIAccess(nsPIDOMWindowInner* aWindow, bool aSysexEnabled,
57-
Promise* aPromise)
57+
Promise* aAccessPromise)
5858
: DOMEventTargetHelper(aWindow),
5959
mInputMap(new MIDIInputMap(aWindow)),
6060
mOutputMap(new MIDIOutputMap(aWindow)),
6161
mSysexEnabled(aSysexEnabled),
62-
mAccessPromise(aPromise),
62+
mAccessPromise(aAccessPromise),
6363
mHasShutdown(false) {
6464
MOZ_ASSERT(aWindow);
65-
MOZ_ASSERT(aPromise);
65+
MOZ_ASSERT(aAccessPromise);
6666
}
6767

6868
MIDIAccess::~MIDIAccess() { Shutdown(); }
@@ -190,7 +190,7 @@ void MIDIAccess::MaybeCreateMIDIPort(const MIDIPortInfo& aInfo,
190190
// received, that will be handled by the MIDIPort object itself, and it will
191191
// request removal from MIDIAccess's maps.
192192
void MIDIAccess::Notify(const MIDIPortList& aEvent) {
193-
for (auto& port : aEvent.ports()) {
193+
for (const auto& port : aEvent.ports()) {
194194
// Something went very wrong. Warn and return.
195195
ErrorResult rv;
196196
MaybeCreateMIDIPort(port, rv);

dom/midi/MIDIAccess.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MIDIPortInfo;
3535
class MIDIPortList;
3636
class Promise;
3737

38-
typedef Observer<void_t> MIDIAccessDestructionObserver;
38+
using MIDIAccessDestructionObserver = Observer<void_t>;
3939

4040
/**
4141
* MIDIAccess is the DOM object that is handed to the user upon MIDI permissions
@@ -76,7 +76,7 @@ class MIDIAccess final : public DOMEventTargetHelper,
7676
// created them, as the port object receives disconnection events which then
7777
// must be passed up to the MIDIAccess object. If the Port object dies before
7878
// the MIDIAccess object, it needs to be removed from the observer list.
79-
void RemovePortListener(MIDIAccessDestructionObserver* aPort);
79+
void RemovePortListener(MIDIAccessDestructionObserver* aObs);
8080

8181
// Fires DOM event on port connection/disconnection
8282
void FireConnectionEvent(MIDIPort* aPort);

dom/midi/MIDIAccessManager.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
#include "mozilla/dom/MIDITypes.h"
1212
#include "mozilla/Observer.h"
1313

14-
namespace mozilla {
15-
namespace dom {
14+
namespace mozilla::dom {
1615

1716
class MIDIAccess;
1817
class MIDIManagerChild;
@@ -46,7 +45,7 @@ class MIDIAccessManager final {
4645
// True if manager singleton has been created
4746
static bool IsRunning();
4847
// Send device connection updates to all known MIDIAccess objects.
49-
void Update(const MIDIPortList& aEvent);
48+
void Update(const MIDIPortList& aPortList);
5049
// Adds a device update observer (usually a MIDIAccess object)
5150
bool AddObserver(Observer<MIDIPortList>* aObserver);
5251
// Removes a device update observer (usually a MIDIAccess object)
@@ -69,7 +68,6 @@ class MIDIAccessManager final {
6968
RefPtr<MIDIManagerChild> mChild;
7069
};
7170

72-
} // namespace dom
73-
} // namespace mozilla
71+
} // namespace mozilla::dom
7472

7573
#endif // mozilla_dom_MIDIAccessManager_h

dom/midi/MIDIInput.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ MIDIInput* MIDIInput::Create(nsPIDOMWindowInner* aWindow,
2424
const bool aSysexEnabled) {
2525
MOZ_ASSERT(static_cast<MIDIPortType>(aPortInfo.type()) ==
2626
MIDIPortType::Input);
27-
auto port = new MIDIInput(aWindow, aMIDIAccessParent);
27+
auto* port = new MIDIInput(aWindow, aMIDIAccessParent);
2828
if (!port->Initialize(aPortInfo, aSysexEnabled)) {
2929
return nullptr;
3030
}
@@ -42,7 +42,7 @@ void MIDIInput::Receive(const nsTArray<MIDIMessage>& aMsgs) {
4242
NS_WARNING("No document available to send MIDIMessageEvent to!");
4343
return;
4444
}
45-
for (auto& msg : aMsgs) {
45+
for (const auto& msg : aMsgs) {
4646
RefPtr<MIDIMessageEvent> event(
4747
MIDIMessageEvent::Constructor(this, msg.timestamp(), msg.data()));
4848
DispatchTrustedEvent(event);

dom/midi/MIDIInput.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111

1212
struct JSContext;
1313

14-
namespace mozilla {
15-
namespace dom {
14+
namespace mozilla::dom {
1615

1716
class MIDIPortInfo;
1817

@@ -47,7 +46,6 @@ class MIDIInput final : public MIDIPort {
4746
void Receive(const nsTArray<MIDIMessage>& aMsgs) override;
4847
};
4948

50-
} // namespace dom
51-
} // namespace mozilla
49+
} // namespace mozilla::dom
5250

5351
#endif // mozilla_dom_MIDIInput_h

dom/midi/MIDIInputMap.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212

1313
class nsPIDOMWindowInner;
1414

15-
namespace mozilla {
16-
namespace dom {
15+
namespace mozilla::dom {
1716

1817
/**
1918
* Maplike DOM object that holds a list of all MIDI input ports available for
@@ -34,7 +33,6 @@ class MIDIInputMap final : public nsISupports, public nsWrapperCache {
3433
nsCOMPtr<nsPIDOMWindowInner> mParent;
3534
};
3635

37-
} // namespace dom
38-
} // namespace mozilla
36+
} // namespace mozilla::dom
3937

4038
#endif // mozilla_dom_MIDIInputMap_h

dom/midi/MIDIManagerChild.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
#include "mozilla/dom/PMIDIManagerChild.h"
1111

12-
namespace mozilla {
13-
namespace dom {
12+
namespace mozilla::dom {
1413

1514
/**
1615
* Actor implementation for the Child side of MIDIManager (represented in DOM by
@@ -33,7 +32,6 @@ class MIDIManagerChild final : public PMIDIManagerChild {
3332
bool mShutdown;
3433
};
3534

36-
} // namespace dom
37-
} // namespace mozilla
35+
} // namespace mozilla::dom
3836

3937
#endif // mozilla_dom_MIDIManagerChild_h

dom/midi/MIDIManagerParent.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,7 @@
99

1010
#include "mozilla/dom/PMIDIManagerParent.h"
1111

12-
namespace mozilla {
13-
namespace dom {
12+
namespace mozilla::dom {
1413

1514
/**
1615
* Actor implementation for the Parent (PBackground thread) side of MIDIManager
@@ -30,7 +29,6 @@ class MIDIManagerParent final : public PMIDIManagerParent {
3029
~MIDIManagerParent() = default;
3130
};
3231

33-
} // namespace dom
34-
} // namespace mozilla
32+
} // namespace mozilla::dom
3533

3634
#endif // mozilla_dom_MIDIManagerParent_h

dom/midi/MIDIMessageEvent.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@
1919
#include "nsTArray.h"
2020

2121
struct JSContext;
22-
namespace mozilla {
23-
namespace dom {
22+
namespace mozilla::dom {
2423
struct MIDIMessageEventInit;
2524

2625
/**
@@ -58,7 +57,6 @@ class MIDIMessageEvent final : public Event {
5857
nsTArray<uint8_t> mRawData;
5958
};
6059

61-
} // namespace dom
62-
} // namespace mozilla
60+
} // namespace mozilla::dom
6361

6462
#endif // mozilla_dom_MIDIMessageEvent_h

dom/midi/MIDIMessageQueue.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ class MIDIMessageQueue {
3535
void Add(nsTArray<MIDIMessage>& aMsg);
3636
// Retrieve all pending messages before the time specified.
3737
void GetMessagesBefore(TimeStamp aTimestamp,
38-
nsTArray<MIDIMessage>& aMsgArray);
38+
nsTArray<MIDIMessage>& aMsgQueue);
3939
// Get all pending messages.
40-
void GetMessages(nsTArray<MIDIMessage>& aMsgArray);
40+
void GetMessages(nsTArray<MIDIMessage>& aMsgQueue);
4141
// Erase all pending messages.
4242
void Clear();
4343
// Erase all pending messages that would be sent in the future. Useful for

0 commit comments

Comments
 (0)