Make |track_| in MediaStreamTrack const. and a couple of other cosmetic changes.
[chromium-blink-merge.git] / ppapi / thunk / ppb_compositor_thunk.cc
blob682b42d5c390b05491a34b28bb021abbb6e282e7
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 May 15 17:40:43 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 = {
59 &IsCompositor,
60 &Create,
61 &AddLayer,
62 &CommitLayers,
63 &ResetLayers
66 } // namespace
68 PPAPI_THUNK_EXPORT const PPB_Compositor_0_1* GetPPB_Compositor_0_1_Thunk() {
69 return &g_ppb_compositor_thunk_0_1;
72 } // namespace thunk
73 } // namespace ppapi