Make |track_| in MediaStreamTrack const. and a couple of other cosmetic changes.
[chromium-blink-merge.git] / ppapi / thunk / ppb_content_decryptor_private_thunk.cc
bloba79307ac6a92ffc13e9b54f97a2cdfaec0c6baeb
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
3 // found in the LICENSE file.
5 // From private/ppb_content_decryptor_private.idl,
6 // modified Mon Aug 25 13:52:39 2014.
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_content_decryptor_private.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
14 namespace ppapi {
15 namespace thunk {
17 namespace {
19 void PromiseResolved(PP_Instance instance, uint32_t promise_id) {
20 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolved()";
21 EnterInstance enter(instance);
22 if (enter.failed())
23 return;
24 enter.functions()->PromiseResolved(instance, promise_id);
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);
39 void PromiseResolvedWithKeyIds(PP_Instance instance,
40 uint32_t promise_id,
41 struct PP_Var key_ids_array) {
42 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithKeyIds()";
43 EnterInstance enter(instance);
44 if (enter.failed())
45 return;
46 enter.functions()->PromiseResolvedWithKeyIds(instance,
47 promise_id,
48 key_ids_array);
51 void PromiseRejected(PP_Instance instance,
52 uint32_t promise_id,
53 PP_CdmExceptionCode exception_code,
54 uint32_t system_code,
55 struct PP_Var error_description) {
56 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseRejected()";
57 EnterInstance enter(instance);
58 if (enter.failed())
59 return;
60 enter.functions()->PromiseRejected(instance,
61 promise_id,
62 exception_code,
63 system_code,
64 error_description);
67 void SessionMessage(PP_Instance instance,
68 struct PP_Var web_session_id,
69 struct PP_Var message,
70 struct PP_Var destination_url) {
71 VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()";
72 EnterInstance enter(instance);
73 if (enter.failed())
74 return;
75 enter.functions()->SessionMessage(instance,
76 web_session_id,
77 message,
78 destination_url);
81 void SessionKeysChange(PP_Instance instance,
82 struct PP_Var web_session_id,
83 PP_Bool has_additional_usable_key) {
84 VLOG(4) << "PPB_ContentDecryptor_Private::SessionKeysChange()";
85 EnterInstance enter(instance);
86 if (enter.failed())
87 return;
88 enter.functions()->SessionKeysChange(instance,
89 web_session_id,
90 has_additional_usable_key);
93 void SessionExpirationChange(PP_Instance instance,
94 struct PP_Var web_session_id,
95 PP_Time new_expiry_time) {
96 VLOG(4) << "PPB_ContentDecryptor_Private::SessionExpirationChange()";
97 EnterInstance enter(instance);
98 if (enter.failed())
99 return;
100 enter.functions()->SessionExpirationChange(instance,
101 web_session_id,
102 new_expiry_time);
105 void SessionReady(PP_Instance instance, struct PP_Var web_session_id) {
106 VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()";
107 EnterInstance enter(instance);
108 if (enter.failed())
109 return;
110 enter.functions()->SessionReady(instance, web_session_id);
113 void SessionClosed(PP_Instance instance, struct PP_Var web_session_id) {
114 VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()";
115 EnterInstance enter(instance);
116 if (enter.failed())
117 return;
118 enter.functions()->SessionClosed(instance, web_session_id);
121 void SessionError(PP_Instance instance,
122 struct PP_Var web_session_id,
123 PP_CdmExceptionCode exception_code,
124 uint32_t system_code,
125 struct PP_Var error_description) {
126 VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()";
127 EnterInstance enter(instance);
128 if (enter.failed())
129 return;
130 enter.functions()->SessionError(instance,
131 web_session_id,
132 exception_code,
133 system_code,
134 error_description);
137 void DeliverBlock(PP_Instance instance,
138 PP_Resource decrypted_block,
139 const struct PP_DecryptedBlockInfo* decrypted_block_info) {
140 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
141 EnterInstance enter(instance);
142 if (enter.failed())
143 return;
144 enter.functions()->DeliverBlock(instance,
145 decrypted_block,
146 decrypted_block_info);
149 void DecoderInitializeDone(PP_Instance instance,
150 PP_DecryptorStreamType decoder_type,
151 uint32_t request_id,
152 PP_Bool success) {
153 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()";
154 EnterInstance enter(instance);
155 if (enter.failed())
156 return;
157 enter.functions()->DecoderInitializeDone(instance,
158 decoder_type,
159 request_id,
160 success);
163 void DecoderDeinitializeDone(PP_Instance instance,
164 PP_DecryptorStreamType decoder_type,
165 uint32_t request_id) {
166 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()";
167 EnterInstance enter(instance);
168 if (enter.failed())
169 return;
170 enter.functions()->DecoderDeinitializeDone(instance,
171 decoder_type,
172 request_id);
175 void DecoderResetDone(PP_Instance instance,
176 PP_DecryptorStreamType decoder_type,
177 uint32_t request_id) {
178 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()";
179 EnterInstance enter(instance);
180 if (enter.failed())
181 return;
182 enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
185 void DeliverFrame(PP_Instance instance,
186 PP_Resource decrypted_frame,
187 const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
188 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()";
189 EnterInstance enter(instance);
190 if (enter.failed())
191 return;
192 enter.functions()->DeliverFrame(instance,
193 decrypted_frame,
194 decrypted_frame_info);
197 void DeliverSamples(
198 PP_Instance instance,
199 PP_Resource audio_frames,
200 const struct PP_DecryptedSampleInfo* decrypted_sample_info) {
201 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
202 EnterInstance enter(instance);
203 if (enter.failed())
204 return;
205 enter.functions()->DeliverSamples(instance,
206 audio_frames,
207 decrypted_sample_info);
210 const PPB_ContentDecryptor_Private_0_12
211 g_ppb_contentdecryptor_private_thunk_0_12 = {
212 &PromiseResolved,
213 &PromiseResolvedWithSession,
214 &PromiseResolvedWithKeyIds,
215 &PromiseRejected,
216 &SessionMessage,
217 &SessionKeysChange,
218 &SessionExpirationChange,
219 &SessionReady,
220 &SessionClosed,
221 &SessionError,
222 &DeliverBlock,
223 &DecoderInitializeDone,
224 &DecoderDeinitializeDone,
225 &DecoderResetDone,
226 &DeliverFrame,
227 &DeliverSamples
230 } // namespace
232 PPAPI_THUNK_EXPORT const PPB_ContentDecryptor_Private_0_12*
233 GetPPB_ContentDecryptor_Private_0_12_Thunk() {
234 return &g_ppb_contentdecryptor_private_thunk_0_12;
237 } // namespace thunk
238 } // namespace ppapi