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

Side by Side Diff: media/blink/cdm_session_adapter.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/base/player_tracker.h ('k') | media/blink/cdm_session_adapter.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_BLINK_CDM_SESSION_ADAPTER_H_ 5 #ifndef MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ 6 #define MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Session ID to WebContentDecryptionModuleSessionImpl mapping. 104 // Session ID to WebContentDecryptionModuleSessionImpl mapping.
105 typedef base::hash_map<std::string, 105 typedef base::hash_map<std::string,
106 base::WeakPtr<WebContentDecryptionModuleSessionImpl> > 106 base::WeakPtr<WebContentDecryptionModuleSessionImpl> >
107 SessionMap; 107 SessionMap;
108 108
109 ~CdmSessionAdapter(); 109 ~CdmSessionAdapter();
110 110
111 // Callback for CreateCdm(). 111 // Callback for CreateCdm().
112 void OnCdmCreated(const std::string& key_system, 112 void OnCdmCreated(const std::string& key_system,
113 base::TimeTicks start_time, 113 base::TimeTicks start_time,
114 scoped_ptr<MediaKeys> cdm, 114 const scoped_refptr<MediaKeys>& cdm,
115 const std::string& error_message); 115 const std::string& error_message);
116 116
117 // Callbacks for firing session events. 117 // Callbacks for firing session events.
118 void OnSessionMessage(const std::string& session_id, 118 void OnSessionMessage(const std::string& session_id,
119 MediaKeys::MessageType message_type, 119 MediaKeys::MessageType message_type,
120 const std::vector<uint8_t>& message, 120 const std::vector<uint8_t>& message,
121 const GURL& legacy_destination_url); 121 const GURL& legacy_destination_url);
122 void OnSessionKeysChange(const std::string& session_id, 122 void OnSessionKeysChange(const std::string& session_id,
123 bool has_additional_usable_key, 123 bool has_additional_usable_key,
124 CdmKeysInfo keys_info); 124 CdmKeysInfo keys_info);
125 void OnSessionExpirationUpdate(const std::string& session_id, 125 void OnSessionExpirationUpdate(const std::string& session_id,
126 const base::Time& new_expiry_time); 126 const base::Time& new_expiry_time);
127 void OnSessionClosed(const std::string& session_id); 127 void OnSessionClosed(const std::string& session_id);
128 void OnLegacySessionError(const std::string& session_id, 128 void OnLegacySessionError(const std::string& session_id,
129 MediaKeys::Exception exception_code, 129 MediaKeys::Exception exception_code,
130 uint32_t system_code, 130 uint32_t system_code,
131 const std::string& error_message); 131 const std::string& error_message);
132 132
133 // Helper function of the callbacks. 133 // Helper function of the callbacks.
134 WebContentDecryptionModuleSessionImpl* GetSession( 134 WebContentDecryptionModuleSessionImpl* GetSession(
135 const std::string& session_id); 135 const std::string& session_id);
136 136
137 void ReportTimeToCreateCdmUMA(base::TimeDelta cdm_creation_time) const; 137 void ReportTimeToCreateCdmUMA(base::TimeDelta cdm_creation_time) const;
138 138
139 scoped_ptr<MediaKeys> cdm_; 139 scoped_refptr<MediaKeys> cdm_;
140 140
141 SessionMap sessions_; 141 SessionMap sessions_;
142 142
143 std::string key_system_; 143 std::string key_system_;
144 std::string key_system_uma_prefix_; 144 std::string key_system_uma_prefix_;
145 145
146 // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching 146 // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching
147 // OnCdmCreated() call. 147 // OnCdmCreated() call.
148 uint32 trace_id_; 148 uint32 trace_id_;
149 149
150 scoped_ptr<blink::WebContentDecryptionModuleResult> cdm_created_result_; 150 scoped_ptr<blink::WebContentDecryptionModuleResult> cdm_created_result_;
151 151
152 // NOTE: Weak pointers must be invalidated before all other member variables. 152 // NOTE: Weak pointers must be invalidated before all other member variables.
153 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; 153 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_;
154 154
155 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); 155 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter);
156 }; 156 };
157 157
158 } // namespace media 158 } // namespace media
159 159
160 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ 160 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_
OLDNEW
« no previous file with comments | « media/base/player_tracker.h ('k') | media/blink/cdm_session_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698