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

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

Issue 657763002: Use scoped_ptr::Pass instead of scoped_ptr::PassAs<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "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"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 DLOG(ERROR) << "Unsupported EME CreateSession content type of " 77 DLOG(ERROR) << "Unsupported EME CreateSession content type of "
78 << init_data_type; 78 << init_data_type;
79 promise->reject( 79 promise->reject(
80 NOT_SUPPORTED_ERROR, 80 NOT_SUPPORTED_ERROR,
81 0, 81 0,
82 "Unsupported EME CreateSession init data type of " + init_data_type); 82 "Unsupported EME CreateSession init data type of " + init_data_type);
83 return; 83 return;
84 } 84 }
85 85
86 uint32 session_id = CreateSessionId(); 86 uint32 session_id = CreateSessionId();
87 SavePromise(session_id, promise.PassAs<media::CdmPromise>()); 87 SavePromise(session_id, promise.Pass());
88 manager_->CreateSession( 88 manager_->CreateSession(
89 cdm_id_, 89 cdm_id_,
90 session_id, 90 session_id,
91 create_session_content_type, 91 create_session_content_type,
92 std::vector<uint8>(init_data, init_data + init_data_length)); 92 std::vector<uint8>(init_data, init_data + init_data_length));
93 } 93 }
94 94
95 void ProxyMediaKeys::LoadSession( 95 void ProxyMediaKeys::LoadSession(
96 const std::string& web_session_id, 96 const std::string& web_session_id,
97 scoped_ptr<media::NewSessionCdmPromise> promise) { 97 scoped_ptr<media::NewSessionCdmPromise> promise) {
98 // TODO(xhwang): Check key system and platform support for LoadSession in 98 // TODO(xhwang): Check key system and platform support for LoadSession in
99 // blink and add NOTREACHED() here. 99 // blink and add NOTREACHED() here.
100 DLOG(ERROR) << "ProxyMediaKeys doesn't support session loading."; 100 DLOG(ERROR) << "ProxyMediaKeys doesn't support session loading.";
101 promise->reject(NOT_SUPPORTED_ERROR, 0, "LoadSession() is not supported."); 101 promise->reject(NOT_SUPPORTED_ERROR, 0, "LoadSession() is not supported.");
102 } 102 }
103 103
104 void ProxyMediaKeys::UpdateSession( 104 void ProxyMediaKeys::UpdateSession(
105 const std::string& web_session_id, 105 const std::string& web_session_id,
106 const uint8* response, 106 const uint8* response,
107 int response_length, 107 int response_length,
108 scoped_ptr<media::SimpleCdmPromise> promise) { 108 scoped_ptr<media::SimpleCdmPromise> promise) {
109 uint32 session_id = LookupSessionId(web_session_id); 109 uint32 session_id = LookupSessionId(web_session_id);
110 if (!session_id) { 110 if (!session_id) {
111 promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist."); 111 promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist.");
112 return; 112 return;
113 } 113 }
114 114
115 SavePromise(session_id, promise.PassAs<media::CdmPromise>()); 115 SavePromise(session_id, promise.Pass());
116 manager_->UpdateSession( 116 manager_->UpdateSession(
117 cdm_id_, 117 cdm_id_,
118 session_id, 118 session_id,
119 std::vector<uint8>(response, response + response_length)); 119 std::vector<uint8>(response, response + response_length));
120 } 120 }
121 121
122 void ProxyMediaKeys::CloseSession(const std::string& web_session_id, 122 void ProxyMediaKeys::CloseSession(const std::string& web_session_id,
123 scoped_ptr<media::SimpleCdmPromise> promise) { 123 scoped_ptr<media::SimpleCdmPromise> promise) {
124 uint32 session_id = LookupSessionId(web_session_id); 124 uint32 session_id = LookupSessionId(web_session_id);
125 if (!session_id) { 125 if (!session_id) {
126 promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist."); 126 promise->reject(INVALID_ACCESS_ERROR, 0, "Session does not exist.");
127 return; 127 return;
128 } 128 }
129 129
130 SavePromise(session_id, promise.PassAs<media::CdmPromise>()); 130 SavePromise(session_id, promise.Pass());
131 manager_->ReleaseSession(cdm_id_, session_id); 131 manager_->ReleaseSession(cdm_id_, session_id);
132 } 132 }
133 133
134 void ProxyMediaKeys::RemoveSession( 134 void ProxyMediaKeys::RemoveSession(
135 const std::string& web_session_id, 135 const std::string& web_session_id,
136 scoped_ptr<media::SimpleCdmPromise> promise) { 136 scoped_ptr<media::SimpleCdmPromise> promise) {
137 promise->reject(NOT_SUPPORTED_ERROR, 0, "Not yet implemented."); 137 promise->reject(NOT_SUPPORTED_ERROR, 0, "Not yet implemented.");
138 } 138 }
139 139
140 void ProxyMediaKeys::GetUsableKeyIds(const std::string& web_session_id, 140 void ProxyMediaKeys::GetUsableKeyIds(const std::string& web_session_id,
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
286 286
287 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) { 287 scoped_ptr<media::CdmPromise> ProxyMediaKeys::TakePromise(uint32_t session_id) {
288 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id); 288 PromiseMap::iterator it = session_id_to_promise_map_.find(session_id);
289 // May not be a promise associated with this session for asynchronous events. 289 // May not be a promise associated with this session for asynchronous events.
290 if (it == session_id_to_promise_map_.end()) 290 if (it == session_id_to_promise_map_.end())
291 return scoped_ptr<media::CdmPromise>(); 291 return scoped_ptr<media::CdmPromise>();
292 return session_id_to_promise_map_.take_and_erase(it); 292 return session_id_to_promise_map_.take_and_erase(it);
293 } 293 }
294 294
295 } // namespace content 295 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/crypto/ppapi_decryptor.cc ('k') | content/renderer/pepper/content_decryptor_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698