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

Side by Side Diff: media/filters/audio_renderer_impl.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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 // Audio rendering unit utilizing an AudioRendererSink to output data. 5 // Audio rendering unit utilizing an AudioRendererSink to output data.
6 // 6 //
7 // This class lives inside three threads during it's lifetime, namely: 7 // This class lives inside three threads during it's lifetime, namely:
8 // 1. Render thread 8 // 1. Render thread
9 // Where the object is created. 9 // Where the object is created.
10 // 2. Media thread (provided via constructor) 10 // 2. Media thread (provided via constructor)
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 // called when the reset completes. 181 // called when the reset completes.
182 void ResetDecoder(); 182 void ResetDecoder();
183 183
184 // Called when the |decoder_|.Reset() has completed. 184 // Called when the |decoder_|.Reset() has completed.
185 void ResetDecoderDone(); 185 void ResetDecoderDone();
186 186
187 // Stops the |decoder_| if present. Ensures |stop_cb_| is called. 187 // Stops the |decoder_| if present. Ensures |stop_cb_| is called.
188 void StopDecoder(); 188 void StopDecoder();
189 189
190 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 190 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
191 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
192 base::WeakPtr<AudioRendererImpl> weak_this_;
193 191
194 scoped_ptr<AudioSplicer> splicer_; 192 scoped_ptr<AudioSplicer> splicer_;
195 193
196 // The sink (destination) for rendered audio. |sink_| must only be accessed 194 // The sink (destination) for rendered audio. |sink_| must only be accessed
197 // on |task_runner_|. |sink_| must never be called under |lock_| or else we 195 // on |task_runner_|. |sink_| must never be called under |lock_| or else we
198 // may deadlock between |task_runner_| and the audio callback thread. 196 // may deadlock between |task_runner_| and the audio callback thread.
199 scoped_refptr<media::AudioRendererSink> sink_; 197 scoped_refptr<media::AudioRendererSink> sink_;
200 198
201 scoped_ptr<AudioDecoderSelector> decoder_selector_; 199 scoped_ptr<AudioDecoderSelector> decoder_selector_;
202 200
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 size_t total_frames_filled_; 271 size_t total_frames_filled_;
274 272
275 bool underflow_disabled_; 273 bool underflow_disabled_;
276 274
277 // True if the renderer receives a buffer with kAborted status during preroll, 275 // True if the renderer receives a buffer with kAborted status during preroll,
278 // false otherwise. This flag is cleared on the next Preroll() call. 276 // false otherwise. This flag is cleared on the next Preroll() call.
279 bool preroll_aborted_; 277 bool preroll_aborted_;
280 278
281 // End variables which must be accessed under |lock_|. ---------------------- 279 // End variables which must be accessed under |lock_|. ----------------------
282 280
281 // NOTE: These must always be last so they're invalidated before other member
282 // variables might be accessed.
283 base::WeakPtr<AudioRendererImpl> weak_this_;
Ami GONE FROM CHROMIUM 2014/03/10 22:02:08 ditto
284 base::WeakPtrFactory<AudioRendererImpl> weak_factory_;
285
283 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl); 286 DISALLOW_COPY_AND_ASSIGN(AudioRendererImpl);
284 }; 287 };
285 288
286 } // namespace media 289 } // namespace media
287 290
288 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_ 291 #endif // MEDIA_FILTERS_AUDIO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698