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; |
| 18 |
17 /// A reference counted module resource. | 19 /// A reference counted module resource. |
18 class Resource { | 20 class Resource { |
19 public: | 21 public: |
20 /// The default constructor. | 22 /// The default constructor. |
21 Resource(); | 23 Resource(); |
22 | 24 |
23 /// A constructor for copying a resource. | 25 /// A constructor for copying a resource. |
24 /// | 26 /// |
25 /// @param[in] other A <code>Resource</code>. | 27 /// @param[in] other A <code>Resource</code>. |
26 Resource(const Resource& other); | 28 Resource(const Resource& other); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 /// will call the default <code>Resource</code> constructor, then make a call | 77 /// will call the default <code>Resource</code> constructor, then make a call |
76 /// to create a resource. It then wants to assign the new resource (which, | 78 /// to create a resource. It then wants to assign the new resource (which, |
77 /// since it was returned by the browser, already had its reference count | 79 /// since it was returned by the browser, already had its reference count |
78 /// increased). | 80 /// increased). |
79 /// | 81 /// |
80 /// @param[in] resource A <code>PP_Resource</code> corresponding to a | 82 /// @param[in] resource A <code>PP_Resource</code> corresponding to a |
81 /// resource. | 83 /// resource. |
82 void PassRefFromConstructor(PP_Resource resource); | 84 void PassRefFromConstructor(PP_Resource resource); |
83 | 85 |
84 private: | 86 private: |
| 87 friend class VarResource_Dev; |
| 88 |
85 PP_Resource pp_resource_; | 89 PP_Resource pp_resource_; |
86 }; | 90 }; |
87 | 91 |
88 } // namespace pp | 92 } // namespace pp |
89 | 93 |
90 inline bool operator==(const pp::Resource& lhs, const pp::Resource& rhs) { | 94 inline bool operator==(const pp::Resource& lhs, const pp::Resource& rhs) { |
91 return lhs.pp_resource() == rhs.pp_resource(); | 95 return lhs.pp_resource() == rhs.pp_resource(); |
92 } | 96 } |
93 | 97 |
94 inline bool operator!=(const pp::Resource& lhs, const pp::Resource& rhs) { | 98 inline bool operator!=(const pp::Resource& lhs, const pp::Resource& rhs) { |
95 return !(lhs == rhs); | 99 return !(lhs == rhs); |
96 } | 100 } |
97 | 101 |
98 #endif // PPAPI_CPP_RESOURCE_H_ | 102 #endif // PPAPI_CPP_RESOURCE_H_ |
OLD | NEW |