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

Side by Side Diff: media/filters/decrypting_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_DECRYPTING_VIDEO_DECODER_H_ 5 #ifndef MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ 6 #define MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_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 "media/base/decryptor.h" 10 #include "media/base/decryptor.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // added. 72 // added.
73 void OnKeyAdded(); 73 void OnKeyAdded();
74 74
75 // Reset decoder and call |reset_cb_|. 75 // Reset decoder and call |reset_cb_|.
76 void DoReset(); 76 void DoReset();
77 77
78 // Free decoder resources and call |stop_cb_|. 78 // Free decoder resources and call |stop_cb_|.
79 void DoStop(); 79 void DoStop();
80 80
81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; 81 scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
82 base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_;
83 base::WeakPtr<DecryptingVideoDecoder> weak_this_;
84 82
85 State state_; 83 State state_;
86 84
87 PipelineStatusCB init_cb_; 85 PipelineStatusCB init_cb_;
88 DecodeCB decode_cb_; 86 DecodeCB decode_cb_;
89 base::Closure reset_cb_; 87 base::Closure reset_cb_;
90 88
91 VideoDecoderConfig config_; 89 VideoDecoderConfig config_;
92 90
93 // Callback to request/cancel decryptor creation notification. 91 // Callback to request/cancel decryptor creation notification.
94 SetDecryptorReadyCB set_decryptor_ready_cb_; 92 SetDecryptorReadyCB set_decryptor_ready_cb_;
95 93
96 Decryptor* decryptor_; 94 Decryptor* decryptor_;
97 95
98 // The buffer that needs decrypting/decoding. 96 // The buffer that needs decrypting/decoding.
99 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_; 97 scoped_refptr<media::DecoderBuffer> pending_buffer_to_decode_;
100 98
101 // Indicates the situation where new key is added during pending decode 99 // Indicates the situation where new key is added during pending decode
102 // (in other words, this variable can only be set in state kPendingDecode). 100 // (in other words, this variable can only be set in state kPendingDecode).
103 // If this variable is true and kNoKey is returned then we need to try 101 // If this variable is true and kNoKey is returned then we need to try
104 // decrypting/decoding again in case the newly added key is the correct 102 // decrypting/decoding again in case the newly added key is the correct
105 // decryption key. 103 // decryption key.
106 bool key_added_while_decode_pending_; 104 bool key_added_while_decode_pending_;
107 105
108 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the 106 // A unique ID to trace Decryptor::DecryptAndDecodeVideo() call and the
109 // matching DecryptCB call (in DoDeliverFrame()). 107 // matching DecryptCB call (in DoDeliverFrame()).
110 uint32 trace_id_; 108 uint32 trace_id_;
111 109
110 // NOTE: These must always be last so they're invalidated before other member
111 // variables might be accessed.
112 base::WeakPtr<DecryptingVideoDecoder> weak_this_;
Ami GONE FROM CHROMIUM 2014/03/10 22:02:08 ditto
113 base::WeakPtrFactory<DecryptingVideoDecoder> weak_factory_;
114
112 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder); 115 DISALLOW_COPY_AND_ASSIGN(DecryptingVideoDecoder);
113 }; 116 };
114 117
115 } // namespace media 118 } // namespace media
116 119
117 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_ 120 #endif // MEDIA_FILTERS_DECRYPTING_VIDEO_DECODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698