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

Side by Side Diff: ppapi/thunk/ppb_content_decryptor_private_thunk.cc

Issue 265993002: Add Promises for EME (Chromium side) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cdm_promise template Created 6 years, 7 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 // From private/ppb_content_decryptor_private.idl, 5 // From private/ppb_content_decryptor_private.idl,
6 // modified Wed Feb 26 16:37:47 2014. 6 // modified Wed May 7 16:29:29 2014.
7 7
8 #include "ppapi/c/pp_errors.h" 8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_content_decryptor_private.h" 9 #include "ppapi/c/private/ppb_content_decryptor_private.h"
10 #include "ppapi/shared_impl/tracked_callback.h" 10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h" 11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h" 12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 13
14 namespace ppapi { 14 namespace ppapi {
15 namespace thunk { 15 namespace thunk {
16 16
17 namespace { 17 namespace {
18 18
19 void SessionCreated(PP_Instance instance, 19 void PromiseResolved(PP_Instance instance, uint32_t promise_id) {
20 uint32_t session_id, 20 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolved()";
21 struct PP_Var web_session_id) {
22 VLOG(4) << "PPB_ContentDecryptor_Private::SessionCreated()";
23 EnterInstance enter(instance); 21 EnterInstance enter(instance);
24 if (enter.failed()) 22 if (enter.failed())
25 return; 23 return;
26 enter.functions()->SessionCreated(instance, session_id, web_session_id); 24 enter.functions()->PromiseResolved(instance, promise_id);
25 }
26
27 void PromiseResolvedWithSession(PP_Instance instance,
28 uint32_t promise_id,
29 struct PP_Var web_session_id) {
30 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithSession()";
31 EnterInstance enter(instance);
32 if (enter.failed())
33 return;
34 enter.functions()->PromiseResolvedWithSession(instance,
35 promise_id,
36 web_session_id);
37 }
38
39 void PromiseRejected(PP_Instance instance,
40 uint32_t promise_id,
41 PP_ExceptionCodeType exception_code,
42 uint32_t system_code,
43 struct PP_Var error_description) {
44 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseRejected()";
45 EnterInstance enter(instance);
46 if (enter.failed())
47 return;
48 enter.functions()->PromiseRejected(
49 instance, promise_id, exception_code, system_code, error_description);
27 } 50 }
28 51
29 void SessionMessage(PP_Instance instance, 52 void SessionMessage(PP_Instance instance,
30 uint32_t session_id, 53 struct PP_Var web_session_id,
31 struct PP_Var message, 54 struct PP_Var message,
32 struct PP_Var destination_url) { 55 struct PP_Var destination_url) {
33 VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()"; 56 VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()";
34 EnterInstance enter(instance); 57 EnterInstance enter(instance);
35 if (enter.failed()) 58 if (enter.failed())
36 return; 59 return;
37 enter.functions()->SessionMessage(instance, 60 enter.functions()->SessionMessage(instance,
38 session_id, 61 web_session_id,
39 message, 62 message,
40 destination_url); 63 destination_url);
41 } 64 }
42 65
43 void SessionReady(PP_Instance instance, uint32_t session_id) { 66 void SessionReady(PP_Instance instance, struct PP_Var web_session_id) {
44 VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()"; 67 VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()";
45 EnterInstance enter(instance); 68 EnterInstance enter(instance);
46 if (enter.failed()) 69 if (enter.failed())
47 return; 70 return;
48 enter.functions()->SessionReady(instance, session_id); 71 enter.functions()->SessionReady(instance, web_session_id);
49 } 72 }
50 73
51 void SessionClosed(PP_Instance instance, uint32_t session_id) { 74 void SessionClosed(PP_Instance instance, struct PP_Var web_session_id) {
52 VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()"; 75 VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()";
53 EnterInstance enter(instance); 76 EnterInstance enter(instance);
54 if (enter.failed()) 77 if (enter.failed())
55 return; 78 return;
56 enter.functions()->SessionClosed(instance, session_id); 79 enter.functions()->SessionClosed(instance, web_session_id);
57 } 80 }
58 81
59 void SessionError(PP_Instance instance, 82 void SessionError(PP_Instance instance,
60 uint32_t session_id, 83 struct PP_Var web_session_id,
61 int32_t media_error, 84 PP_ExceptionCodeType exception_code,
62 uint32_t system_code) { 85 uint32_t system_code,
86 struct PP_Var error_description) {
63 VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()"; 87 VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()";
64 EnterInstance enter(instance); 88 EnterInstance enter(instance);
65 if (enter.failed()) 89 if (enter.failed())
66 return; 90 return;
67 enter.functions()->SessionError(instance, 91 enter.functions()->SessionError(
68 session_id, 92 instance, web_session_id, exception_code, system_code, error_description);
69 media_error,
70 system_code);
71 } 93 }
72 94
73 void DeliverBlock(PP_Instance instance, 95 void DeliverBlock(PP_Instance instance,
74 PP_Resource decrypted_block, 96 PP_Resource decrypted_block,
75 const struct PP_DecryptedBlockInfo* decrypted_block_info) { 97 const struct PP_DecryptedBlockInfo* decrypted_block_info) {
76 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()"; 98 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
77 EnterInstance enter(instance); 99 EnterInstance enter(instance);
78 if (enter.failed()) 100 if (enter.failed())
79 return; 101 return;
80 enter.functions()->DeliverBlock(instance, 102 enter.functions()->DeliverBlock(instance,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 const struct PP_DecryptedSampleInfo* decrypted_sample_info) { 158 const struct PP_DecryptedSampleInfo* decrypted_sample_info) {
137 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()"; 159 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
138 EnterInstance enter(instance); 160 EnterInstance enter(instance);
139 if (enter.failed()) 161 if (enter.failed())
140 return; 162 return;
141 enter.functions()->DeliverSamples(instance, 163 enter.functions()->DeliverSamples(instance,
142 audio_frames, 164 audio_frames,
143 decrypted_sample_info); 165 decrypted_sample_info);
144 } 166 }
145 167
146 const PPB_ContentDecryptor_Private_0_11 168 const PPB_ContentDecryptor_Private_0_12
147 g_ppb_contentdecryptor_private_thunk_0_11 = { 169 g_ppb_contentdecryptor_private_thunk_0_12 = {
148 &SessionCreated, 170 &PromiseResolved,
171 &PromiseResolvedWithSession,
172 &PromiseRejected,
149 &SessionMessage, 173 &SessionMessage,
150 &SessionReady, 174 &SessionReady,
151 &SessionClosed, 175 &SessionClosed,
152 &SessionError, 176 &SessionError,
153 &DeliverBlock, 177 &DeliverBlock,
154 &DecoderInitializeDone, 178 &DecoderInitializeDone,
155 &DecoderDeinitializeDone, 179 &DecoderDeinitializeDone,
156 &DecoderResetDone, 180 &DecoderResetDone,
157 &DeliverFrame, 181 &DeliverFrame,
158 &DeliverSamples 182 &DeliverSamples
159 }; 183 };
160 184
161 } // namespace 185 } // namespace
162 186
163 PPAPI_THUNK_EXPORT const PPB_ContentDecryptor_Private_0_11* 187 PPAPI_THUNK_EXPORT const PPB_ContentDecryptor_Private_0_12*
164 GetPPB_ContentDecryptor_Private_0_11_Thunk() { 188 GetPPB_ContentDecryptor_Private_0_12_Thunk() {
165 return &g_ppb_contentdecryptor_private_thunk_0_11; 189 return &g_ppb_contentdecryptor_private_thunk_0_12;
166 } 190 }
167 191
168 } // namespace thunk 192 } // namespace thunk
169 } // namespace ppapi 193 } // namespace ppapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698