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

Side by Side Diff: media/filters/video_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 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_FILTERS_VIDEO_RENDERER_IMPL_H_ 5 #ifndef MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
6 #define MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ 6 #define MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
7 7
8 #include <deque> 8 #include <deque>
9 9
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // Returns true of all conditions have been met to transition from 130 // Returns true of all conditions have been met to transition from
131 // kPrerolling to kPrerolled. 131 // kPrerolling to kPrerolled.
132 bool ShouldTransitionToPrerolled_Locked(); 132 bool ShouldTransitionToPrerolled_Locked();
133 133
134 // Runs |statistics_cb_| with |frames_decoded_| and |frames_dropped_|, resets 134 // Runs |statistics_cb_| with |frames_decoded_| and |frames_dropped_|, resets
135 // them to 0, and then waits on |frame_available_| for up to the 135 // them to 0, and then waits on |frame_available_| for up to the
136 // |wait_duration|. 136 // |wait_duration|.
137 void UpdateStatsAndWait_Locked(base::TimeDelta wait_duration); 137 void UpdateStatsAndWait_Locked(base::TimeDelta wait_duration);
138 138
139 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 139 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
140 base::WeakPtrFactory<VideoRendererImpl> weak_factory_;
141 base::WeakPtr<VideoRendererImpl> weak_this_;
142 140
143 // Used for accessing data members. 141 // Used for accessing data members.
144 base::Lock lock_; 142 base::Lock lock_;
145 143
146 // Provides video frames to VideoRendererImpl. 144 // Provides video frames to VideoRendererImpl.
147 VideoFrameStream video_frame_stream_; 145 VideoFrameStream video_frame_stream_;
148 146
149 // Queue of incoming frames yet to be painted. 147 // Queue of incoming frames yet to be painted.
150 typedef std::deque<scoped_refptr<VideoFrame> > VideoFrameQueue; 148 typedef std::deque<scoped_refptr<VideoFrame> > VideoFrameQueue;
151 VideoFrameQueue ready_frames_; 149 VideoFrameQueue ready_frames_;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 // The timestamp of the last frame removed from the |ready_frames_| queue, 231 // The timestamp of the last frame removed from the |ready_frames_| queue,
234 // either for calling |paint_cb_| or for dropping. Set to kNoTimestamp() 232 // either for calling |paint_cb_| or for dropping. Set to kNoTimestamp()
235 // during flushing. 233 // during flushing.
236 base::TimeDelta last_timestamp_; 234 base::TimeDelta last_timestamp_;
237 235
238 // Keeps track of the number of frames decoded and dropped since the 236 // Keeps track of the number of frames decoded and dropped since the
239 // last call to |statistics_cb_|. These must be accessed under lock. 237 // last call to |statistics_cb_|. These must be accessed under lock.
240 int frames_decoded_; 238 int frames_decoded_;
241 int frames_dropped_; 239 int frames_dropped_;
242 240
241 // NOTE: These must always be last so they're invalidated before other member
242 // variables might be accessed.
243 base::WeakPtr<VideoRendererImpl> weak_this_;
Ami GONE FROM CHROMIUM 2014/03/10 22:02:08 ditto
244 base::WeakPtrFactory<VideoRendererImpl> weak_factory_;
245
243 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl); 246 DISALLOW_COPY_AND_ASSIGN(VideoRendererImpl);
244 }; 247 };
245 248
246 } // namespace media 249 } // namespace media
247 250
248 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_ 251 #endif // MEDIA_FILTERS_VIDEO_RENDERER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698