#include "content/browser/media/midi_host.h"
#include "base/containers/contains.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/ptr_util.h"
#include "base/process/process.h"
#include "base/trace_event/trace_event.h"
#include "content/browser/bad_message.h"
#include "content/browser/browser_main_loop.h"
#include "content/browser/child_process_security_policy_impl.h"
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/render_process_host.h"
#include "media/midi/message_util.h"
#include "media/midi/midi_message_queue.h"
#include "media/midi/midi_service.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "third_party/blink/public/common/features.h"
namespace content {
namespace {
const size_t kMaxInFlightBytes = …;
const size_t kAcknowledgementThresholdBytes = …;
}
IsDataByte;
IsSystemRealTimeMessage;
IsValidWebMIDIData;
kEndOfSysExByte;
kSysExByte;
PortState;
Result;
MidiHost::MidiHost(int renderer_process_id, midi::MidiService* midi_service)
: … { … }
MidiHost::~MidiHost() { … }
void MidiHost::BindReceiver(
int render_process_id,
midi::MidiService* midi_service,
mojo::PendingReceiver<midi::mojom::MidiSessionProvider> receiver) { … }
void MidiHost::CompleteStartSession(Result result) { … }
void MidiHost::AddInputPort(const midi::mojom::PortInfo& info) { … }
void MidiHost::AddOutputPort(const midi::mojom::PortInfo& info) { … }
void MidiHost::SetInputPortState(uint32_t port, PortState state) { … }
void MidiHost::SetOutputPortState(uint32_t port, PortState state) { … }
void MidiHost::ReceiveMidiData(uint32_t port,
const uint8_t* data,
size_t length,
base::TimeTicks timestamp) { … }
void MidiHost::AccumulateMidiBytesSent(size_t n) { … }
void MidiHost::Detach() { … }
void MidiHost::StartSession(
mojo::PendingReceiver<midi::mojom::MidiSession> session_receiver,
mojo::PendingRemote<midi::mojom::MidiSessionClient> client) { … }
void MidiHost::SendData(uint32_t port,
const std::vector<uint8_t>& data,
base::TimeTicks timestamp) { … }
template <typename Method, typename... Params>
void MidiHost::CallClient(Method method, Params... params) { … }
void MidiHost::EndSession() { … }
}