Pepper_56_C++_interfaces
Pepper_56_C++_interfaces
 All Classes Namespaces Files Functions Typedefs Enumerations Macros Groups
buffer_dev.h
1 // Copyright (c) 2011 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 #ifndef PPAPI_CPP_DEV_BUFFER_DEV_H_
6 #define PPAPI_CPP_DEV_BUFFER_DEV_H_
7 
8 #include <stdint.h>
9 
10 #include "ppapi/cpp/resource.h"
11 
12 namespace pp {
13 
14 class InstanceHandle;
15 
16 class Buffer_Dev : public Resource {
17  public:
18  // Creates an is_null() Buffer object.
19  Buffer_Dev();
20  Buffer_Dev(const Buffer_Dev& other);
21  explicit Buffer_Dev(PP_Resource resource);
22 
23  // Creates & Maps a new Buffer in the browser with the given size. The
24  // resulting object will be is_null() if either Create() or Map() fails.
25  Buffer_Dev(const InstanceHandle& instance, uint32_t size);
26 
27  // Constructor used when the buffer resource already has a reference count
28  // assigned. No additional reference is taken.
29  Buffer_Dev(PassRef, PP_Resource resource);
30 
31  // Unmap the underlying shared memory.
32  virtual ~Buffer_Dev();
33 
34  Buffer_Dev& operator=(const Buffer_Dev& rhs);
35 
36  uint32_t size() const { return size_; }
37  void* data() const { return data_; }
38 
39  private:
40  void Init();
41 
42  void* data_;
43  uint32_t size_;
44 };
45 
46 } // namespace pp
47 
48 #endif // PPAPI_CPP_DEV_BUFFER_DEV_H_
Definition: instance_handle.h:44
PassRef
Definition: pass_ref.h:17
Definition: buffer_dev.h:16
A reference counted module resource.
Definition: resource.h:20