Revert 168224 - Update V8 to version 3.15.4.
[chromium-blink-merge.git] / ppapi / thunk / ppb_audio_thunk.cc
blob28740e5a61d663242d068a97eeaada91a170bc08
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 #include "ppapi/thunk/thunk.h"
6 #include "ppapi/thunk/enter.h"
7 #include "ppapi/thunk/ppb_audio_api.h"
8 #include "ppapi/thunk/resource_creation_api.h"
10 namespace ppapi {
11 namespace thunk {
13 namespace {
15 typedef EnterResource<PPB_Audio_API> EnterAudio;
17 PP_Resource Create(PP_Instance instance,
18 PP_Resource config_id,
19 PPB_Audio_Callback callback,
20 void* user_data) {
21 EnterResourceCreation enter(instance);
22 if (enter.failed())
23 return 0;
24 return enter.functions()->CreateAudio(instance, config_id,
25 callback, user_data);
28 PP_Bool IsAudio(PP_Resource resource) {
29 EnterAudio enter(resource, false);
30 return enter.succeeded() ? PP_TRUE : PP_FALSE;
33 PP_Resource GetCurrentConfiguration(PP_Resource audio_id) {
34 EnterAudio enter(audio_id, true);
35 if (enter.failed())
36 return 0;
37 return enter.object()->GetCurrentConfig();
40 PP_Bool StartPlayback(PP_Resource audio_id) {
41 EnterAudio enter(audio_id, true);
42 if (enter.failed())
43 return PP_FALSE;
44 return enter.object()->StartPlayback();
47 PP_Bool StopPlayback(PP_Resource audio_id) {
48 EnterAudio enter(audio_id, true);
49 if (enter.failed())
50 return PP_FALSE;
51 return enter.object()->StopPlayback();
54 const PPB_Audio g_ppb_audio_thunk = {
55 &Create,
56 &IsAudio,
57 &GetCurrentConfiguration,
58 &StartPlayback,
59 &StopPlayback
62 } // namespace
64 const PPB_Audio_1_0* GetPPB_Audio_1_0_Thunk() {
65 return &g_ppb_audio_thunk;
68 } // namespace thunk
69 } // namespace ppapi