Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: content/browser/media/midi_host.cc

Issue 2566673002: Web MIDI: introduce MidiService class (Closed)
Patch Set: merge master Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/media/midi_host.h ('k') | content/browser/media/midi_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/midi_host.cc
diff --git a/content/browser/media/midi_host.cc b/content/browser/media/midi_host.cc
index ed01c71f4ac3ec028adfc25d96ac73996cd9c67d..d85dc7d9a68bb250e0c2d8843a038f8ceb9b9e56 100644
--- a/content/browser/media/midi_host.cc
+++ b/content/browser/media/midi_host.cc
@@ -15,8 +15,8 @@
#include "content/public/browser/content_browser_client.h"
#include "content/public/browser/user_metrics.h"
#include "media/midi/message_util.h"
-#include "media/midi/midi_manager.h"
#include "media/midi/midi_message_queue.h"
+#include "media/midi/midi_service.h"
namespace content {
namespace {
@@ -42,30 +42,29 @@ using midi::kEndOfSysExByte;
using midi::mojom::PortState;
using midi::mojom::Result;
-MidiHost::MidiHost(int renderer_process_id,
- midi::MidiManager* midi_manager)
+MidiHost::MidiHost(int renderer_process_id, midi::MidiService* midi_service)
: BrowserMessageFilter(MidiMsgStart),
renderer_process_id_(renderer_process_id),
has_sys_ex_permission_(false),
is_session_requested_(false),
- midi_manager_(midi_manager),
+ midi_service_(midi_service),
sent_bytes_in_flight_(0),
bytes_sent_since_last_acknowledgement_(0),
output_port_count_(0) {
- DCHECK(midi_manager_);
+ DCHECK(midi_service_);
}
MidiHost::~MidiHost() = default;
void MidiHost::OnChannelClosing() {
- // If we get here the MidiHost is going to be destroyed soon. Prevent any
- // subsequent calls from MidiManager by closing our session.
+ // If we get here the MidiHost is going to be destroyed soon. Prevent any
+ // subsequent calls from MidiService by closing our session.
// If Send() is called from a different thread (e.g. a separate thread owned
- // by the MidiManager implementation), it will get posted to the IO thread.
+ // by the MidiService implementation), it will get posted to the IO thread.
// There is a race condition here if our refcount is 0 and we're about to or
// have already entered OnDestruct().
- if (is_session_requested_ && midi_manager_) {
- midi_manager_->EndSession(this);
+ if (is_session_requested_ && midi_service_) {
+ midi_service_->EndSession(this);
is_session_requested_ = false;
}
}
@@ -89,8 +88,8 @@ bool MidiHost::OnMessageReceived(const IPC::Message& message) {
void MidiHost::OnStartSession() {
is_session_requested_ = true;
- if (midi_manager_)
- midi_manager_->StartSession(this);
+ if (midi_service_)
+ midi_service_->StartSession(this);
}
void MidiHost::OnSendData(uint32_t port,
@@ -128,14 +127,14 @@ void MidiHost::OnSendData(uint32_t port,
return;
sent_bytes_in_flight_ += data.size();
}
- if (midi_manager_)
- midi_manager_->DispatchSendMidiData(this, port, data, timestamp);
+ if (midi_service_)
+ midi_service_->DispatchSendMidiData(this, port, data, timestamp);
}
void MidiHost::OnEndSession() {
is_session_requested_ = false;
- if (midi_manager_)
- midi_manager_->EndSession(this);
+ if (midi_service_)
+ midi_service_->EndSession(this);
}
void MidiHost::CompleteStartSession(Result result) {
@@ -222,7 +221,7 @@ void MidiHost::AccumulateMidiBytesSent(size_t n) {
}
void MidiHost::Detach() {
- midi_manager_ = nullptr;
+ midi_service_ = nullptr;
}
} // namespace content
« no previous file with comments | « content/browser/media/midi_host.h ('k') | content/browser/media/midi_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698