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

Side by Side Diff: ppapi/proxy/ppb_instance_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/ppb_instance_proxy.h ('k') | ppapi/proxy/ppp_content_decryptor_private_proxy.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/ppb_instance_proxy.h" 5 #include "ppapi/proxy/ppb_instance_proxy.h"
6 6
7 #include "base/memory/ref_counted.h" 7 #include "base/memory/ref_counted.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ppapi/c/pp_errors.h" 9 #include "ppapi/c/pp_errors.h"
10 #include "ppapi/c/pp_time.h" 10 #include "ppapi/c/pp_time.h"
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument, 166 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_ResolveRelativeToDocument,
167 OnHostMsgResolveRelativeToDocument) 167 OnHostMsgResolveRelativeToDocument)
168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest, 168 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanRequest,
169 OnHostMsgDocumentCanRequest) 169 OnHostMsgDocumentCanRequest)
170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument, 170 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DocumentCanAccessDocument,
171 OnHostMsgDocumentCanAccessDocument) 171 OnHostMsgDocumentCanAccessDocument)
172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL, 172 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginInstanceURL,
173 OnHostMsgGetPluginInstanceURL) 173 OnHostMsgGetPluginInstanceURL)
174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL, 174 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_GetPluginReferrerURL,
175 OnHostMsgGetPluginReferrerURL) 175 OnHostMsgGetPluginReferrerURL)
176 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionCreated, 176 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolved,
177 OnHostMsgSessionCreated) 177 OnHostMsgPromiseResolved)
178 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseResolvedWithSession,
179 OnHostMsgPromiseResolvedWithSession)
180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_PromiseRejected,
181 OnHostMsgPromiseRejected)
178 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage, 182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionMessage,
179 OnHostMsgSessionMessage) 183 OnHostMsgSessionMessage)
180 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady, 184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionReady,
181 OnHostMsgSessionReady) 185 OnHostMsgSessionReady)
182 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed, 186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionClosed,
183 OnHostMsgSessionClosed) 187 OnHostMsgSessionClosed)
184 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionError, 188 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_SessionError,
185 OnHostMsgSessionError) 189 OnHostMsgSessionError)
186 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock, 190 IPC_MESSAGE_HANDLER(PpapiHostMsg_PPBInstance_DeliverBlock,
187 OnHostMsgDeliverBlock) 191 OnHostMsgDeliverBlock)
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after
559 PP_Instance instance, 563 PP_Instance instance,
560 PP_URLComponents_Dev* components) { 564 PP_URLComponents_Dev* components) {
561 ReceiveSerializedVarReturnValue result; 565 ReceiveSerializedVarReturnValue result;
562 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginReferrerURL( 566 dispatcher()->Send(new PpapiHostMsg_PPBInstance_GetPluginReferrerURL(
563 API_ID_PPB_INSTANCE, instance, &result)); 567 API_ID_PPB_INSTANCE, instance, &result));
564 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL( 568 return PPB_URLUtil_Shared::ConvertComponentsAndReturnURL(
565 result.Return(dispatcher()), 569 result.Return(dispatcher()),
566 components); 570 components);
567 } 571 }
568 572
569 void PPB_Instance_Proxy::SessionCreated(PP_Instance instance, 573 void PPB_Instance_Proxy::PromiseResolved(PP_Instance instance,
570 uint32_t session_id, 574 uint32 promise_id) {
571 PP_Var web_session_id) { 575 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseResolved(
572 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionCreated( 576 API_ID_PPB_INSTANCE, instance, promise_id));
577 }
578
579 void PPB_Instance_Proxy::PromiseResolvedWithSession(PP_Instance instance,
580 uint32 promise_id,
581 PP_Var web_session_id_var) {
582 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseResolvedWithSession(
573 API_ID_PPB_INSTANCE, 583 API_ID_PPB_INSTANCE,
574 instance, 584 instance,
575 session_id, 585 promise_id,
576 SerializedVarSendInput(dispatcher(), web_session_id))); 586 SerializedVarSendInput(dispatcher(), web_session_id_var)));
587 }
588
589 void PPB_Instance_Proxy::PromiseRejected(PP_Instance instance,
590 uint32 promise_id,
591 PP_CdmExceptionCode exception_code,
592 uint32 system_code,
593 PP_Var error_description_var) {
594 dispatcher()->Send(new PpapiHostMsg_PPBInstance_PromiseRejected(
595 API_ID_PPB_INSTANCE,
596 instance,
597 promise_id,
598 exception_code,
599 system_code,
600 SerializedVarSendInput(dispatcher(), error_description_var)));
577 } 601 }
578 602
579 void PPB_Instance_Proxy::SessionMessage(PP_Instance instance, 603 void PPB_Instance_Proxy::SessionMessage(PP_Instance instance,
580 uint32_t session_id, 604 PP_Var web_session_id_var,
581 PP_Var message, 605 PP_Var message_var,
582 PP_Var destination_url) { 606 PP_Var destination_url_var) {
583 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage( 607 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionMessage(
584 API_ID_PPB_INSTANCE, 608 API_ID_PPB_INSTANCE,
585 instance, 609 instance,
586 session_id, 610 SerializedVarSendInput(dispatcher(), web_session_id_var),
587 SerializedVarSendInput(dispatcher(), message), 611 SerializedVarSendInput(dispatcher(), message_var),
588 SerializedVarSendInput(dispatcher(), destination_url))); 612 SerializedVarSendInput(dispatcher(), destination_url_var)));
589 } 613 }
590 614
591 void PPB_Instance_Proxy::SessionReady(PP_Instance instance, 615 void PPB_Instance_Proxy::SessionReady(PP_Instance instance,
592 uint32_t session_id) { 616 PP_Var web_session_id_var) {
593 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady( 617 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionReady(
594 API_ID_PPB_INSTANCE, instance, session_id)); 618 API_ID_PPB_INSTANCE,
619 instance,
620 SerializedVarSendInput(dispatcher(), web_session_id_var)));
595 } 621 }
596 622
597 void PPB_Instance_Proxy::SessionClosed(PP_Instance instance, 623 void PPB_Instance_Proxy::SessionClosed(PP_Instance instance,
598 uint32_t session_id) { 624 PP_Var web_session_id_var) {
599 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed( 625 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionClosed(
600 API_ID_PPB_INSTANCE, instance, session_id)); 626 API_ID_PPB_INSTANCE,
627 instance,
628 SerializedVarSendInput(dispatcher(), web_session_id_var)));
601 } 629 }
602 630
603 void PPB_Instance_Proxy::SessionError(PP_Instance instance, 631 void PPB_Instance_Proxy::SessionError(PP_Instance instance,
604 uint32_t session_id, 632 PP_Var web_session_id_var,
605 int32_t media_error, 633 PP_CdmExceptionCode exception_code,
606 uint32_t system_code) { 634 uint32 system_code,
635 PP_Var error_description_var) {
607 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError( 636 dispatcher()->Send(new PpapiHostMsg_PPBInstance_SessionError(
608 API_ID_PPB_INSTANCE, instance, session_id, media_error, system_code)); 637 API_ID_PPB_INSTANCE,
638 instance,
639 SerializedVarSendInput(dispatcher(), web_session_id_var),
640 exception_code,
641 system_code,
642 SerializedVarSendInput(dispatcher(), error_description_var)));
609 } 643 }
610 644
611 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance, 645 void PPB_Instance_Proxy::DeliverBlock(PP_Instance instance,
612 PP_Resource decrypted_block, 646 PP_Resource decrypted_block,
613 const PP_DecryptedBlockInfo* block_info) { 647 const PP_DecryptedBlockInfo* block_info) {
614 PP_Resource decrypted_block_host_resource = 0; 648 PP_Resource decrypted_block_host_resource = 0;
615 649
616 if (decrypted_block) { 650 if (decrypted_block) {
617 Resource* object = 651 Resource* object =
618 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block); 652 PpapiGlobals::Get()->GetResourceTracker()->GetResource(decrypted_block);
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
1129 SerializedVarReturnValue result) { 1163 SerializedVarReturnValue result) {
1130 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV)) 1164 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
1131 return; 1165 return;
1132 EnterInstanceNoLock enter(instance); 1166 EnterInstanceNoLock enter(instance);
1133 if (enter.succeeded()) { 1167 if (enter.succeeded()) {
1134 result.Return(dispatcher(), 1168 result.Return(dispatcher(),
1135 enter.functions()->GetPluginReferrerURL(instance, NULL)); 1169 enter.functions()->GetPluginReferrerURL(instance, NULL));
1136 } 1170 }
1137 } 1171 }
1138 1172
1139 void PPB_Instance_Proxy::OnHostMsgSessionCreated( 1173 void PPB_Instance_Proxy::OnHostMsgPromiseResolved(PP_Instance instance,
1174 uint32_t promise_id) {
1175 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1176 return;
1177 EnterInstanceNoLock enter(instance);
1178 if (enter.succeeded()) {
1179 enter.functions()->PromiseResolved(instance, promise_id);
1180 }
1181 }
1182
1183 void PPB_Instance_Proxy::OnHostMsgPromiseResolvedWithSession(
1140 PP_Instance instance, 1184 PP_Instance instance,
1141 uint32_t session_id, 1185 uint32_t promise_id,
1142 SerializedVarReceiveInput web_session_id) { 1186 SerializedVarReceiveInput web_session_id) {
1143 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1187 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1144 return; 1188 return;
1145 EnterInstanceNoLock enter(instance); 1189 EnterInstanceNoLock enter(instance);
1146 if (enter.succeeded()) { 1190 if (enter.succeeded()) {
1147 enter.functions()->SessionCreated( 1191 enter.functions()->PromiseResolvedWithSession(
1148 instance, session_id, web_session_id.Get(dispatcher())); 1192 instance, promise_id, web_session_id.Get(dispatcher()));
1193 }
1194 }
1195
1196 void PPB_Instance_Proxy::OnHostMsgPromiseRejected(
1197 PP_Instance instance,
1198 uint32_t promise_id,
1199 PP_CdmExceptionCode exception_code,
1200 uint32_t system_code,
1201 SerializedVarReceiveInput error_description) {
1202 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1203 return;
1204 EnterInstanceNoLock enter(instance);
1205 if (enter.succeeded()) {
1206 enter.functions()->PromiseRejected(instance,
1207 promise_id,
1208 exception_code,
1209 system_code,
1210 error_description.Get(dispatcher()));
1149 } 1211 }
1150 } 1212 }
1151 1213
1152 void PPB_Instance_Proxy::OnHostMsgSessionMessage( 1214 void PPB_Instance_Proxy::OnHostMsgSessionMessage(
1153 PP_Instance instance, 1215 PP_Instance instance,
1154 uint32_t session_id, 1216 SerializedVarReceiveInput web_session_id,
1155 SerializedVarReceiveInput message, 1217 SerializedVarReceiveInput message,
1156 SerializedVarReceiveInput destination_url) { 1218 SerializedVarReceiveInput destination_url) {
1157 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1219 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1158 return; 1220 return;
1159 EnterInstanceNoLock enter(instance); 1221 EnterInstanceNoLock enter(instance);
1160 if (enter.succeeded()) { 1222 if (enter.succeeded()) {
1161 enter.functions()->SessionMessage(instance, 1223 enter.functions()->SessionMessage(instance,
1162 session_id, 1224 web_session_id.Get(dispatcher()),
1163 message.Get(dispatcher()), 1225 message.Get(dispatcher()),
1164 destination_url.Get(dispatcher())); 1226 destination_url.Get(dispatcher()));
1165 } 1227 }
1166 } 1228 }
1167 1229
1168 void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance, 1230 void PPB_Instance_Proxy::OnHostMsgSessionReady(
1169 uint32_t session_id) { 1231 PP_Instance instance,
1232 SerializedVarReceiveInput web_session_id) {
1170 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1233 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1171 return; 1234 return;
1172 EnterInstanceNoLock enter(instance); 1235 EnterInstanceNoLock enter(instance);
1173 if (enter.succeeded()) { 1236 if (enter.succeeded()) {
1174 enter.functions()->SessionReady(instance, session_id); 1237 enter.functions()->SessionReady(instance, web_session_id.Get(dispatcher()));
1175 } 1238 }
1176 } 1239 }
1177 1240
1178 void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance, 1241 void PPB_Instance_Proxy::OnHostMsgSessionClosed(
1179 uint32_t session_id) { 1242 PP_Instance instance,
1243 SerializedVarReceiveInput web_session_id) {
1180 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1244 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1181 return; 1245 return;
1182 EnterInstanceNoLock enter(instance); 1246 EnterInstanceNoLock enter(instance);
1183 if (enter.succeeded()) { 1247 if (enter.succeeded()) {
1184 enter.functions()->SessionClosed(instance, session_id); 1248 enter.functions()->SessionClosed(instance,
1249 web_session_id.Get(dispatcher()));
1185 } 1250 }
1186 } 1251 }
1187 1252
1188 void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, 1253 void PPB_Instance_Proxy::OnHostMsgSessionError(
1189 uint32_t session_id, 1254 PP_Instance instance,
1190 int32_t media_error, 1255 SerializedVarReceiveInput web_session_id,
1191 uint32_t system_code) { 1256 PP_CdmExceptionCode exception_code,
1257 uint32_t system_code,
1258 SerializedVarReceiveInput error_description) {
1192 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1259 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1193 return; 1260 return;
1194 EnterInstanceNoLock enter(instance); 1261 EnterInstanceNoLock enter(instance);
1195 if (enter.succeeded()) { 1262 if (enter.succeeded()) {
1196 enter.functions()->SessionError( 1263 enter.functions()->SessionError(instance,
1197 instance, session_id, media_error, system_code); 1264 web_session_id.Get(dispatcher()),
1265 exception_code,
1266 system_code,
1267 error_description.Get(dispatcher()));
1198 } 1268 }
1199 } 1269 }
1200 1270
1201 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( 1271 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(
1202 PP_Instance instance, 1272 PP_Instance instance,
1203 PP_Resource decrypted_block, 1273 PP_Resource decrypted_block,
1204 const std::string& serialized_block_info) { 1274 const std::string& serialized_block_info) {
1205 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1275 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1206 return; 1276 return;
1207 PP_DecryptedBlockInfo block_info; 1277 PP_DecryptedBlockInfo block_info;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1361 PP_Instance instance) { 1431 PP_Instance instance) {
1362 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1432 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1363 GetInstanceData(instance); 1433 GetInstanceData(instance);
1364 if (!data) 1434 if (!data)
1365 return; // Instance was probably deleted. 1435 return; // Instance was probably deleted.
1366 data->should_do_request_surrounding_text = false; 1436 data->should_do_request_surrounding_text = false;
1367 } 1437 }
1368 1438
1369 } // namespace proxy 1439 } // namespace proxy
1370 } // namespace ppapi 1440 } // namespace ppapi
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_instance_proxy.h ('k') | ppapi/proxy/ppp_content_decryptor_private_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698