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

Unified Diff: media/midi/midi_manager.h

Issue 1315793008: Web MIDI: introduce MidiManager::Shutdown to shutdown gracefully (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 3 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
Index: media/midi/midi_manager.h
diff --git a/media/midi/midi_manager.h b/media/midi/midi_manager.h
index 957c84d427f0dc85b291cd6b9cee188067dca5d7..8f51f133aa9e3fe3e879cff8a1e26c6a47049164 100644
--- a/media/midi/midi_manager.h
+++ b/media/midi/midi_manager.h
@@ -75,6 +75,10 @@ class MIDI_EXPORT MidiManager {
// thread.
static MidiManager* Create();
+ // Called on the CrBrowserMain thread to notify the Chrome_IOThread will stop
+ // and the instance will be destructed on the CrBrowserMain thread soon.
+ void Shutdown();
+
// A client calls StartSession() to receive and send MIDI data.
// If the session is ready to start, the MIDI system is lazily initialized
// and the client is registered to receive MIDI data.
@@ -119,6 +123,12 @@ class MIDI_EXPORT MidiManager {
// |result| should be Result::OK on success, otherwise a proper Result.
virtual void StartInitialization();
+ // Finalizes the platform dependent MIDI system. Called on Chrome_IOThread
+ // thread and the thread will stop immediately after this call.
+ // Platform dependent resources that were allocated on the Chrome_IOThread
+ // should be disposed inside this method.
+ virtual void Finalize() {}
+
// Called from a platform dependent implementation of StartInitialization().
// It invokes CompleteInitializationInternal() on the thread that calls
// StartSession() and distributes |result| to MIDIManagerClient objects in
@@ -169,6 +179,9 @@ class MIDI_EXPORT MidiManager {
// Keeps true if platform dependent initialization is already completed.
bool initialized_;
+ // Keeps false until Shutdown() is called.
+ bool shutted_down_;
yhirano 2015/09/07 06:00:25 "shut"'s past participle form is "shut", not "shut
Takashi Toyoshima 2015/09/07 19:04:39 Done.
+
// Keeps the platform dependent initialization result if initialization is
// completed. Otherwise keeps Result::NOT_INITIALIZED.
Result result_;

Powered by Google App Engine
This is Rietveld 408576698