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

Side by Side Diff: media/blink/cdm_session_adapter.cc

Issue 1131753003: Plumb |use_secure_codecs| through to BrowserCdmFactoryAndroid. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months 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 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 "media/blink/cdm_session_adapter.h" 5 #include "media/blink/cdm_session_adapter.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 12 matching lines...) Expand all
23 const char kDot[] = "."; 23 const char kDot[] = ".";
24 24
25 CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) { 25 CdmSessionAdapter::CdmSessionAdapter() : weak_ptr_factory_(this) {
26 } 26 }
27 27
28 CdmSessionAdapter::~CdmSessionAdapter() {} 28 CdmSessionAdapter::~CdmSessionAdapter() {}
29 29
30 void CdmSessionAdapter::CreateCdm( 30 void CdmSessionAdapter::CreateCdm(
31 CdmFactory* cdm_factory, 31 CdmFactory* cdm_factory,
32 const std::string& key_system, 32 const std::string& key_system,
33 bool allow_distinctive_identifier,
34 bool allow_persistent_state,
35 const GURL& security_origin, 33 const GURL& security_origin,
34 const CdmConfig& cdm_config,
36 blink::WebContentDecryptionModuleResult result) { 35 blink::WebContentDecryptionModuleResult result) {
37 // Note: WebContentDecryptionModuleImpl::Create() calls this method without 36 // Note: WebContentDecryptionModuleImpl::Create() calls this method without
38 // holding a reference to the CdmSessionAdapter. Bind OnCdmCreated() with 37 // holding a reference to the CdmSessionAdapter. Bind OnCdmCreated() with
39 // |this| instead of |weak_this| to prevent |this| from being destructed. 38 // |this| instead of |weak_this| to prevent |this| from being destructed.
40 base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr(); 39 base::WeakPtr<CdmSessionAdapter> weak_this = weak_ptr_factory_.GetWeakPtr();
41 cdm_factory->Create( 40 cdm_factory->Create(
42 key_system, allow_distinctive_identifier, allow_persistent_state, 41 key_system, security_origin, cdm_config,
ddorwin 2015/05/13 06:03:21 One great thing about the config is that the bools
sandersd (OOO until July 31) 2015/05/14 00:06:57 Acknowledged.
43 security_origin,
44 base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this), 42 base::Bind(&CdmSessionAdapter::OnSessionMessage, weak_this),
45 base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this), 43 base::Bind(&CdmSessionAdapter::OnSessionClosed, weak_this),
46 base::Bind(&CdmSessionAdapter::OnLegacySessionError, weak_this), 44 base::Bind(&CdmSessionAdapter::OnLegacySessionError, weak_this),
47 base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this), 45 base::Bind(&CdmSessionAdapter::OnSessionKeysChange, weak_this),
48 base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this), 46 base::Bind(&CdmSessionAdapter::OnSessionExpirationUpdate, weak_this),
49 base::Bind(&CdmSessionAdapter::OnCdmCreated, this, key_system, result)); 47 base::Bind(&CdmSessionAdapter::OnCdmCreated, this, key_system, result));
50 } 48 }
51 49
52 void CdmSessionAdapter::SetServerCertificate( 50 void CdmSessionAdapter::SetServerCertificate(
53 const std::vector<uint8_t>& certificate, 51 const std::vector<uint8_t>& certificate,
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession( 191 WebContentDecryptionModuleSessionImpl* CdmSessionAdapter::GetSession(
194 const std::string& session_id) { 192 const std::string& session_id) {
195 // Since session objects may get garbage collected, it is possible that there 193 // Since session objects may get garbage collected, it is possible that there
196 // are events coming back from the CDM and the session has been unregistered. 194 // are events coming back from the CDM and the session has been unregistered.
197 // We can not tell if the CDM is firing events at sessions that never existed. 195 // We can not tell if the CDM is firing events at sessions that never existed.
198 SessionMap::iterator session = sessions_.find(session_id); 196 SessionMap::iterator session = sessions_.find(session_id);
199 return (session != sessions_.end()) ? session->second.get() : NULL; 197 return (session != sessions_.end()) ? session->second.get() : NULL;
200 } 198 }
201 199
202 } // namespace media 200 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698