• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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.
4 
5 // From ppb_compositor.idl modified Thu May 15 17:40:43 2014.
6 
7 #include "ppapi/c/pp_completion_callback.h"
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/ppb_compositor.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13 #include "ppapi/thunk/ppb_compositor_api.h"
14 
15 namespace ppapi {
16 namespace thunk {
17 
18 namespace {
19 
IsCompositor(PP_Resource resource)20 PP_Bool IsCompositor(PP_Resource resource) {
21   VLOG(4) << "PPB_Compositor::IsCompositor()";
22   EnterResource<PPB_Compositor_API> enter(resource, false);
23   return PP_FromBool(enter.succeeded());
24 }
25 
Create(PP_Instance instance)26 PP_Resource Create(PP_Instance instance) {
27   VLOG(4) << "PPB_Compositor::Create()";
28   EnterResourceCreation enter(instance);
29   if (enter.failed())
30     return 0;
31   return enter.functions()->CreateCompositor(instance);
32 }
33 
AddLayer(PP_Resource compositor)34 PP_Resource AddLayer(PP_Resource compositor) {
35   VLOG(4) << "PPB_Compositor::AddLayer()";
36   EnterResource<PPB_Compositor_API> enter(compositor, true);
37   if (enter.failed())
38     return 0;
39   return enter.object()->AddLayer();
40 }
41 
CommitLayers(PP_Resource compositor,struct PP_CompletionCallback cc)42 int32_t CommitLayers(PP_Resource compositor, struct PP_CompletionCallback cc) {
43   VLOG(4) << "PPB_Compositor::CommitLayers()";
44   EnterResource<PPB_Compositor_API> enter(compositor, cc, true);
45   if (enter.failed())
46     return enter.retval();
47   return enter.SetResult(enter.object()->CommitLayers(enter.callback()));
48 }
49 
ResetLayers(PP_Resource compositor)50 int32_t ResetLayers(PP_Resource compositor) {
51   VLOG(4) << "PPB_Compositor::ResetLayers()";
52   EnterResource<PPB_Compositor_API> enter(compositor, true);
53   if (enter.failed())
54     return enter.retval();
55   return enter.object()->ResetLayers();
56 }
57 
58 const PPB_Compositor_0_1 g_ppb_compositor_thunk_0_1 = {
59   &IsCompositor,
60   &Create,
61   &AddLayer,
62   &CommitLayers,
63   &ResetLayers
64 };
65 
66 }  // namespace
67 
GetPPB_Compositor_0_1_Thunk()68 PPAPI_THUNK_EXPORT const PPB_Compositor_0_1* GetPPB_Compositor_0_1_Thunk() {
69   return &g_ppb_compositor_thunk_0_1;
70 }
71 
72 }  // namespace thunk
73 }  // namespace ppapi
74