Chromium Code Reviews| Index: ppapi/cpp/resource.h |
| =================================================================== |
| --- ppapi/cpp/resource.h (revision 88128) |
| +++ ppapi/cpp/resource.h (working copy) |
| @@ -7,41 +7,67 @@ |
| #include "ppapi/c/pp_resource.h" |
| +/// @file |
| +/// This file defines a Resource type representing data associated |
| +/// with the module. |
| namespace pp { |
| -// Base class for refcounted plugin resources. |
| +/// A reference counted module resource. |
| class Resource { |
| public: |
| + |
| + /// The default constructor. |
| Resource(); |
| + |
| + /// A constructor for copying a resource. |
| + /// |
| + /// @param[in] other A Resource. |
| Resource(const Resource& other); |
| + /// Destructor. |
| virtual ~Resource(); |
| + /// This function assigns one Resource to another Resource. |
| + /// |
| + /// @param[in] other A Resource. |
| + /// @return A Resource containing the assigned Resource. |
| Resource& operator=(const Resource& other); |
| - // Returns true if the given resource is invalid or uninitialized. |
| + /// This functions determines if this resource is invalid or |
| + /// uninitialized. |
| + /// |
| + /// @return true if this resource is invalid or uninitialized. |
| bool is_null() const { return !pp_resource_; } |
| PP_Resource pp_resource() const { return pp_resource_; } |
| - // Releases ownership of the PP_Resource and returns it to the caller. |
| - // Note the the reference count on the resource is unchanged and the caller |
| - // needs to release the resource. |
| + /// This function releases ownership of this resource and returns it to the |
| + /// caller. |
| + /// |
| + /// Note that the reference count on the resource is unchanged and the caller |
| + /// needs to release the resource. |
| + /// |
| + /// @return The detached PP_Resource. |
| PP_Resource detach(); |
| protected: |
| - // This constructor is used when we've gotten a PP_Resource as a return value |
| - // that we need to addref. |
| + /// A constructor used when a PP_Resource is provided as a return value |
| + /// whose reference count we need to increment. |
| + /// |
| + /// @param[in] resource A PP_Resource. |
| explicit Resource(PP_Resource resource); |
| - // Called by derived class' constructors to initialize this Resource with |
| - // a PP_Resource that has already been AddRef'ed. It also assumes this object |
| - // has no current resource. |
| - // |
| - // The intended usage is that the derived class constructor will call the |
| - // default Resource constructor, then make a call to create a resource. It |
| - // then wants to assign the new resource (which, since it was returned by the |
| - // browser, is already AddRef'ed). |
| + /// This function is called by derived class' constructors to initialize this |
| + /// Resource with a PP_Resource that has already had its reference count |
| + /// incremented Core::AddRefResource. It also assumes this object has no |
|
dmichael (off chromium)
2011/06/07 20:45:26
'incremented' -> 'incremented by'
jond
2011/06/08 16:30:12
Done.
|
| + /// current resource. |
| + /// |
| + /// The intended usage is that the derived class constructor will call the |
| + /// default Resource constructor, then make a call to create a resource. It |
| + /// then wants to assign the new resource (which, since it was returned by the |
| + /// browser, is already AddRef'ed). |
| + /// |
| + /// @param[in] resource A PP_Resource. |
| void PassRefFromConstructor(PP_Resource resource); |
| private: |