| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 /// @file | 10 /// @file |
| 11 /// This file defines APIs related to memory management, time, and threads. | 11 /// This file defines APIs related to memory management, time, and threads. |
| 12 | 12 |
| 13 namespace pp { | 13 namespace pp { |
| 14 | 14 |
| 15 class CompletionCallback; | 15 class CompletionCallback; |
| 16 class Module; | 16 class Module; |
| 17 | 17 |
| 18 /// APIs related to memory management, time, and threads. | 18 /// APIs related to memory management, time, and threads. |
| 19 class Core { | 19 class Core { |
| 20 public: | 20 public: |
| 21 // Note that we explicitly don't expose Resource& versions of this function | 21 // Note that we explicitly don't expose Resource& versions of this function |
| 22 // since Resource will normally manage the refcount properly. These should | 22 // since Resource will normally manage the refcount properly. These should |
| 23 // be called only when doing manual management on raw PP_Resource handles, | 23 // be called only when doing manual management on raw PP_Resource handles, |
| 24 // which should be fairly rare. | 24 // which should be fairly rare. |
| 25 | 25 |
| 26 /// AddRefResource() increments the reference count for the provided | 26 /// AddRefResource() increments the reference count for the provided |
| 27 /// <code>resource</code>. | 27 /// <code>resource</code>. |
| 28 /// | 28 /// |
| 29 /// @param[in] resource A <code>PP_Resource</code> containing the resource. | 29 /// @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 30 /// resource. |
| 30 void AddRefResource(PP_Resource resource) { | 31 void AddRefResource(PP_Resource resource) { |
| 31 interface_->AddRefResource(resource); | 32 interface_->AddRefResource(resource); |
| 32 } | 33 } |
| 33 | 34 |
| 34 /// ReleaseResource() decrements the reference count for the provided | 35 /// ReleaseResource() decrements the reference count for the provided |
| 35 /// <code>resource</code>. The resource will be deallocated if the | 36 /// <code>resource</code>. The resource will be deallocated if the |
| 36 /// reference count reaches zero. | 37 /// reference count reaches zero. |
| 37 /// | 38 /// |
| 38 /// @param[in] resource A <code>PP_Resource</code> containing the resource. | 39 /// @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 40 /// resource. |
| 39 void ReleaseResource(PP_Resource resource) { | 41 void ReleaseResource(PP_Resource resource) { |
| 40 interface_->ReleaseResource(resource); | 42 interface_->ReleaseResource(resource); |
| 41 } | 43 } |
| 42 | 44 |
| 43 /// GetTime() returns the "wall clock time" according to the | 45 /// GetTime() returns the "wall clock time" according to the |
| 44 /// browser. | 46 /// browser. |
| 45 /// | 47 /// |
| 46 /// @return A <code>PP_Time</code> containing the "wall clock time" according | 48 /// @return A <code>PP_Time</code> containing the "wall clock time" according |
| 47 /// to the browser. | 49 /// to the browser. |
| 48 PP_Time GetTime() { | 50 PP_Time GetTime() { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 // Copy and assignment are disallowed. | 110 // Copy and assignment are disallowed. |
| 109 Core(const Core& other); | 111 Core(const Core& other); |
| 110 Core& operator=(const Core& other); | 112 Core& operator=(const Core& other); |
| 111 | 113 |
| 112 const PPB_Core* interface_; | 114 const PPB_Core* interface_; |
| 113 }; | 115 }; |
| 114 | 116 |
| 115 } // namespace pp | 117 } // namespace pp |
| 116 | 118 |
| 117 #endif // PPAPI_CPP_CORE_H_ | 119 #endif // PPAPI_CPP_CORE_H_ |
| OLD | NEW |