Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(914)

Unified Diff: webkit/media/crypto/proxy_decryptor.h

Issue 10822026: Implement "Key Presence" step in "Encrypted Block Encounted" algorithm in EME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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);
};

Powered by Google App Engine
This is Rietveld 408576698