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

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

Issue 662853003: Manage MIDI related objects and sessions' lifecycles correctly (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: unittest Created 6 years, 2 months 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 | « no previous file | content/browser/media/midi_host.cc » ('j') | content/browser/media/midi_host.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/midi_host.h
diff --git a/content/browser/media/midi_host.h b/content/browser/media/midi_host.h
index ef5f904b5de7d50178e4de095d71b78c6e3aca38..714444c9d7dfa3b20ddf48a3d71e107b5d0d3417 100644
--- a/content/browser/media/midi_host.h
+++ b/content/browser/media/midi_host.h
@@ -11,6 +11,7 @@
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
+#include "base/synchronization/lock.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_message_filter.h"
#include "content/public/browser/browser_thread.h"
@@ -35,8 +36,7 @@ class CONTENT_EXPORT MidiHost
virtual bool OnMessageReceived(const IPC::Message& message) override;
// MidiManagerClient implementation.
- virtual void CompleteStartSession(int client_id,
- media::MidiResult result) override;
+ virtual void CompleteStartSession(media::MidiResult result) override;
virtual void ReceiveMidiData(uint32 port,
const uint8* data,
size_t length,
@@ -44,13 +44,15 @@ class CONTENT_EXPORT MidiHost
virtual void AccumulateMidiBytesSent(size_t n) override;
// Start session to access MIDI hardware.
- void OnStartSession(int client_id);
+ void OnStartSession();
// Data to be sent to a MIDI output port.
void OnSendData(uint32 port,
const std::vector<uint8>& data,
double timestamp);
+ void OnEndSession();
+
private:
FRIEND_TEST_ALL_PREFIXES(MidiHostTest, IsValidWebMIDIData);
friend class base::DeleteHelper<MidiHost>;
@@ -71,6 +73,9 @@ class CONTENT_EXPORT MidiHost
// messages.
bool has_sys_ex_permission_;
+ // Represents if a session is requested to start.
+ bool is_session_requested_;
+
// |midi_manager_| talks to the platform-specific MIDI APIs.
// It can be NULL if the platform (or our current implementation)
// does not support MIDI. If not supported then a call to
« no previous file with comments | « no previous file | content/browser/media/midi_host.cc » ('j') | content/browser/media/midi_host.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698