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..cd664fc6204bd7f27baa4bb709b00ec544722c41 100644 |
--- a/webkit/media/crypto/proxy_decryptor.h |
+++ b/webkit/media/crypto/proxy_decryptor.h |
@@ -6,11 +6,14 @@ |
#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" |
+class MessageLoop; |
+ |
namespace media { |
class DecryptorClient; |
} |
@@ -53,6 +56,20 @@ 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( |
+ MessageLoop* message_loop, |
+ const scoped_refptr<media::DecoderBuffer>& encrypted, |
+ const media::Decryptor::DecryptCB& decrypt_cb); |
+ |
+ // Callback used to pass into decryptor_->Decrypt(). |
+ void OnBufferDecrypted(MessageLoop* message_loop, |
+ 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 +82,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_; |
+ std::vector<base::Closure> pending_decrypt_closures_; |
+ |
DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); |
}; |