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

Side by Side Diff: media/filters/ffmpeg_video_decoder.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 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
7 7
8 #include <list> 8 #include <list>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 bool ConfigureDecoder(); 65 bool ConfigureDecoder();
66 66
67 // Releases resources associated with |codec_context_| and |av_frame_| 67 // Releases resources associated with |codec_context_| and |av_frame_|
68 // and resets them to NULL. 68 // and resets them to NULL.
69 void ReleaseFFmpegResources(); 69 void ReleaseFFmpegResources();
70 70
71 // Reset decoder and call |reset_cb_|. 71 // Reset decoder and call |reset_cb_|.
72 void DoReset(); 72 void DoReset();
73 73
74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 74 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
75 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_;
76 base::WeakPtr<FFmpegVideoDecoder> weak_this_;
77 75
78 DecoderState state_; 76 DecoderState state_;
79 77
80 DecodeCB decode_cb_; 78 DecodeCB decode_cb_;
81 base::Closure reset_cb_; 79 base::Closure reset_cb_;
82 80
83 // FFmpeg structures owned by this object. 81 // FFmpeg structures owned by this object.
84 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_; 82 scoped_ptr_malloc<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
85 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_; 83 scoped_ptr_malloc<AVFrame, ScopedPtrAVFreeFrame> av_frame_;
86 84
87 VideoDecoderConfig config_; 85 VideoDecoderConfig config_;
88 86
89 VideoFramePool frame_pool_; 87 VideoFramePool frame_pool_;
90 88
89 // NOTE: These must always be last so they're invalidated before other member
90 // variables might be accessed.
91 base::WeakPtr<FFmpegVideoDecoder> weak_this_;
Ami GONE FROM CHROMIUM 2014/03/10 22:02:08 ditto
92 base::WeakPtrFactory<FFmpegVideoDecoder> weak_factory_;
93
91 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder); 94 DISALLOW_COPY_AND_ASSIGN(FFmpegVideoDecoder);
92 }; 95 };
93 96
94 } // namespace media 97 } // namespace media
95 98
96 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_ 99 #endif // MEDIA_FILTERS_FFMPEG_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698