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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/media/midi_host.cc » ('j') | content/browser/media/midi_host.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ 5 #ifndef CONTENT_BROWSER_MEDIA_MIDI_HOST_H_
6 #define CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ 6 #define CONTENT_BROWSER_MEDIA_MIDI_HOST_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 20 matching lines...) Expand all
31 31
32 namespace content { 32 namespace content {
33 33
34 class CONTENT_EXPORT MidiHost : public BrowserMessageFilter, 34 class CONTENT_EXPORT MidiHost : public BrowserMessageFilter,
35 public media::midi::MidiManagerClient { 35 public media::midi::MidiManagerClient {
36 public: 36 public:
37 // Called from UI thread from the owner of this object. 37 // Called from UI thread from the owner of this object.
38 MidiHost(int renderer_process_id, media::midi::MidiManager* midi_manager); 38 MidiHost(int renderer_process_id, media::midi::MidiManager* midi_manager);
39 39
40 // BrowserMessageFilter implementation. 40 // BrowserMessageFilter implementation.
41 void OnChannelClosing() override;
41 void OnDestruct() const override; 42 void OnDestruct() const override;
42 bool OnMessageReceived(const IPC::Message& message) override; 43 bool OnMessageReceived(const IPC::Message& message) override;
44 bool Send(IPC::Message* msg) override;
43 45
44 // MidiManagerClient implementation. 46 // MidiManagerClient implementation.
45 void CompleteStartSession(media::midi::Result result) override; 47 void CompleteStartSession(media::midi::Result result) override;
46 void AddInputPort(const media::midi::MidiPortInfo& info) override; 48 void AddInputPort(const media::midi::MidiPortInfo& info) override;
47 void AddOutputPort(const media::midi::MidiPortInfo& info) override; 49 void AddOutputPort(const media::midi::MidiPortInfo& info) override;
48 void SetInputPortState(uint32_t port, 50 void SetInputPortState(uint32_t port,
49 media::midi::MidiPortState state) override; 51 media::midi::MidiPortState state) override;
50 void SetOutputPortState(uint32_t port, 52 void SetOutputPortState(uint32_t port,
51 media::midi::MidiPortState state) override; 53 media::midi::MidiPortState state) override;
52 void ReceiveMidiData(uint32_t port, 54 void ReceiveMidiData(uint32_t port,
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 115
114 // Protects access to |sent_bytes_in_flight_|. 116 // Protects access to |sent_bytes_in_flight_|.
115 base::Lock in_flight_lock_; 117 base::Lock in_flight_lock_;
116 118
117 // How many output port exists. 119 // How many output port exists.
118 uint32_t output_port_count_; 120 uint32_t output_port_count_;
119 121
120 // Protects access to |output_port_count_|. 122 // Protects access to |output_port_count_|.
121 base::Lock output_port_count_lock_; 123 base::Lock output_port_count_lock_;
122 124
125 // Represents whether if the IPC channel is about to close.
126 bool is_channel_closing_;
127
128 // Protects access to |is_channel_closing_|.
129 base::Lock is_channel_closing_lock_;
130
123 DISALLOW_COPY_AND_ASSIGN(MidiHost); 131 DISALLOW_COPY_AND_ASSIGN(MidiHost);
124 }; 132 };
125 133
126 } // namespace content 134 } // namespace content
127 135
128 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_ 136 #endif // CONTENT_BROWSER_MEDIA_MIDI_HOST_H_
OLDNEW
« 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