| 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 "webkit/media/crypto/proxy_decryptor.h" | 5 #include "webkit/media/crypto/proxy_decryptor.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 FireNeedKey(client_, encrypted); | 159 FireNeedKey(client_, encrypted); |
| 160 return; | 160 return; |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 decryptor->Decrypt(encrypted, base::Bind( | 164 decryptor->Decrypt(encrypted, base::Bind( |
| 165 &ProxyDecryptor::OnBufferDecrypted, base::Unretained(this), | 165 &ProxyDecryptor::OnBufferDecrypted, base::Unretained(this), |
| 166 base::MessageLoopProxy::current(), encrypted, decrypt_cb)); | 166 base::MessageLoopProxy::current(), encrypted, decrypt_cb)); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void ProxyDecryptor::Stop() { | 169 void ProxyDecryptor::CancelDecrypt() { |
| 170 DVLOG(1) << "Stop()"; | 170 DVLOG(1) << "Stop()"; |
| 171 | 171 |
| 172 std::vector<base::Closure> closures_to_run; | 172 std::vector<base::Closure> closures_to_run; |
| 173 { | 173 { |
| 174 base::AutoLock auto_lock(lock_); | 174 base::AutoLock auto_lock(lock_); |
| 175 if (decryptor_.get()) | 175 if (decryptor_.get()) |
| 176 decryptor_->Stop(); | 176 decryptor_->CancelDecrypt(); |
| 177 stopped_ = true; | 177 stopped_ = true; |
| 178 std::swap(pending_decrypt_closures_, closures_to_run); | 178 std::swap(pending_decrypt_closures_, closures_to_run); |
| 179 } | 179 } |
| 180 | 180 |
| 181 for (std::vector<base::Closure>::iterator iter = closures_to_run.begin(); | 181 for (std::vector<base::Closure>::iterator iter = closures_to_run.begin(); |
| 182 iter != closures_to_run.end(); | 182 iter != closures_to_run.end(); |
| 183 ++iter) { | 183 ++iter) { |
| 184 iter->Run(); | 184 iter->Run(); |
| 185 } | 185 } |
| 186 } | 186 } |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 &ProxyDecryptor::DecryptOnMessageLoop, base::Unretained(this), | 269 &ProxyDecryptor::DecryptOnMessageLoop, base::Unretained(this), |
| 270 message_loop_proxy, encrypted, decrypt_cb)); | 270 message_loop_proxy, encrypted, decrypt_cb)); |
| 271 } | 271 } |
| 272 // TODO(xhwang): The same NeedKey may be fired multiple times here and also | 272 // TODO(xhwang): The same NeedKey may be fired multiple times here and also |
| 273 // in Decrypt(). While the spec says only one NeedKey should be fired. Leave | 273 // in Decrypt(). While the spec says only one NeedKey should be fired. Leave |
| 274 // them as is since the spec about this may change. | 274 // them as is since the spec about this may change. |
| 275 FireNeedKey(client_, encrypted); | 275 FireNeedKey(client_, encrypted); |
| 276 } | 276 } |
| 277 | 277 |
| 278 } // namespace webkit_media | 278 } // namespace webkit_media |
| OLD | NEW |