| OLD | NEW |
| 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 #include "media/filters/decrypting_demuxer_stream.h" | 5 #include "media/filters/decrypting_demuxer_stream.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 DCHECK(state_ != kUninitialized) << state_; | 117 DCHECK(state_ != kUninitialized) << state_; |
| 118 | 118 |
| 119 // Invalidate all weak pointers so that pending callbacks won't be fired into | 119 // Invalidate all weak pointers so that pending callbacks won't be fired into |
| 120 // this object. | 120 // this object. |
| 121 weak_factory_.InvalidateWeakPtrs(); | 121 weak_factory_.InvalidateWeakPtrs(); |
| 122 | 122 |
| 123 // At this point the render thread is likely paused (in WebMediaPlayerImpl's | 123 // At this point the render thread is likely paused (in WebMediaPlayerImpl's |
| 124 // Destroy()), so running |closure| can't wait for anything that requires the | 124 // Destroy()), so running |closure| can't wait for anything that requires the |
| 125 // render thread to process messages to complete (such as PPAPI methods). | 125 // render thread to process messages to complete (such as PPAPI methods). |
| 126 if (decryptor_) { | 126 if (decryptor_) { |
| 127 // Clear the callback. | |
| 128 // TODO(xhwang): Since we invalidate all weak pointers during Stop(), | |
| 129 // canceling NewKeyCB seems unnecessary. Clean this up in all Decrypting* | |
| 130 // classes. | |
| 131 decryptor_->RegisterNewKeyCB(GetDecryptorStreamType(), | |
| 132 Decryptor::NewKeyCB()); | |
| 133 decryptor_->CancelDecrypt(GetDecryptorStreamType()); | 127 decryptor_->CancelDecrypt(GetDecryptorStreamType()); |
| 134 decryptor_ = NULL; | 128 decryptor_ = NULL; |
| 135 } | 129 } |
| 136 if (!set_decryptor_ready_cb_.is_null()) | 130 if (!set_decryptor_ready_cb_.is_null()) |
| 137 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); | 131 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); |
| 138 if (!init_cb_.is_null()) | 132 if (!init_cb_.is_null()) |
| 139 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); | 133 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); |
| 140 if (!read_cb_.is_null()) | 134 if (!read_cb_.is_null()) |
| 141 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); | 135 base::ResetAndReturn(&read_cb_).Run(kAborted, NULL); |
| 142 if (!reset_cb_.is_null()) | 136 if (!reset_cb_.is_null()) |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 break; | 387 break; |
| 394 } | 388 } |
| 395 | 389 |
| 396 default: | 390 default: |
| 397 NOTREACHED(); | 391 NOTREACHED(); |
| 398 return; | 392 return; |
| 399 } | 393 } |
| 400 } | 394 } |
| 401 | 395 |
| 402 } // namespace media | 396 } // namespace media |
| OLD | NEW |