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

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: Use message_loop_proxy. 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..ecccbf28673f99a3cdeaca8972cca16c36dfd467 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;
}
@@ -53,6 +58,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 +85,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/26 02:06:38 do you need separate locks?
xhwang 2012/07/26 22:16:04 I was trying to minimize the time of lock blocking
scherkus (not reviewing) 2012/07/28 23:07:19 Yes. There are three situations where a lock is r
+ std::vector<base::Closure> pending_decrypt_closures_;
+
DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor);
};

Powered by Google App Engine
This is Rietveld 408576698