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