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

Side by Side Diff: media/filters/decrypting_demuxer_stream.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/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.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 (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_DECRYPTING_DEMUXER_STREAM_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
6 #define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 6 #define MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 void DoReset(); 92 void DoReset();
93 93
94 // Returns Decryptor::StreamType converted from |stream_type_|. 94 // Returns Decryptor::StreamType converted from |stream_type_|.
95 Decryptor::StreamType GetDecryptorStreamType() const; 95 Decryptor::StreamType GetDecryptorStreamType() const;
96 96
97 // Creates and initializes either |audio_config_| or |video_config_| based on 97 // Creates and initializes either |audio_config_| or |video_config_| based on
98 // |demuxer_stream_|. 98 // |demuxer_stream_|.
99 void InitializeDecoderConfig(); 99 void InitializeDecoderConfig();
100 100
101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 101 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
102 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_;
103 base::WeakPtr<DecryptingDemuxerStream> weak_this_;
104 102
105 State state_; 103 State state_;
106 104
107 PipelineStatusCB init_cb_; 105 PipelineStatusCB init_cb_;
108 ReadCB read_cb_; 106 ReadCB read_cb_;
109 base::Closure reset_cb_; 107 base::Closure reset_cb_;
110 108
111 // Pointer to the input demuxer stream that will feed us encrypted buffers. 109 // Pointer to the input demuxer stream that will feed us encrypted buffers.
112 DemuxerStream* demuxer_stream_; 110 DemuxerStream* demuxer_stream_;
113 111
114 AudioDecoderConfig audio_config_; 112 AudioDecoderConfig audio_config_;
115 VideoDecoderConfig video_config_; 113 VideoDecoderConfig video_config_;
116 114
117 // Callback to request/cancel decryptor creation notification. 115 // Callback to request/cancel decryptor creation notification.
118 SetDecryptorReadyCB set_decryptor_ready_cb_; 116 SetDecryptorReadyCB set_decryptor_ready_cb_;
119 117
120 Decryptor* decryptor_; 118 Decryptor* decryptor_;
121 119
122 // The buffer returned by the demuxer that needs to be decrypted. 120 // The buffer returned by the demuxer that needs to be decrypted.
123 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decrypt_; 121 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decrypt_;
124 122
125 // Indicates the situation where new key is added during pending decryption 123 // Indicates the situation where new key is added during pending decryption
126 // (in other words, this variable can only be set in state kPendingDecrypt). 124 // (in other words, this variable can only be set in state kPendingDecrypt).
127 // If this variable is true and kNoKey is returned then we need to try 125 // If this variable is true and kNoKey is returned then we need to try
128 // decrypting again in case the newly added key is the correct decryption key. 126 // decrypting again in case the newly added key is the correct decryption key.
129 bool key_added_while_decrypt_pending_; 127 bool key_added_while_decrypt_pending_;
130 128
129 // NOTE: Weak pointers must be invalidated before all other member variables.
130 base::WeakPtrFactory<DecryptingDemuxerStream> weak_factory_;
131 base::WeakPtr<DecryptingDemuxerStream> weak_this_;
132
131 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream); 133 DISALLOW_COPY_AND_ASSIGN(DecryptingDemuxerStream);
132 }; 134 };
133 135
134 } // namespace media 136 } // namespace media
135 137
136 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_ 138 #endif // MEDIA_FILTERS_DECRYPTING_DEMUXER_STREAM_H_
OLDNEW
« no previous file with comments | « media/filters/decrypting_audio_decoder.cc ('k') | media/filters/decrypting_demuxer_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698