Commit 6abfa672 authored by Omer Katz's avatar Omer Katz Committed by Commit Bot

Replace HeapDeque with HeapVector

This is part of an ongoing effort to simplify heap collections
and limit the types they can support (specifically, this CL
removes the only existing non-member usage of HeapDeque).

Bug: 1047147
Change-Id: I55995763db8c36d893a57a32ea04e38981917d36
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013243
Commit-Queue: Omer Katz <omerkatz@chromium.org>
Reviewed-by: default avatarTakashi Toyoshima <toyoshim@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#739193}
parent 3d729f6a
......@@ -307,19 +307,19 @@ void MIDIOutput::send(Vector<unsigned> unsigned_data,
}
void MIDIOutput::DidOpen(bool opened) {
if (!opened) {
if (!opened)
pending_data_.clear();
return;
}
while (!pending_data_.empty()) {
auto& front = pending_data_.front();
HeapVector<std::pair<Member<DOMUint8Array>, base::TimeTicks>> queued_data;
queued_data.swap(pending_data_);
for (auto& data : queued_data) {
midiAccess()->SendMIDIData(
port_index_, front.first->Data(),
base::checked_cast<wtf_size_t>(front.first->lengthAsSizeT()),
front.second);
pending_data_.TakeFirst();
port_index_, data.first->Data(),
base::checked_cast<wtf_size_t>(data.first->lengthAsSizeT()),
data.second);
}
queued_data.clear();
DCHECK(pending_data_.IsEmpty());
}
void MIDIOutput::Trace(blink::Visitor* visitor) {
......
......@@ -70,7 +70,7 @@ class MIDIOutput final : public MIDIPort {
void SendInternal(DOMUint8Array*, base::TimeTicks timestamp, ExceptionState&);
unsigned port_index_;
HeapDeque<std::pair<Member<DOMUint8Array>, base::TimeTicks>> pending_data_;
HeapVector<std::pair<Member<DOMUint8Array>, base::TimeTicks>> pending_data_;
};
} // namespace blink
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment