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

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: Rebase 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 ecccbf28673f99a3cdeaca8972cca16c36dfd467..499a05a59559aee9fa0fda8e2c73d6d66d545c94 100644
--- a/webkit/media/crypto/proxy_decryptor.h
+++ b/webkit/media/crypto/proxy_decryptor.h
@@ -38,6 +38,10 @@ class ProxyDecryptor : public media::Decryptor {
WebKit::WebFrame* web_frame);
virtual ~ProxyDecryptor();
+ void set_decryptor_for_testing(scoped_ptr<media::Decryptor> decryptor) {
+ decryptor_ = decryptor.Pass();
+ }
+
// media::Decryptor implementation.
virtual void GenerateKeyRequest(const std::string& key_system,
const uint8* init_data,
@@ -52,6 +56,7 @@ class ProxyDecryptor : public media::Decryptor {
const std::string& session_id) OVERRIDE;
virtual void Decrypt(const scoped_refptr<media::DecoderBuffer>& encrypted,
const DecryptCB& decrypt_cb) OVERRIDE;
+ virtual void Stop() OVERRIDE;
private:
scoped_ptr<media::Decryptor> CreatePpapiDecryptor(
@@ -79,18 +84,12 @@ class ProxyDecryptor : public media::Decryptor {
WebKit::WebMediaPlayerClient* web_media_player_client_;
WebKit::WebFrame* web_frame_;
- // Protects the |decryptor_|. The Decryptor interface specifies that the
- // Decrypt() function will be called on the decoder thread and all other
- // methods on the renderer thread. The |decryptor_| itself is thread safe
- // 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 decryptor_lock_;
- scoped_ptr<media::Decryptor> decryptor_; // Protected by the |lock_|.
-
- // Protects the |pending_decrypt_closures_|.
- base::Lock pending_decrypt_closures_lock_;
+ // Protects the |decryptor_| and |pending_decrypt_closures_|. Note that
+ // |decryptor_| itself should be thread safe as per the Decryptor interface.
+ base::Lock lock_;
+ scoped_ptr<media::Decryptor> decryptor_;
std::vector<base::Closure> pending_decrypt_closures_;
+ bool is_shutting_down_;
scherkus (not reviewing) 2012/08/02 18:05:32 nit: use stopped_ instead
xhwang 2012/08/03 20:08:10 Done.
DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor);
};

Powered by Google App Engine
This is Rietveld 408576698