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 #include "content/renderer/media/cdm/renderer_cdm_manager.h" | 5 #include "content/renderer/media/cdm/renderer_cdm_manager.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 const std::string& error_message) { | 226 const std::string& error_message) { |
227 ProxyMediaKeys* media_keys = GetMediaKeys(cdm_id); | 227 ProxyMediaKeys* media_keys = GetMediaKeys(cdm_id); |
228 if (media_keys) | 228 if (media_keys) |
229 media_keys->OnPromiseRejected(promise_id, exception, system_code, | 229 media_keys->OnPromiseRejected(promise_id, exception, system_code, |
230 error_message); | 230 error_message); |
231 } | 231 } |
232 | 232 |
233 int RendererCdmManager::RegisterMediaKeys(ProxyMediaKeys* media_keys) { | 233 int RendererCdmManager::RegisterMediaKeys(ProxyMediaKeys* media_keys) { |
234 int cdm_id = next_cdm_id_++; | 234 int cdm_id = next_cdm_id_++; |
235 DCHECK_NE(cdm_id, media::CdmContext::kInvalidCdmId); | 235 DCHECK_NE(cdm_id, media::CdmContext::kInvalidCdmId); |
236 DCHECK(!ContainsKey(proxy_media_keys_map_, cdm_id)); | 236 DCHECK(!base::ContainsKey(proxy_media_keys_map_, cdm_id)); |
237 proxy_media_keys_map_[cdm_id] = media_keys; | 237 proxy_media_keys_map_[cdm_id] = media_keys; |
238 return cdm_id; | 238 return cdm_id; |
239 } | 239 } |
240 | 240 |
241 void RendererCdmManager::UnregisterMediaKeys(int cdm_id) { | 241 void RendererCdmManager::UnregisterMediaKeys(int cdm_id) { |
242 DCHECK(ContainsKey(proxy_media_keys_map_, cdm_id)); | 242 DCHECK(base::ContainsKey(proxy_media_keys_map_, cdm_id)); |
243 proxy_media_keys_map_.erase(cdm_id); | 243 proxy_media_keys_map_.erase(cdm_id); |
244 } | 244 } |
245 | 245 |
246 ProxyMediaKeys* RendererCdmManager::GetMediaKeys(int cdm_id) { | 246 ProxyMediaKeys* RendererCdmManager::GetMediaKeys(int cdm_id) { |
247 std::map<int, ProxyMediaKeys*>::iterator iter = | 247 std::map<int, ProxyMediaKeys*>::iterator iter = |
248 proxy_media_keys_map_.find(cdm_id); | 248 proxy_media_keys_map_.find(cdm_id); |
249 return (iter != proxy_media_keys_map_.end()) ? iter->second : NULL; | 249 return (iter != proxy_media_keys_map_.end()) ? iter->second : NULL; |
250 } | 250 } |
251 | 251 |
252 } // namespace content | 252 } // namespace content |
OLD | NEW |