OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 COMPONENTS_NACL_RENDERER_PLUGIN_TEMPORARY_FILE_H_ | 5 #ifndef COMPONENTS_NACL_RENDERER_PLUGIN_TEMPORARY_FILE_H_ |
6 #define COMPONENTS_NACL_RENDERER_PLUGIN_TEMPORARY_FILE_H_ | 6 #define COMPONENTS_NACL_RENDERER_PLUGIN_TEMPORARY_FILE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/files/file.h" | 10 #include "base/files/file.h" |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 // Accessors. | 54 // Accessors. |
55 // The nacl::DescWrapper* for the writeable version of the file. | 55 // The nacl::DescWrapper* for the writeable version of the file. |
56 nacl::DescWrapper* write_wrapper() { return write_wrapper_.get(); } | 56 nacl::DescWrapper* write_wrapper() { return write_wrapper_.get(); } |
57 nacl::DescWrapper* read_wrapper() { return read_wrapper_.get(); } | 57 nacl::DescWrapper* read_wrapper() { return read_wrapper_.get(); } |
58 | 58 |
59 // Returns a handle to the file, transferring ownership of it. Note that | 59 // Returns a handle to the file, transferring ownership of it. Note that |
60 // the objects returned by write_wrapper() and read_wrapper() remain | 60 // the objects returned by write_wrapper() and read_wrapper() remain |
61 // valid after TakeFileHandle() is called. | 61 // valid after TakeFileHandle() is called. |
62 PP_FileHandle TakeFileHandle(); | 62 PP_FileHandle TakeFileHandle(); |
63 | 63 |
| 64 // Returns a handle to the file, without transferring ownership of it. |
| 65 // This handle remains valid until the TempFile object is destroyed or |
| 66 // TakeFileHandle() is called. |
| 67 PP_FileHandle GetFileHandle(); |
| 68 |
64 private: | 69 private: |
65 NACL_DISALLOW_COPY_AND_ASSIGN(TempFile); | 70 NACL_DISALLOW_COPY_AND_ASSIGN(TempFile); |
66 | 71 |
67 nacl::DescWrapper* MakeDescWrapper(int nacl_file_flags); | 72 nacl::DescWrapper* MakeDescWrapper(int nacl_file_flags); |
68 | 73 |
69 Plugin* plugin_; | 74 Plugin* plugin_; |
70 scoped_ptr<nacl::DescWrapper> read_wrapper_; | 75 scoped_ptr<nacl::DescWrapper> read_wrapper_; |
71 scoped_ptr<nacl::DescWrapper> write_wrapper_; | 76 scoped_ptr<nacl::DescWrapper> write_wrapper_; |
72 base::File file_handle_; | 77 base::File file_handle_; |
73 }; | 78 }; |
74 | 79 |
75 } // namespace plugin | 80 } // namespace plugin |
76 | 81 |
77 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_TEMPORARY_FILE_H_ | 82 #endif // COMPONENTS_NACL_RENDERER_PLUGIN_TEMPORARY_FILE_H_ |
OLD | NEW |