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

Side by Side Diff: media/base/android/media_decoder_job.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. 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
« no previous file with comments | « media/audio/alsa/alsa_output.cc ('k') | media/base/android/media_decoder_job.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ 5 #ifndef MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_
6 #define MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ 6 #define MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // is not very accurate. 163 // is not very accurate.
164 base::TimeDelta preroll_timestamp_; 164 base::TimeDelta preroll_timestamp_;
165 165
166 // Indicates prerolling state. If true, this job has not yet decoded output 166 // Indicates prerolling state. If true, this job has not yet decoded output
167 // that it will render, since the most recent of job construction or 167 // that it will render, since the most recent of job construction or
168 // BeginPrerolling(). If false, |preroll_timestamp_| has been reached. 168 // BeginPrerolling(). If false, |preroll_timestamp_| has been reached.
169 // TODO(qinmin): Comparing access unit's timestamp with |preroll_timestamp_| 169 // TODO(qinmin): Comparing access unit's timestamp with |preroll_timestamp_|
170 // is not very accurate. 170 // is not very accurate.
171 bool prerolling_; 171 bool prerolling_;
172 172
173 // Weak pointer passed to media decoder jobs for callbacks. It is bounded to
174 // the decoder thread.
175 base::WeakPtrFactory<MediaDecoderJob> weak_this_;
176
177 // Callback used to request more data. 173 // Callback used to request more data.
178 base::Closure request_data_cb_; 174 base::Closure request_data_cb_;
179 175
180 // Callback to run when new data has been received. 176 // Callback to run when new data has been received.
181 base::Closure on_data_received_cb_; 177 base::Closure on_data_received_cb_;
182 178
183 // Callback to run when the current Decode() operation completes. 179 // Callback to run when the current Decode() operation completes.
184 DecoderCallback decode_cb_; 180 DecoderCallback decode_cb_;
185 181
186 // The current access unit being processed. 182 // The current access unit being processed.
187 size_t access_unit_index_; 183 size_t access_unit_index_;
188 184
189 // Data received over IPC from last RequestData() operation. 185 // Data received over IPC from last RequestData() operation.
190 DemuxerData received_data_; 186 DemuxerData received_data_;
191 187
192 // The index of input buffer that can be used by QueueInputBuffer(). 188 // The index of input buffer that can be used by QueueInputBuffer().
193 // If the index is uninitialized or invalid, it must be -1. 189 // If the index is uninitialized or invalid, it must be -1.
194 int input_buf_index_; 190 int input_buf_index_;
195 191
196 bool stop_decode_pending_; 192 bool stop_decode_pending_;
197 193
198 // Indicates that this object should be destroyed once the current 194 // Indicates that this object should be destroyed once the current
199 // Decode() has completed. This gets set when Release() gets called 195 // Decode() has completed. This gets set when Release() gets called
200 // while there is a decode in progress. 196 // while there is a decode in progress.
201 bool destroy_pending_; 197 bool destroy_pending_;
202 198
199 // Weak pointer passed to media decoder jobs for callbacks. It is bounded to
200 // the decoder thread.
201 // NOTE: Weak pointers must be invalidated before all other member variables.
202 base::WeakPtrFactory<MediaDecoderJob> weak_factory_;
203
203 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob); 204 DISALLOW_IMPLICIT_CONSTRUCTORS(MediaDecoderJob);
204 }; 205 };
205 206
206 } // namespace media 207 } // namespace media
207 208
208 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_ 209 #endif // MEDIA_BASE_ANDROID_MEDIA_DECODER_JOB_H_
OLDNEW
« no previous file with comments | « media/audio/alsa/alsa_output.cc ('k') | media/base/android/media_decoder_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698