| 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 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 | 109 |
| 110 DCHECK(read_cb_.is_null()); | 110 DCHECK(read_cb_.is_null()); |
| 111 DoReset(); | 111 DoReset(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void DecryptingDemuxerStream::Stop(const base::Closure& closure) { | 114 void DecryptingDemuxerStream::Stop(const base::Closure& closure) { |
| 115 DVLOG(2) << __FUNCTION__ << " - state: " << state_; | 115 DVLOG(2) << __FUNCTION__ << " - state: " << state_; |
| 116 DCHECK(task_runner_->BelongsToCurrentThread()); | 116 DCHECK(task_runner_->BelongsToCurrentThread()); |
| 117 DCHECK(state_ != kUninitialized) << state_; | 117 DCHECK(state_ != kUninitialized) << state_; |
| 118 | 118 |
| 119 // Invalidate all weak pointers so that pending callbacks won't fire. | 119 // Invalidate all weak pointers so that pending callbacks won't be fired into |
| 120 // this object. |
| 120 weak_factory_.InvalidateWeakPtrs(); | 121 weak_factory_.InvalidateWeakPtrs(); |
| 121 | 122 |
| 122 // 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 |
| 123 // 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 |
| 124 // render thread to process messages to complete (such as PPAPI methods). | 125 // render thread to process messages to complete (such as PPAPI methods). |
| 125 if (decryptor_) { | 126 if (decryptor_) { |
| 126 // Clear the callback. | 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. |
| 127 decryptor_->RegisterNewKeyCB(GetDecryptorStreamType(), | 131 decryptor_->RegisterNewKeyCB(GetDecryptorStreamType(), |
| 128 Decryptor::NewKeyCB()); | 132 Decryptor::NewKeyCB()); |
| 129 decryptor_->CancelDecrypt(GetDecryptorStreamType()); | 133 decryptor_->CancelDecrypt(GetDecryptorStreamType()); |
| 130 decryptor_ = NULL; | 134 decryptor_ = NULL; |
| 131 } | 135 } |
| 132 if (!set_decryptor_ready_cb_.is_null()) | 136 if (!set_decryptor_ready_cb_.is_null()) |
| 133 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); | 137 base::ResetAndReturn(&set_decryptor_ready_cb_).Run(DecryptorReadyCB()); |
| 134 if (!init_cb_.is_null()) | 138 if (!init_cb_.is_null()) |
| 135 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); | 139 base::ResetAndReturn(&init_cb_).Run(PIPELINE_ERROR_ABORT); |
| 136 if (!read_cb_.is_null()) | 140 if (!read_cb_.is_null()) |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 break; | 393 break; |
| 390 } | 394 } |
| 391 | 395 |
| 392 default: | 396 default: |
| 393 NOTREACHED(); | 397 NOTREACHED(); |
| 394 return; | 398 return; |
| 395 } | 399 } |
| 396 } | 400 } |
| 397 | 401 |
| 398 } // namespace media | 402 } // namespace media |
| OLD | NEW |