OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef PPAPI_CPP_CORE_H_ | 5 #ifndef PPAPI_CPP_CORE_H_ |
6 #define PPAPI_CPP_CORE_H_ | 6 #define PPAPI_CPP_CORE_H_ |
7 | 7 |
8 #include "ppapi/c/ppb_core.h" | 8 #include "ppapi/c/ppb_core.h" |
9 | 9 |
10 namespace pp { | 10 namespace pp { |
11 | 11 |
12 class CompletionCallback; | 12 class CompletionCallback; |
13 class Module; | 13 class Module; |
14 | 14 |
15 // Simple wrapper around the PPB_Core interface. Some of these wrappers add | 15 // Simple wrapper around the PPB_Core interface. Some of these wrappers add |
16 // nothing over the C interface, but some allow the use of C++ arguments. | 16 // nothing over the C interface, but some allow the use of C++ arguments. |
17 class Core { | 17 class Core { |
18 public: | 18 public: |
19 // Note that we explicitly don't expose Resource& versions of this function | 19 // Note that we explicitly don't expose Resource& versions of this function |
20 // since Resource will normally manage the refcount properly. These should | 20 // since Resource will normally manage the refcount properly. These should |
21 // be called only when doing manual management on raw PP_Resource handles, | 21 // be called only when doing manual management on raw PP_Resource handles, |
22 // which should be fairly rare. | 22 // which should be fairly rare. |
23 void AddRefResource(PP_Resource resource) { | 23 void AddRefResource(PP_Resource resource) { |
24 interface_->AddRefResource(resource); | 24 interface_->AddRefResource(resource); |
25 } | 25 } |
26 void ReleaseResource(PP_Resource resource) { | 26 void ReleaseResource(PP_Resource resource) { |
27 interface_->ReleaseResource(resource); | 27 interface_->ReleaseResource(resource); |
28 } | 28 } |
29 | 29 |
30 void* MemAlloc(size_t num_bytes) { | 30 void* MemAlloc(uint32_t num_bytes) { |
31 return interface_->MemAlloc(num_bytes); | 31 return interface_->MemAlloc(num_bytes); |
32 } | 32 } |
33 void MemFree(void* ptr) { | 33 void MemFree(void* ptr) { |
34 interface_->MemFree(ptr); | 34 interface_->MemFree(ptr); |
35 } | 35 } |
36 | 36 |
37 PP_Time GetTime() { | 37 PP_Time GetTime() { |
38 return interface_->GetTime(); | 38 return interface_->GetTime(); |
39 } | 39 } |
40 | 40 |
(...skipping 17 matching lines...) Expand all Loading... |
58 // Copy and assignment are disallowed. | 58 // Copy and assignment are disallowed. |
59 Core(const Core& other); | 59 Core(const Core& other); |
60 Core& operator=(const Core& other); | 60 Core& operator=(const Core& other); |
61 | 61 |
62 const PPB_Core* interface_; | 62 const PPB_Core* interface_; |
63 }; | 63 }; |
64 | 64 |
65 } // namespace pp | 65 } // namespace pp |
66 | 66 |
67 #endif // PPAPI_CPP_CORE_H_ | 67 #endif // PPAPI_CPP_CORE_H_ |
OLD | NEW |