Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: ppapi/cpp/resource.h

Issue 7054060: New documentation for resource.h, core.h, and common.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/cpp/core.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_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 9
10 /// @file
11 /// This file defines a Resource type representing data associated
12 /// with the module.
10 namespace pp { 13 namespace pp {
11 14
12 // Base class for refcounted plugin resources. 15 /// A reference counted module resource.
13 class Resource { 16 class Resource {
14 public: 17 public:
18
19 /// The default constructor.
15 Resource(); 20 Resource();
21
22 /// A constructor for copying a resource.
23 ///
24 /// @param[in] other A Resource.
16 Resource(const Resource& other); 25 Resource(const Resource& other);
17 26
27 /// Destructor.
18 virtual ~Resource(); 28 virtual ~Resource();
19 29
30 /// This function assigns one Resource to another Resource.
31 ///
32 /// @param[in] other A Resource.
33 /// @return A Resource containing the assigned Resource.
20 Resource& operator=(const Resource& other); 34 Resource& operator=(const Resource& other);
21 35
22 // Returns true if the given resource is invalid or uninitialized. 36 /// This functions determines if this resource is invalid or
37 /// uninitialized.
38 ///
39 /// @return true if this resource is invalid or uninitialized.
23 bool is_null() const { return !pp_resource_; } 40 bool is_null() const { return !pp_resource_; }
24 41
25 PP_Resource pp_resource() const { return pp_resource_; } 42 PP_Resource pp_resource() const { return pp_resource_; }
26 43
27 // Releases ownership of the PP_Resource and returns it to the caller. 44 /// This function releases ownership of this resource and returns it to the
28 // Note the the reference count on the resource is unchanged and the caller 45 /// caller.
29 // needs to release the resource. 46 ///
47 /// Note that the reference count on the resource is unchanged and the caller
48 /// needs to release the resource.
49 ///
50 /// @return The detached PP_Resource.
30 PP_Resource detach(); 51 PP_Resource detach();
31 52
32 protected: 53 protected:
33 // This constructor is used when we've gotten a PP_Resource as a return value 54 /// A constructor used when a PP_Resource is provided as a return value
34 // that we need to addref. 55 /// whose reference count we need to increment.
56 ///
57 /// @param[in] resource A PP_Resource.
35 explicit Resource(PP_Resource resource); 58 explicit Resource(PP_Resource resource);
36 59
37 // Called by derived class' constructors to initialize this Resource with 60 /// This function is called by derived class' constructors to initialize this
38 // a PP_Resource that has already been AddRef'ed. It also assumes this object 61 /// Resource with a PP_Resource that has already had its reference count
39 // has no current resource. 62 /// 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.
40 // 63 /// current resource.
41 // The intended usage is that the derived class constructor will call the 64 ///
42 // default Resource constructor, then make a call to create a resource. It 65 /// The intended usage is that the derived class constructor will call the
43 // then wants to assign the new resource (which, since it was returned by the 66 /// default Resource constructor, then make a call to create a resource. It
44 // browser, is already AddRef'ed). 67 /// then wants to assign the new resource (which, since it was returned by the
68 /// browser, is already AddRef'ed).
69 ///
70 /// @param[in] resource A PP_Resource.
45 void PassRefFromConstructor(PP_Resource resource); 71 void PassRefFromConstructor(PP_Resource resource);
46 72
47 private: 73 private:
48 PP_Resource pp_resource_; 74 PP_Resource pp_resource_;
49 }; 75 };
50 76
51 } // namespace pp 77 } // namespace pp
52 78
53 inline bool operator==(const pp::Resource& lhs, const pp::Resource& rhs) { 79 inline bool operator==(const pp::Resource& lhs, const pp::Resource& rhs) {
54 return lhs.pp_resource() == rhs.pp_resource(); 80 return lhs.pp_resource() == rhs.pp_resource();
55 } 81 }
56 82
57 #endif // PPAPI_CPP_RESOURCE_H_ 83 #endif // PPAPI_CPP_RESOURCE_H_
OLDNEW
« no previous file with comments | « ppapi/cpp/core.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698