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

Side by Side Diff: media/cdm/proxy_decryptor.h

Issue 1407933010: media: Make MediaKeys ref-counted. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/cdm/proxy_decryptor.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_CDM_PROXY_DECRYPTOR_H_ 5 #ifndef MEDIA_CDM_PROXY_DECRYPTOR_H_
6 #define MEDIA_CDM_PROXY_DECRYPTOR_H_ 6 #define MEDIA_CDM_PROXY_DECRYPTOR_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/basictypes.h" 11 #include "base/basictypes.h"
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 15 #include "base/memory/scoped_vector.h"
15 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
16 #include "media/base/cdm_context.h" 17 #include "media/base/cdm_context.h"
17 #include "media/base/decryptor.h" 18 #include "media/base/decryptor.h"
18 #include "media/base/eme_constants.h" 19 #include "media/base/eme_constants.h"
19 #include "media/base/media_export.h" 20 #include "media/base/media_export.h"
20 #include "media/base/media_keys.h" 21 #include "media/base/media_keys.h"
21 #include "url/gurl.h" 22 #include "url/gurl.h"
22 23
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void AddKey(const uint8* key, int key_length, 71 void AddKey(const uint8* key, int key_length,
71 const uint8* init_data, int init_data_length, 72 const uint8* init_data, int init_data_length,
72 const std::string& session_id); 73 const std::string& session_id);
73 void CancelKeyRequest(const std::string& session_id); 74 void CancelKeyRequest(const std::string& session_id);
74 75
75 private: 76 private:
76 // Callback for CreateCdm(). 77 // Callback for CreateCdm().
77 void OnCdmCreated(const std::string& key_system, 78 void OnCdmCreated(const std::string& key_system,
78 const GURL& security_origin, 79 const GURL& security_origin,
79 const CdmContextReadyCB& cdm_context_ready_cb, 80 const CdmContextReadyCB& cdm_context_ready_cb,
80 scoped_ptr<MediaKeys> cdm, 81 const scoped_refptr<MediaKeys>& cdm,
81 const std::string& error_message); 82 const std::string& error_message);
82 83
83 void GenerateKeyRequestInternal(EmeInitDataType init_data_type, 84 void GenerateKeyRequestInternal(EmeInitDataType init_data_type,
84 const std::vector<uint8>& init_data); 85 const std::vector<uint8>& init_data);
85 86
86 // Callbacks for firing session events. 87 // Callbacks for firing session events.
87 void OnSessionMessage(const std::string& session_id, 88 void OnSessionMessage(const std::string& session_id,
88 MediaKeys::MessageType message_type, 89 MediaKeys::MessageType message_type,
89 const std::vector<uint8>& message, 90 const std::vector<uint8>& message,
90 const GURL& legacy_destination_url); 91 const GURL& legacy_destination_url);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const std::vector<uint8>& init_data); 123 const std::vector<uint8>& init_data);
123 ~PendingGenerateKeyRequestData(); 124 ~PendingGenerateKeyRequestData();
124 125
125 const EmeInitDataType init_data_type; 126 const EmeInitDataType init_data_type;
126 const std::vector<uint8> init_data; 127 const std::vector<uint8> init_data;
127 }; 128 };
128 129
129 bool is_creating_cdm_; 130 bool is_creating_cdm_;
130 131
131 // The real MediaKeys that manages key operations for the ProxyDecryptor. 132 // The real MediaKeys that manages key operations for the ProxyDecryptor.
132 scoped_ptr<MediaKeys> media_keys_; 133 scoped_refptr<MediaKeys> media_keys_;
133 134
134 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 135 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
135 MediaPermission* media_permission_; 136 MediaPermission* media_permission_;
136 #endif 137 #endif
137 138
138 bool use_hw_secure_codecs_; 139 bool use_hw_secure_codecs_;
139 140
140 // Callbacks for firing key events. 141 // Callbacks for firing key events.
141 KeyAddedCB key_added_cb_; 142 KeyAddedCB key_added_cb_;
142 KeyErrorCB key_error_cb_; 143 KeyErrorCB key_error_cb_;
(...skipping 11 matching lines...) Expand all
154 155
155 // NOTE: Weak pointers must be invalidated before all other member variables. 156 // NOTE: Weak pointers must be invalidated before all other member variables.
156 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; 157 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_;
157 158
158 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); 159 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor);
159 }; 160 };
160 161
161 } // namespace media 162 } // namespace media
162 163
163 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_ 164 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « media/cdm/ppapi/external_clear_key/clear_key_cdm.cc ('k') | media/cdm/proxy_decryptor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698