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

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: Android changes 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
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_ExceptionCode 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_ExceptionCode 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 498 matching lines...) Expand 10 before | Expand all | Expand 10 after
1117 SerializedVarReturnValue result) { 1151 SerializedVarReturnValue result) {
1118 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV)) 1152 if (!dispatcher()->permissions().HasPermission(PERMISSION_DEV))
1119 return; 1153 return;
1120 EnterInstanceNoLock enter(instance); 1154 EnterInstanceNoLock enter(instance);
1121 if (enter.succeeded()) { 1155 if (enter.succeeded()) {
1122 result.Return(dispatcher(), 1156 result.Return(dispatcher(),
1123 enter.functions()->GetPluginReferrerURL(instance, NULL)); 1157 enter.functions()->GetPluginReferrerURL(instance, NULL));
1124 } 1158 }
1125 } 1159 }
1126 1160
1127 void PPB_Instance_Proxy::OnHostMsgSessionCreated( 1161 void PPB_Instance_Proxy::OnHostMsgPromiseResolved(PP_Instance instance,
1162 uint32_t promise_id) {
1163 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1164 return;
1165 EnterInstanceNoLock enter(instance);
1166 if (enter.succeeded()) {
1167 enter.functions()->PromiseResolved(instance, promise_id);
1168 }
1169 }
1170
1171 void PPB_Instance_Proxy::OnHostMsgPromiseResolvedWithSession(
1128 PP_Instance instance, 1172 PP_Instance instance,
1129 uint32_t session_id, 1173 uint32_t promise_id,
1130 SerializedVarReceiveInput web_session_id) { 1174 SerializedVarReceiveInput web_session_id) {
1131 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1175 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1132 return; 1176 return;
1133 EnterInstanceNoLock enter(instance); 1177 EnterInstanceNoLock enter(instance);
1134 if (enter.succeeded()) { 1178 if (enter.succeeded()) {
1135 enter.functions()->SessionCreated( 1179 enter.functions()->PromiseResolvedWithSession(
1136 instance, session_id, web_session_id.Get(dispatcher())); 1180 instance, promise_id, web_session_id.Get(dispatcher()));
1181 }
1182 }
1183
1184 void PPB_Instance_Proxy::OnHostMsgPromiseRejected(
1185 PP_Instance instance,
1186 uint32_t promise_id,
1187 PP_ExceptionCode exception_code,
1188 uint32_t system_code,
1189 SerializedVarReceiveInput error_description) {
1190 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1191 return;
1192 EnterInstanceNoLock enter(instance);
1193 if (enter.succeeded()) {
1194 enter.functions()->PromiseRejected(instance,
1195 promise_id,
1196 exception_code,
1197 system_code,
1198 error_description.Get(dispatcher()));
1137 } 1199 }
1138 } 1200 }
1139 1201
1140 void PPB_Instance_Proxy::OnHostMsgSessionMessage( 1202 void PPB_Instance_Proxy::OnHostMsgSessionMessage(
1141 PP_Instance instance, 1203 PP_Instance instance,
1142 uint32_t session_id, 1204 SerializedVarReceiveInput web_session_id,
1143 SerializedVarReceiveInput message, 1205 SerializedVarReceiveInput message,
1144 SerializedVarReceiveInput destination_url) { 1206 SerializedVarReceiveInput destination_url) {
1145 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1207 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1146 return; 1208 return;
1147 EnterInstanceNoLock enter(instance); 1209 EnterInstanceNoLock enter(instance);
1148 if (enter.succeeded()) { 1210 if (enter.succeeded()) {
1149 enter.functions()->SessionMessage(instance, 1211 enter.functions()->SessionMessage(instance,
1150 session_id, 1212 web_session_id.Get(dispatcher()),
1151 message.Get(dispatcher()), 1213 message.Get(dispatcher()),
1152 destination_url.Get(dispatcher())); 1214 destination_url.Get(dispatcher()));
1153 } 1215 }
1154 } 1216 }
1155 1217
1156 void PPB_Instance_Proxy::OnHostMsgSessionReady(PP_Instance instance, 1218 void PPB_Instance_Proxy::OnHostMsgSessionReady(
1157 uint32_t session_id) { 1219 PP_Instance instance,
1220 SerializedVarReceiveInput web_session_id) {
1158 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1221 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1159 return; 1222 return;
1160 EnterInstanceNoLock enter(instance); 1223 EnterInstanceNoLock enter(instance);
1161 if (enter.succeeded()) { 1224 if (enter.succeeded()) {
1162 enter.functions()->SessionReady(instance, session_id); 1225 enter.functions()->SessionReady(instance, web_session_id.Get(dispatcher()));
1163 } 1226 }
1164 } 1227 }
1165 1228
1166 void PPB_Instance_Proxy::OnHostMsgSessionClosed(PP_Instance instance, 1229 void PPB_Instance_Proxy::OnHostMsgSessionClosed(
1167 uint32_t session_id) { 1230 PP_Instance instance,
1231 SerializedVarReceiveInput web_session_id) {
1168 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1232 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1169 return; 1233 return;
1170 EnterInstanceNoLock enter(instance); 1234 EnterInstanceNoLock enter(instance);
1171 if (enter.succeeded()) { 1235 if (enter.succeeded()) {
1172 enter.functions()->SessionClosed(instance, session_id); 1236 enter.functions()->SessionClosed(instance,
1237 web_session_id.Get(dispatcher()));
1173 } 1238 }
1174 } 1239 }
1175 1240
1176 void PPB_Instance_Proxy::OnHostMsgSessionError(PP_Instance instance, 1241 void PPB_Instance_Proxy::OnHostMsgSessionError(
1177 uint32_t session_id, 1242 PP_Instance instance,
1178 int32_t media_error, 1243 SerializedVarReceiveInput web_session_id,
1179 uint32_t system_code) { 1244 PP_ExceptionCode exception_code,
1245 uint32_t system_code,
1246 SerializedVarReceiveInput error_description) {
1180 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1247 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1181 return; 1248 return;
1182 EnterInstanceNoLock enter(instance); 1249 EnterInstanceNoLock enter(instance);
1183 if (enter.succeeded()) { 1250 if (enter.succeeded()) {
1184 enter.functions()->SessionError( 1251 enter.functions()->SessionError(instance,
1185 instance, session_id, media_error, system_code); 1252 web_session_id.Get(dispatcher()),
1253 exception_code,
1254 system_code,
1255 error_description.Get(dispatcher()));
1186 } 1256 }
1187 } 1257 }
1188 1258
1189 void PPB_Instance_Proxy::OnHostMsgDeliverBlock( 1259 void PPB_Instance_Proxy::OnHostMsgDeliverBlock(
1190 PP_Instance instance, 1260 PP_Instance instance,
1191 PP_Resource decrypted_block, 1261 PP_Resource decrypted_block,
1192 const std::string& serialized_block_info) { 1262 const std::string& serialized_block_info) {
1193 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE)) 1263 if (!dispatcher()->permissions().HasPermission(PERMISSION_PRIVATE))
1194 return; 1264 return;
1195 PP_DecryptedBlockInfo block_info; 1265 PP_DecryptedBlockInfo block_info;
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 PP_Instance instance) { 1419 PP_Instance instance) {
1350 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())-> 1420 InstanceData* data = static_cast<PluginDispatcher*>(dispatcher())->
1351 GetInstanceData(instance); 1421 GetInstanceData(instance);
1352 if (!data) 1422 if (!data)
1353 return; // Instance was probably deleted. 1423 return; // Instance was probably deleted.
1354 data->should_do_request_surrounding_text = false; 1424 data->should_do_request_surrounding_text = false;
1355 } 1425 }
1356 1426
1357 } // namespace proxy 1427 } // namespace proxy
1358 } // namespace ppapi 1428 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698