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

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

Issue 1576323002: Prevent a race condition with MidiHost IPC sending. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor comment nit Created 4 years, 11 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 671bd3c6543ccf40b4e1a1b3e1d46b1cdb76f8ea..e0f60f3a7f16e2bff61f67f9740c3245df61ef34 100644
--- a/content/browser/media/midi_host.h
+++ b/content/browser/media/midi_host.h
@@ -38,8 +38,10 @@ class CONTENT_EXPORT MidiHost : public BrowserMessageFilter,
MidiHost(int renderer_process_id, media::midi::MidiManager* midi_manager);
// BrowserMessageFilter implementation.
+ void OnChannelClosing() override;
void OnDestruct() const override;
bool OnMessageReceived(const IPC::Message& message) override;
+ bool Send(IPC::Message* msg) override;
// MidiManagerClient implementation.
void CompleteStartSession(media::midi::Result result) override;
@@ -120,6 +122,12 @@ class CONTENT_EXPORT MidiHost : public BrowserMessageFilter,
// Protects access to |output_port_count_|.
base::Lock output_port_count_lock_;
+ // Represents whether if the IPC channel is about to close.
+ bool is_channel_closing_;
+
+ // Protects access to |is_channel_closing_|.
+ base::Lock is_channel_closing_lock_;
+
DISALLOW_COPY_AND_ASSIGN(MidiHost);
};
« 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