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

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: Address timav@'s comments. 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
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/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/scoped_vector.h" 14 #include "base/memory/scoped_vector.h"
jrummell 2015/10/29 21:05:17 #include "base/memory/ref_counted.h"?
xhwang 2015/10/30 16:20:59 Done.
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "media/base/cdm_context.h" 16 #include "media/base/cdm_context.h"
17 #include "media/base/decryptor.h" 17 #include "media/base/decryptor.h"
18 #include "media/base/eme_constants.h" 18 #include "media/base/eme_constants.h"
19 #include "media/base/media_export.h" 19 #include "media/base/media_export.h"
20 #include "media/base/media_keys.h" 20 #include "media/base/media_keys.h"
21 #include "url/gurl.h" 21 #include "url/gurl.h"
22 22
23 namespace media { 23 namespace media {
24 24
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 void AddKey(const uint8* key, int key_length, 70 void AddKey(const uint8* key, int key_length,
71 const uint8* init_data, int init_data_length, 71 const uint8* init_data, int init_data_length,
72 const std::string& session_id); 72 const std::string& session_id);
73 void CancelKeyRequest(const std::string& session_id); 73 void CancelKeyRequest(const std::string& session_id);
74 74
75 private: 75 private:
76 // Callback for CreateCdm(). 76 // Callback for CreateCdm().
77 void OnCdmCreated(const std::string& key_system, 77 void OnCdmCreated(const std::string& key_system,
78 const GURL& security_origin, 78 const GURL& security_origin,
79 const CdmContextReadyCB& cdm_context_ready_cb, 79 const CdmContextReadyCB& cdm_context_ready_cb,
80 scoped_ptr<MediaKeys> cdm, 80 const scoped_refptr<MediaKeys>& cdm,
81 const std::string& error_message); 81 const std::string& error_message);
82 82
83 void GenerateKeyRequestInternal(EmeInitDataType init_data_type, 83 void GenerateKeyRequestInternal(EmeInitDataType init_data_type,
84 const std::vector<uint8>& init_data); 84 const std::vector<uint8>& init_data);
85 85
86 // Callbacks for firing session events. 86 // Callbacks for firing session events.
87 void OnSessionMessage(const std::string& session_id, 87 void OnSessionMessage(const std::string& session_id,
88 MediaKeys::MessageType message_type, 88 MediaKeys::MessageType message_type,
89 const std::vector<uint8>& message, 89 const std::vector<uint8>& message,
90 const GURL& legacy_destination_url); 90 const GURL& legacy_destination_url);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 const std::vector<uint8>& init_data); 122 const std::vector<uint8>& init_data);
123 ~PendingGenerateKeyRequestData(); 123 ~PendingGenerateKeyRequestData();
124 124
125 const EmeInitDataType init_data_type; 125 const EmeInitDataType init_data_type;
126 const std::vector<uint8> init_data; 126 const std::vector<uint8> init_data;
127 }; 127 };
128 128
129 bool is_creating_cdm_; 129 bool is_creating_cdm_;
130 130
131 // The real MediaKeys that manages key operations for the ProxyDecryptor. 131 // The real MediaKeys that manages key operations for the ProxyDecryptor.
132 scoped_ptr<MediaKeys> media_keys_; 132 scoped_refptr<MediaKeys> media_keys_;
133 133
134 #if defined(OS_CHROMEOS) || defined(OS_ANDROID) 134 #if defined(OS_CHROMEOS) || defined(OS_ANDROID)
135 MediaPermission* media_permission_; 135 MediaPermission* media_permission_;
136 #endif 136 #endif
137 137
138 bool use_hw_secure_codecs_; 138 bool use_hw_secure_codecs_;
139 139
140 // Callbacks for firing key events. 140 // Callbacks for firing key events.
141 KeyAddedCB key_added_cb_; 141 KeyAddedCB key_added_cb_;
142 KeyErrorCB key_error_cb_; 142 KeyErrorCB key_error_cb_;
(...skipping 11 matching lines...) Expand all
154 154
155 // NOTE: Weak pointers must be invalidated before all other member variables. 155 // NOTE: Weak pointers must be invalidated before all other member variables.
156 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_; 156 base::WeakPtrFactory<ProxyDecryptor> weak_ptr_factory_;
157 157
158 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor); 158 DISALLOW_COPY_AND_ASSIGN(ProxyDecryptor);
159 }; 159 };
160 160
161 } // namespace media 161 } // namespace media
162 162
163 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_ 163 #endif // MEDIA_CDM_PROXY_DECRYPTOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698