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

Side by Side Diff: content/browser/renderer_host/media/audio_renderer_host.h

Issue 2869733005: Convert some audio code to OnceCallback. (Closed)
Patch Set: Rebase, comments on unretained. Created 3 years, 7 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // AudioRendererHost serves audio related requests from AudioRenderer which 5 // AudioRendererHost serves audio related requests from AudioRenderer which
6 // lives inside the render process and provide access to audio hardware. 6 // lives inside the render process and provide access to audio hardware.
7 // 7 //
8 // This class is owned by RenderProcessHostImpl, and instantiated on UI 8 // This class is owned by RenderProcessHostImpl, and instantiated on UI
9 // thread, but all other operations and method calls happen on IO thread, so we 9 // thread, but all other operations and method calls happen on IO thread, so we
10 // need to be extra careful about the lifetime of this object. AudioManager is a 10 // need to be extra careful about the lifetime of this object. AudioManager is a
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 96
97 private: 97 private:
98 friend class AudioRendererHostTest; 98 friend class AudioRendererHostTest;
99 friend class BrowserThread; 99 friend class BrowserThread;
100 friend class base::DeleteHelper<AudioRendererHost>; 100 friend class base::DeleteHelper<AudioRendererHost>;
101 friend class MockAudioRendererHost; 101 friend class MockAudioRendererHost;
102 friend class TestAudioRendererHost; 102 friend class TestAudioRendererHost;
103 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream); 103 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, CreateMockStream);
104 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation); 104 FRIEND_TEST_ALL_PREFIXES(AudioRendererHostTest, MockStreamDataConversation);
105 105
106 // Internal callback type for access requests to output devices.
107 // |have_access| is true only if there is permission to access the device.
108 typedef base::Callback<void(bool have_access)> OutputDeviceAccessCB;
109
110 using AudioOutputDelegateVector = 106 using AudioOutputDelegateVector =
111 std::vector<std::unique_ptr<media::AudioOutputDelegate>>; 107 std::vector<std::unique_ptr<media::AudioOutputDelegate>>;
112 108
113 // The type of a function that is run on the UI thread to check whether the 109 // The type of a function that is run on the UI thread to check whether the
114 // routing IDs reference a valid RenderFrameHost. The function then runs 110 // routing IDs reference a valid RenderFrameHost. The function then runs
115 // |callback| on the IO thread with true/false if valid/invalid. 111 // |callback| on the IO thread with true/false if valid/invalid.
116 using ValidateRenderFrameIdFunction = 112 using ValidateRenderFrameIdFunction =
117 void (*)(int render_process_id, 113 void (*)(int render_process_id,
118 int render_frame_id, 114 int render_frame_id,
119 const base::Callback<void(bool)>& callback); 115 base::OnceCallback<void(bool)> callback);
120 116
121 ~AudioRendererHost() override; 117 ~AudioRendererHost() override;
122 118
123 // Methods called on IO thread ---------------------------------------------- 119 // Methods called on IO thread ----------------------------------------------
124 120
125 // Audio related IPC message handlers. 121 // Audio related IPC message handlers.
126 122
127 // Request permission to use an output device for use by a stream produced 123 // Request permission to use an output device for use by a stream produced
128 // in the RenderFrame referenced by |render_frame_id|. 124 // in the RenderFrame referenced by |render_frame_id|.
129 // |session_id| is used for unified IO to find out which input device to be 125 // |session_id| is used for unified IO to find out which input device to be
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 ValidateRenderFrameIdFunction validate_render_frame_id_function_; 218 ValidateRenderFrameIdFunction validate_render_frame_id_function_;
223 219
224 AudioOutputAuthorizationHandler authorization_handler_; 220 AudioOutputAuthorizationHandler authorization_handler_;
225 221
226 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost); 222 DISALLOW_COPY_AND_ASSIGN(AudioRendererHost);
227 }; 223 };
228 224
229 } // namespace content 225 } // namespace content
230 226
231 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_ 227 #endif // CONTENT_BROWSER_RENDERER_HOST_MEDIA_AUDIO_RENDERER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698