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/c/dev/ppb_buffer_dev.h"
6 #include "ppapi/thunk/thunk.h"
7 #include "ppapi/thunk/enter.h"
8 #include "ppapi/thunk/ppb_buffer_api.h"
9 #include "ppapi/thunk/resource_creation_api.h"
16 PP_Resource
Create(PP_Instance instance
, uint32_t size
) {
17 EnterResourceCreation
enter(instance
);
20 return enter
.functions()->CreateBuffer(instance
, size
);
23 PP_Bool
IsBuffer(PP_Resource resource
) {
24 EnterResource
<PPB_Buffer_API
> enter(resource
, false);
25 return PP_FromBool(enter
.succeeded());
28 PP_Bool
Describe(PP_Resource resource
, uint32_t* size_in_bytes
) {
29 EnterResource
<PPB_Buffer_API
> enter(resource
, true);
34 return enter
.object()->Describe(size_in_bytes
);
37 void* Map(PP_Resource resource
) {
38 EnterResource
<PPB_Buffer_API
> enter(resource
, true);
41 return enter
.object()->Map();
44 void Unmap(PP_Resource resource
) {
45 EnterResource
<PPB_Buffer_API
> enter(resource
, true);
46 if (enter
.succeeded())
47 enter
.object()->Unmap();
50 const PPB_Buffer_Dev g_ppb_buffer_thunk
= {
60 const PPB_Buffer_Dev_0_4
* GetPPB_Buffer_Dev_0_4_Thunk() {
61 return &g_ppb_buffer_thunk
;