| 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_RESOURCE_H_ | 5 #ifndef PPAPI_CPP_RESOURCE_H_ |
| 6 #define PPAPI_CPP_RESOURCE_H_ | 6 #define PPAPI_CPP_RESOURCE_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_resource.h" | 8 #include "ppapi/c/pp_resource.h" |
| 9 #include "ppapi/cpp/instance_handle.h" | 9 #include "ppapi/cpp/instance_handle.h" |
| 10 #include "ppapi/cpp/pass_ref.h" | 10 #include "ppapi/cpp/pass_ref.h" |
| 11 | 11 |
| 12 /// @file | 12 /// @file |
| 13 /// This file defines a <code>Resource</code> type representing data associated | 13 /// This file defines a <code>Resource</code> type representing data associated |
| 14 /// with the module. | 14 /// with the module. |
| 15 namespace pp { | 15 namespace pp { |
| 16 | 16 |
| 17 class VarResource_Dev; | 17 class VarResource; |
| 18 | 18 |
| 19 /// A reference counted module resource. | 19 /// A reference counted module resource. |
| 20 class Resource { | 20 class Resource { |
| 21 public: | 21 public: |
| 22 /// The default constructor. | 22 /// The default constructor. |
| 23 Resource(); | 23 Resource(); |
| 24 | 24 |
| 25 /// A constructor for copying a resource. | 25 /// A constructor for copying a resource. |
| 26 /// | 26 /// |
| 27 /// @param[in] other A <code>Resource</code>. | 27 /// @param[in] other A <code>Resource</code>. |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 /// increased). | 80 /// increased). |
| 81 /// | 81 /// |
| 82 /// @param[in] resource A <code>PP_Resource</code> corresponding to a | 82 /// @param[in] resource A <code>PP_Resource</code> corresponding to a |
| 83 /// resource. | 83 /// resource. |
| 84 void PassRefFromConstructor(PP_Resource resource); | 84 void PassRefFromConstructor(PP_Resource resource); |
| 85 | 85 |
| 86 /// Sets this resource to null. This releases ownership of the resource. | 86 /// Sets this resource to null. This releases ownership of the resource. |
| 87 void Clear(); | 87 void Clear(); |
| 88 | 88 |
| 89 private: | 89 private: |
| 90 friend class VarResource_Dev; | 90 friend class VarResource; |
| 91 | 91 |
| 92 PP_Resource pp_resource_; | 92 PP_Resource pp_resource_; |
| 93 }; | 93 }; |
| 94 | 94 |
| 95 } // namespace pp | 95 } // namespace pp |
| 96 | 96 |
| 97 inline bool operator==(const pp::Resource& lhs, const pp::Resource& rhs) { | 97 inline bool operator==(const pp::Resource& lhs, const pp::Resource& rhs) { |
| 98 return lhs.pp_resource() == rhs.pp_resource(); | 98 return lhs.pp_resource() == rhs.pp_resource(); |
| 99 } | 99 } |
| 100 | 100 |
| 101 inline bool operator!=(const pp::Resource& lhs, const pp::Resource& rhs) { | 101 inline bool operator!=(const pp::Resource& lhs, const pp::Resource& rhs) { |
| 102 return !(lhs == rhs); | 102 return !(lhs == rhs); |
| 103 } | 103 } |
| 104 | 104 |
| 105 #endif // PPAPI_CPP_RESOURCE_H_ | 105 #endif // PPAPI_CPP_RESOURCE_H_ |
| OLD | NEW |