Chromium Code Reviews| Index: webkit/media/crypto/proxy_decryptor.h |
| diff --git a/webkit/media/crypto/proxy_decryptor.h b/webkit/media/crypto/proxy_decryptor.h |
| index 61360ebaceb5f33235cdef782ae9d719ba2bf6a7..5666ff8819b15133e038089dbc58b06ed9ae3801 100644 |
| --- a/webkit/media/crypto/proxy_decryptor.h |
| +++ b/webkit/media/crypto/proxy_decryptor.h |
| @@ -6,11 +6,16 @@ |
| #define WEBKIT_MEDIA_CRYPTO_PROXY_DECRYPTOR_H_ |
| #include <string> |
| +#include <vector> |
| #include "base/memory/scoped_ptr.h" |
| #include "base/synchronization/lock.h" |
| #include "media/base/decryptor.h" |
| +namespace base { |
| +class MessageLoopProxy; |
| +} |
| + |
| namespace media { |
| class DecryptorClient; |
| } |
| @@ -33,6 +38,11 @@ class ProxyDecryptor : public media::Decryptor { |
| WebKit::WebFrame* web_frame); |
| virtual ~ProxyDecryptor(); |
| + // This is only for testing purpose. |
|
scherkus (not reviewing)
2012/07/28 23:07:19
instead of a comment + setter that looks like it's
xhwang
2012/07/30 19:58:10
Done.
|
| + void set_decryptor(scoped_ptr<media::Decryptor> decryptor) { |
| + decryptor_ = decryptor.Pass(); |
| + } |
| + |
| // media::Decryptor implementation. |
| virtual void GenerateKeyRequest(const std::string& key_system, |
| const uint8* init_data, |
| @@ -53,6 +63,21 @@ class ProxyDecryptor : public media::Decryptor { |
| const std::string& key_system); |
| scoped_ptr<media::Decryptor> CreateDecryptor(const std::string& key_system); |
| + // Helper function that makes sure decryptor_->Decrypt() runs on the |
| + // |message_loop|. |
| + void DecryptOnMessageLoop( |
| + const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
| + const scoped_refptr<media::DecoderBuffer>& encrypted, |
| + const media::Decryptor::DecryptCB& decrypt_cb); |
| + |
| + // Callback used to pass into decryptor_->Decrypt(). |
| + void OnBufferDecrypted( |
| + const scoped_refptr<base::MessageLoopProxy>& message_loop_proxy, |
| + const scoped_refptr<media::DecoderBuffer>& encrypted, |
| + const media::Decryptor::DecryptCB& decrypt_cb, |
| + media::Decryptor::DecryptStatus status, |
| + const scoped_refptr<media::DecoderBuffer>& decrypted); |
| + |
| media::DecryptorClient* client_; |
| // Needed to create the PpapiDecryptor. |
| @@ -65,9 +90,13 @@ class ProxyDecryptor : public media::Decryptor { |
| // when this rule is obeyed. This lock is solely to prevent the race condition |
| // between setting the |decryptor_| in GenerateKeyRequest() and using it in |
| // Decrypt(). |
| - base::Lock lock_; |
| + base::Lock decryptor_lock_; |
| scoped_ptr<media::Decryptor> decryptor_; // Protected by the |lock_|. |
| + // Protects the |pending_decrypt_closures_|. |
| + base::Lock pending_decrypt_closures_lock_; |
|
scherkus (not reviewing)
2012/07/28 23:07:19
see my other comment -- we don't need this
xhwang
2012/07/30 19:58:10
Done.
|
| + std::vector<base::Closure> pending_decrypt_closures_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
| }; |