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_FILE_REF_H_ | 5 #ifndef PPAPI_CPP_FILE_REF_H_ |
6 #define PPAPI_CPP_FILE_REF_H_ | 6 #define PPAPI_CPP_FILE_REF_H_ |
7 | 7 |
8 #include "ppapi/c/pp_stdint.h" | 8 #include "ppapi/c/pp_stdint.h" |
9 #include "ppapi/c/ppb_file_ref.h" | 9 #include "ppapi/c/ppb_file_ref.h" |
10 #include "ppapi/cpp/resource.h" | 10 #include "ppapi/cpp/resource.h" |
11 #include "ppapi/cpp/var.h" | 11 #include "ppapi/cpp/var.h" |
12 | 12 |
13 /// @file | 13 /// @file |
14 /// This file defines the API to create a file reference or "weak pointer" to a | 14 /// This file defines the API to create a file reference or "weak pointer" to a |
15 /// file in a file system. | 15 /// file in a file system. |
16 | 16 |
17 namespace pp { | 17 namespace pp { |
18 | 18 |
19 class CompletionCallback; | 19 class CompletionCallback; |
20 class FileSystem; | 20 class FileSystem; |
21 | 21 |
22 /// The <code>FileRef</code> class represents a "weak pointer" to a file in | 22 /// The <code>FileRef</code> class represents a "weak pointer" to a file in |
23 /// a file system. | 23 /// a file system. |
24 class FileRef : public Resource { | 24 class FileRef : public Resource { |
25 public: | 25 public: |
26 /// Default constructor for creating an is_null() <code>FileRef</code> | 26 /// Default constructor for creating an is_null() <code>FileRef</code> |
27 /// object. | 27 /// object. |
28 FileRef() {} | 28 FileRef() {} |
29 | 29 |
30 /// A constructor used to create a <code>FileRef</code> and associate it with | 30 /// A constructor used when you have an existing PP_Resource for a FileRef |
31 /// the provided <code>Instance</code>. | 31 /// and which to create a C++ object that takes an additional reference to |
| 32 /// the resource. |
32 /// | 33 /// |
33 /// @param[in] resource An <code>Instance</code>. | 34 /// @param[in] resource A PP_Resource corresponding to file reference. |
34 explicit FileRef(PP_Resource resource); | 35 explicit FileRef(PP_Resource resource); |
35 | 36 |
36 /// A special structure used by the constructor that does not increment the | |
37 /// reference count of the underlying file reference. | |
38 struct PassRef {}; | |
39 | |
40 /// A constructor used when you have received a PP_Resource as a return | 37 /// A constructor used when you have received a PP_Resource as a return |
41 /// value that has already been reference counted. | 38 /// value that has already been reference counted. |
42 /// | 39 /// |
43 /// @param[in] resource A PP_Resource corresponding to file reference. | 40 /// @param[in] resource A PP_Resource corresponding to file reference. |
44 FileRef(PassRef, PP_Resource resource); | 41 FileRef(PassRef, PP_Resource resource); |
45 | 42 |
46 /// A constructor that creates a weak pointer to a file in the given file | 43 /// A constructor that creates a weak pointer to a file in the given file |
47 /// system. File paths are POSIX style. | 44 /// system. File paths are POSIX style. |
48 /// | 45 /// |
49 /// @param[in] file_system A <code>FileSystem</code> corresponding to a file | 46 /// @param[in] file_system A <code>FileSystem</code> corresponding to a file |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 /// @param[in] cc A <code>CompletionCallback</code> to be called upon | 141 /// @param[in] cc A <code>CompletionCallback</code> to be called upon |
145 /// completion of Rename(). | 142 /// completion of Rename(). |
146 /// | 143 /// |
147 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. | 144 /// @return An int32_t containing an error code from <code>pp_errors.h</code>. |
148 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); | 145 int32_t Rename(const FileRef& new_file_ref, const CompletionCallback& cc); |
149 }; | 146 }; |
150 | 147 |
151 } // namespace pp | 148 } // namespace pp |
152 | 149 |
153 #endif // PPAPI_CPP_FILE_REF_H_ | 150 #endif // PPAPI_CPP_FILE_REF_H_ |
OLD | NEW |