Create an initial chrome://supervised-user-internals page
[chromium-blink-merge.git] / ppapi / thunk / ppb_compositor_thunk.cc
blobffd9b8f1f9bcb54861b96ca4a7290838724811e5
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.
5 // From ppb_compositor.idl modified Thu Sep 18 11:36:39 2014.
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"
15 namespace ppapi {
16 namespace thunk {
18 namespace {
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());
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);
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();
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()));
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();
58 const PPB_Compositor_0_1 g_ppb_compositor_thunk_0_1 = {&IsCompositor,
59 &Create,
60 &AddLayer,
61 &CommitLayers,
62 &ResetLayers};
64 } // namespace
66 PPAPI_THUNK_EXPORT const PPB_Compositor_0_1* GetPPB_Compositor_0_1_Thunk() {
67 return &g_ppb_compositor_thunk_0_1;
70 } // namespace thunk
71 } // namespace ppapi