Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 | 103 |
| 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 blink::WebContentDecryptionModuleResult result, | 114 blink::WebContentDecryptionModuleResult result, |
| 114 scoped_ptr<MediaKeys> cdm, | 115 scoped_ptr<MediaKeys> cdm, |
| 115 const std::string& error_message); | 116 const std::string& error_message); |
| 116 | 117 |
| 117 // Callbacks for firing session events. | 118 // Callbacks for firing session events. |
| 118 void OnSessionMessage(const std::string& session_id, | 119 void OnSessionMessage(const std::string& session_id, |
| 119 MediaKeys::MessageType message_type, | 120 MediaKeys::MessageType message_type, |
| 120 const std::vector<uint8_t>& message, | 121 const std::vector<uint8_t>& message, |
| 121 const GURL& legacy_destination_url); | 122 const GURL& legacy_destination_url); |
| 122 void OnSessionKeysChange(const std::string& session_id, | 123 void OnSessionKeysChange(const std::string& session_id, |
| 123 bool has_additional_usable_key, | 124 bool has_additional_usable_key, |
| 124 CdmKeysInfo keys_info); | 125 CdmKeysInfo keys_info); |
| 125 void OnSessionExpirationUpdate(const std::string& session_id, | 126 void OnSessionExpirationUpdate(const std::string& session_id, |
| 126 const base::Time& new_expiry_time); | 127 const base::Time& new_expiry_time); |
| 127 void OnSessionClosed(const std::string& session_id); | 128 void OnSessionClosed(const std::string& session_id); |
| 128 void OnLegacySessionError(const std::string& session_id, | 129 void OnLegacySessionError(const std::string& session_id, |
| 129 MediaKeys::Exception exception_code, | 130 MediaKeys::Exception exception_code, |
| 130 uint32_t system_code, | 131 uint32_t system_code, |
| 131 const std::string& error_message); | 132 const std::string& error_message); |
| 132 | 133 |
| 133 // Helper function of the callbacks. | 134 // Helper function of the callbacks. |
| 134 WebContentDecryptionModuleSessionImpl* GetSession( | 135 WebContentDecryptionModuleSessionImpl* GetSession( |
| 135 const std::string& session_id); | 136 const std::string& session_id); |
| 136 | 137 |
| 138 void ReportCdmCreationTimeUMA(base::TimeDelta cdm_creation_time); | |
|
ddorwin
2015/07/20 21:35:21
static? At least const?
ddorwin
2015/07/20 21:35:21
nit: "Time" makes it sound like, for example, the
xhwang
2015/07/20 22:11:57
Can't be static since we need GetKeySystemUMAPrefi
xhwang
2015/07/20 22:11:57
See the reply about the UMA naming.
| |
| 139 | |
| 137 scoped_ptr<MediaKeys> cdm_; | 140 scoped_ptr<MediaKeys> cdm_; |
| 138 | 141 |
| 139 SessionMap sessions_; | 142 SessionMap sessions_; |
| 140 | 143 |
| 141 std::string key_system_; | 144 std::string key_system_; |
| 142 std::string key_system_uma_prefix_; | 145 std::string key_system_uma_prefix_; |
| 143 | 146 |
| 147 // A unique ID to trace CdmSessionAdapter::CreateCdm() call and the matching | |
| 148 // OnCdmCreated() call. | |
| 149 uint32 trace_id_; | |
| 150 | |
| 144 // NOTE: Weak pointers must be invalidated before all other member variables. | 151 // NOTE: Weak pointers must be invalidated before all other member variables. |
| 145 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; | 152 base::WeakPtrFactory<CdmSessionAdapter> weak_ptr_factory_; |
| 146 | 153 |
| 147 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); | 154 DISALLOW_COPY_AND_ASSIGN(CdmSessionAdapter); |
| 148 }; | 155 }; |
| 149 | 156 |
| 150 } // namespace media | 157 } // namespace media |
| 151 | 158 |
| 152 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ | 159 #endif // MEDIA_BLINK_CDM_SESSION_ADAPTER_H_ |
| OLD | NEW |