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

Side by Side Diff: ppapi/proxy/ppp_content_decryptor_private_proxy.cc

Issue 265993002: Add Promises for EME (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more trybot issue Created 6 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 | « ppapi/proxy/ppp_content_decryptor_private_proxy.h ('k') | ppapi/thunk/interfaces_ppb_private.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ppapi/proxy/ppp_content_decryptor_private_proxy.h" 5 #include "ppapi/proxy/ppp_content_decryptor_private_proxy.h"
6 6
7 #include "base/files/file.h" 7 #include "base/files/file.h"
8 #include "ppapi/c/pp_bool.h" 8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/ppb_core.h" 9 #include "ppapi/c/ppb_core.h"
10 #include "ppapi/proxy/content_decryptor_private_serializer.h" 10 #include "ppapi/proxy/content_decryptor_private_serializer.h"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 } 118 }
119 119
120 dispatcher->Send( 120 dispatcher->Send(
121 new PpapiMsg_PPPContentDecryptor_Initialize( 121 new PpapiMsg_PPPContentDecryptor_Initialize(
122 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, 122 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
123 instance, 123 instance,
124 SerializedVarSendInput(dispatcher, key_system))); 124 SerializedVarSendInput(dispatcher, key_system)));
125 } 125 }
126 126
127 void CreateSession(PP_Instance instance, 127 void CreateSession(PP_Instance instance,
128 uint32_t session_id, 128 uint32_t promise_id,
129 PP_Var type, 129 PP_Var init_data_type,
130 PP_Var init_data) { 130 PP_Var init_data,
131 PP_SessionType session_type) {
131 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 132 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
132 if (!dispatcher) { 133 if (!dispatcher) {
133 NOTREACHED(); 134 NOTREACHED();
134 return; 135 return;
135 } 136 }
136 137
137 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession( 138 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_CreateSession(
138 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, 139 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
139 instance, 140 instance,
140 session_id, 141 promise_id,
141 SerializedVarSendInput(dispatcher, type), 142 SerializedVarSendInput(dispatcher, init_data_type),
142 SerializedVarSendInput(dispatcher, init_data))); 143 SerializedVarSendInput(dispatcher, init_data),
144 session_type));
143 } 145 }
144 146
145 void LoadSession(PP_Instance instance, 147 void LoadSession(PP_Instance instance,
146 uint32_t session_id, 148 uint32_t promise_id,
147 PP_Var web_session_id) { 149 PP_Var web_session_id) {
148 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 150 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
149 if (!dispatcher) { 151 if (!dispatcher) {
150 NOTREACHED(); 152 NOTREACHED();
151 return; 153 return;
152 } 154 }
153 155
154 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_LoadSession( 156 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_LoadSession(
155 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, 157 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
156 instance, 158 instance,
157 session_id, 159 promise_id,
158 SerializedVarSendInput(dispatcher, web_session_id))); 160 SerializedVarSendInput(dispatcher, web_session_id)));
159 } 161 }
160 162
161 void UpdateSession(PP_Instance instance, uint32_t session_id, PP_Var response) { 163 void UpdateSession(PP_Instance instance,
164 uint32_t promise_id,
165 PP_Var web_session_id,
166 PP_Var response) {
162 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 167 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
163 if (!dispatcher) { 168 if (!dispatcher) {
164 NOTREACHED(); 169 NOTREACHED();
165 return; 170 return;
166 } 171 }
167 172
168 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession( 173 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_UpdateSession(
169 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, 174 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
170 instance, 175 instance,
171 session_id, 176 promise_id,
177 SerializedVarSendInput(dispatcher, web_session_id),
172 SerializedVarSendInput(dispatcher, response))); 178 SerializedVarSendInput(dispatcher, response)));
173 } 179 }
174 180
175 void ReleaseSession(PP_Instance instance, uint32_t session_id) { 181 void ReleaseSession(PP_Instance instance,
182 uint32_t promise_id,
183 PP_Var web_session_id) {
176 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 184 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
177 if (!dispatcher) { 185 if (!dispatcher) {
178 NOTREACHED(); 186 NOTREACHED();
179 return; 187 return;
180 } 188 }
181 189
182 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession( 190 dispatcher->Send(new PpapiMsg_PPPContentDecryptor_ReleaseSession(
183 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE, instance, session_id)); 191 API_ID_PPP_CONTENT_DECRYPTOR_PRIVATE,
192 instance,
193 promise_id,
194 SerializedVarSendInput(dispatcher, web_session_id)));
184 } 195 }
185 196
186 void Decrypt(PP_Instance instance, 197 void Decrypt(PP_Instance instance,
187 PP_Resource encrypted_block, 198 PP_Resource encrypted_block,
188 const PP_EncryptedBlockInfo* encrypted_block_info) { 199 const PP_EncryptedBlockInfo* encrypted_block_info) {
189 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); 200 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance);
190 if (!dispatcher) { 201 if (!dispatcher) {
191 NOTREACHED(); 202 NOTREACHED();
192 return; 203 return;
193 } 204 }
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 if (ppp_decryptor_impl_) { 459 if (ppp_decryptor_impl_) {
449 CallWhileUnlocked( 460 CallWhileUnlocked(
450 ppp_decryptor_impl_->Initialize, 461 ppp_decryptor_impl_->Initialize,
451 instance, 462 instance,
452 ExtractReceivedVarAndAddRef(dispatcher(), &key_system)); 463 ExtractReceivedVarAndAddRef(dispatcher(), &key_system));
453 } 464 }
454 } 465 }
455 466
456 void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession( 467 void PPP_ContentDecryptor_Private_Proxy::OnMsgCreateSession(
457 PP_Instance instance, 468 PP_Instance instance,
458 uint32_t session_id, 469 uint32_t promise_id,
459 SerializedVarReceiveInput type, 470 SerializedVarReceiveInput init_data_type,
460 SerializedVarReceiveInput init_data) { 471 SerializedVarReceiveInput init_data,
472 PP_SessionType session_type) {
461 if (ppp_decryptor_impl_) { 473 if (ppp_decryptor_impl_) {
462 CallWhileUnlocked(ppp_decryptor_impl_->CreateSession, 474 CallWhileUnlocked(
463 instance, 475 ppp_decryptor_impl_->CreateSession,
464 session_id, 476 instance,
465 ExtractReceivedVarAndAddRef(dispatcher(), &type), 477 promise_id,
466 ExtractReceivedVarAndAddRef(dispatcher(), &init_data)); 478 ExtractReceivedVarAndAddRef(dispatcher(), &init_data_type),
479 ExtractReceivedVarAndAddRef(dispatcher(), &init_data),
480 session_type);
467 } 481 }
468 } 482 }
469 483
470 void PPP_ContentDecryptor_Private_Proxy::OnMsgLoadSession( 484 void PPP_ContentDecryptor_Private_Proxy::OnMsgLoadSession(
471 PP_Instance instance, 485 PP_Instance instance,
472 uint32_t session_id, 486 uint32_t promise_id,
473 SerializedVarReceiveInput web_session_id) { 487 SerializedVarReceiveInput web_session_id) {
474 if (ppp_decryptor_impl_) { 488 if (ppp_decryptor_impl_) {
475 CallWhileUnlocked( 489 CallWhileUnlocked(
476 ppp_decryptor_impl_->LoadSession, 490 ppp_decryptor_impl_->LoadSession,
477 instance, 491 instance,
478 session_id, 492 promise_id,
479 ExtractReceivedVarAndAddRef(dispatcher(), &web_session_id)); 493 ExtractReceivedVarAndAddRef(dispatcher(), &web_session_id));
480 } 494 }
481 } 495 }
482 496
483 void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession( 497 void PPP_ContentDecryptor_Private_Proxy::OnMsgUpdateSession(
484 PP_Instance instance, 498 PP_Instance instance,
485 uint32_t session_id, 499 uint32_t promise_id,
500 SerializedVarReceiveInput web_session_id,
486 SerializedVarReceiveInput response) { 501 SerializedVarReceiveInput response) {
487 if (ppp_decryptor_impl_) { 502 if (ppp_decryptor_impl_) {
488 CallWhileUnlocked(ppp_decryptor_impl_->UpdateSession, 503 CallWhileUnlocked(
489 instance, 504 ppp_decryptor_impl_->UpdateSession,
490 session_id, 505 instance,
491 ExtractReceivedVarAndAddRef(dispatcher(), &response)); 506 promise_id,
507 ExtractReceivedVarAndAddRef(dispatcher(), &web_session_id),
508 ExtractReceivedVarAndAddRef(dispatcher(), &response));
492 } 509 }
493 } 510 }
494 511
495 void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession( 512 void PPP_ContentDecryptor_Private_Proxy::OnMsgReleaseSession(
496 PP_Instance instance, 513 PP_Instance instance,
497 uint32_t session_id) { 514 uint32_t promise_id,
515 SerializedVarReceiveInput web_session_id) {
498 if (ppp_decryptor_impl_) { 516 if (ppp_decryptor_impl_) {
499 CallWhileUnlocked(ppp_decryptor_impl_->ReleaseSession, 517 CallWhileUnlocked(
500 instance, 518 ppp_decryptor_impl_->ReleaseSession,
501 session_id); 519 instance,
520 promise_id,
521 ExtractReceivedVarAndAddRef(dispatcher(), &web_session_id));
502 } 522 }
503 } 523 }
504 524
505 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecrypt( 525 void PPP_ContentDecryptor_Private_Proxy::OnMsgDecrypt(
506 PP_Instance instance, 526 PP_Instance instance,
507 const PPPDecryptor_Buffer& encrypted_buffer, 527 const PPPDecryptor_Buffer& encrypted_buffer,
508 const std::string& serialized_block_info) { 528 const std::string& serialized_block_info) {
509 ScopedPPResource plugin_resource( 529 ScopedPPResource plugin_resource(
510 ScopedPPResource::PassRef(), 530 ScopedPPResource::PassRef(),
511 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource, 531 PPB_Buffer_Proxy::AddProxyResource(encrypted_buffer.resource,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 ppp_decryptor_impl_->DecryptAndDecode, 642 ppp_decryptor_impl_->DecryptAndDecode,
623 instance, 643 instance,
624 decoder_type, 644 decoder_type,
625 plugin_resource.get(), 645 plugin_resource.get(),
626 const_cast<const PP_EncryptedBlockInfo*>(&block_info)); 646 const_cast<const PP_EncryptedBlockInfo*>(&block_info));
627 } 647 }
628 } 648 }
629 649
630 } // namespace proxy 650 } // namespace proxy
631 } // namespace ppapi 651 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppp_content_decryptor_private_proxy.h ('k') | ppapi/thunk/interfaces_ppb_private.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698