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

Side by Side Diff: content/renderer/media/crypto/proxy_media_keys.cc

Issue 1187603003: media: Move CdmInitializedPromise to media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « content/renderer/media/crypto/ppapi_decryptor.cc ('k') | media/base/BUILD.gn » ('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 #include "content/renderer/media/crypto/proxy_media_keys.h" 5 #include "content/renderer/media/crypto/proxy_media_keys.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/stl_util.h" 11 #include "base/stl_util.h"
12 #include "content/renderer/media/crypto/cdm_initialized_promise.h"
13 #include "content/renderer/media/crypto/renderer_cdm_manager.h" 12 #include "content/renderer/media/crypto/renderer_cdm_manager.h"
13 #include "media/base/cdm_initialized_promise.h"
14 #include "media/base/cdm_key_information.h" 14 #include "media/base/cdm_key_information.h"
15 #include "media/base/cdm_promise.h" 15 #include "media/base/cdm_promise.h"
16 #include "media/base/key_systems.h" 16 #include "media/base/key_systems.h"
17 17
18 namespace content { 18 namespace content {
19 19
20 void ProxyMediaKeys::Create( 20 void ProxyMediaKeys::Create(
21 const std::string& key_system, 21 const std::string& key_system,
22 const GURL& security_origin, 22 const GURL& security_origin,
23 bool use_hw_secure_codecs, 23 bool use_hw_secure_codecs,
24 RendererCdmManager* manager, 24 RendererCdmManager* manager,
25 const media::SessionMessageCB& session_message_cb, 25 const media::SessionMessageCB& session_message_cb,
26 const media::SessionClosedCB& session_closed_cb, 26 const media::SessionClosedCB& session_closed_cb,
27 const media::LegacySessionErrorCB& legacy_session_error_cb, 27 const media::LegacySessionErrorCB& legacy_session_error_cb,
28 const media::SessionKeysChangeCB& session_keys_change_cb, 28 const media::SessionKeysChangeCB& session_keys_change_cb,
29 const media::SessionExpirationUpdateCB& session_expiration_update_cb, 29 const media::SessionExpirationUpdateCB& session_expiration_update_cb,
30 const media::CdmCreatedCB& cdm_created_cb) { 30 const media::CdmCreatedCB& cdm_created_cb) {
31 DCHECK(manager); 31 DCHECK(manager);
32 scoped_ptr<ProxyMediaKeys> proxy_media_keys(new ProxyMediaKeys( 32 scoped_ptr<ProxyMediaKeys> proxy_media_keys(new ProxyMediaKeys(
33 manager, session_message_cb, session_closed_cb, legacy_session_error_cb, 33 manager, session_message_cb, session_closed_cb, legacy_session_error_cb,
34 session_keys_change_cb, session_expiration_update_cb)); 34 session_keys_change_cb, session_expiration_update_cb));
35 35
36 // ProxyMediaKeys ownership passed to the promise, but keep a copy in order 36 // ProxyMediaKeys ownership passed to the promise, but keep a copy in order
37 // to call InitializeCdm(). 37 // to call InitializeCdm().
38 ProxyMediaKeys* proxy_media_keys_copy = proxy_media_keys.get(); 38 ProxyMediaKeys* proxy_media_keys_copy = proxy_media_keys.get();
39 scoped_ptr<CdmInitializedPromise> promise( 39 scoped_ptr<media::CdmInitializedPromise> promise(
40 new CdmInitializedPromise(cdm_created_cb, proxy_media_keys.Pass())); 40 new media::CdmInitializedPromise(cdm_created_cb,
41 proxy_media_keys.Pass()));
41 proxy_media_keys_copy->InitializeCdm(key_system, security_origin, 42 proxy_media_keys_copy->InitializeCdm(key_system, security_origin,
42 use_hw_secure_codecs, promise.Pass()); 43 use_hw_secure_codecs, promise.Pass());
43 } 44 }
44 45
45 ProxyMediaKeys::~ProxyMediaKeys() { 46 ProxyMediaKeys::~ProxyMediaKeys() {
46 manager_->DestroyCdm(cdm_id_); 47 manager_->DestroyCdm(cdm_id_);
47 manager_->UnregisterMediaKeys(cdm_id_); 48 manager_->UnregisterMediaKeys(cdm_id_);
48 cdm_promise_adapter_.Clear(); 49 cdm_promise_adapter_.Clear();
49 } 50 }
50 51
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 const std::string& key_system, 199 const std::string& key_system,
199 const GURL& security_origin, 200 const GURL& security_origin,
200 bool use_hw_secure_codecs, 201 bool use_hw_secure_codecs,
201 scoped_ptr<media::SimpleCdmPromise> promise) { 202 scoped_ptr<media::SimpleCdmPromise> promise) {
202 uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass()); 203 uint32_t promise_id = cdm_promise_adapter_.SavePromise(promise.Pass());
203 manager_->InitializeCdm(cdm_id_, promise_id, this, key_system, 204 manager_->InitializeCdm(cdm_id_, promise_id, this, key_system,
204 security_origin, use_hw_secure_codecs); 205 security_origin, use_hw_secure_codecs);
205 } 206 }
206 207
207 } // namespace content 208 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/ppapi_decryptor.cc ('k') | media/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698