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 PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 5 #ifndef PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
6 #define PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 6 #define PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
| 10 #include "base/files/file.h" |
10 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "ppapi/c/private/pp_file_handle.h" | 13 #include "ppapi/c/private/pp_file_handle.h" |
13 #include "ppapi/proxy/connection.h" | 14 #include "ppapi/proxy/connection.h" |
14 #include "ppapi/proxy/plugin_resource.h" | 15 #include "ppapi/proxy/plugin_resource.h" |
15 #include "ppapi/proxy/ppapi_proxy_export.h" | 16 #include "ppapi/proxy/ppapi_proxy_export.h" |
16 #include "ppapi/shared_impl/file_io_state_manager.h" | 17 #include "ppapi/shared_impl/file_io_state_manager.h" |
17 #include "ppapi/shared_impl/resource.h" | 18 #include "ppapi/shared_impl/resource.h" |
18 #include "ppapi/shared_impl/scoped_pp_resource.h" | 19 #include "ppapi/shared_impl/scoped_pp_resource.h" |
19 #include "ppapi/thunk/ppb_file_io_api.h" | 20 #include "ppapi/thunk/ppb_file_io_api.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 | 102 |
102 // Class to perform file query operations across multiple threads. | 103 // Class to perform file query operations across multiple threads. |
103 class QueryOp : public base::RefCountedThreadSafe<QueryOp> { | 104 class QueryOp : public base::RefCountedThreadSafe<QueryOp> { |
104 public: | 105 public: |
105 explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle); | 106 explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle); |
106 | 107 |
107 // Queries the file. Called on the file thread (non-blocking) or the plugin | 108 // Queries the file. Called on the file thread (non-blocking) or the plugin |
108 // thread (blocking). This should not be called when we hold the proxy lock. | 109 // thread (blocking). This should not be called when we hold the proxy lock. |
109 int32_t DoWork(); | 110 int32_t DoWork(); |
110 | 111 |
111 const base::PlatformFileInfo& file_info() const { return file_info_; } | 112 const base::File::Info& file_info() const { return file_info_; } |
112 | 113 |
113 private: | 114 private: |
114 friend class base::RefCountedThreadSafe<QueryOp>; | 115 friend class base::RefCountedThreadSafe<QueryOp>; |
115 ~QueryOp(); | 116 ~QueryOp(); |
116 | 117 |
117 scoped_refptr<FileHandleHolder> file_handle_; | 118 scoped_refptr<FileHandleHolder> file_handle_; |
118 base::PlatformFileInfo file_info_; | 119 base::File::Info file_info_; |
119 }; | 120 }; |
120 | 121 |
121 // Class to perform file read operations across multiple threads. | 122 // Class to perform file read operations across multiple threads. |
122 class ReadOp : public base::RefCountedThreadSafe<ReadOp> { | 123 class ReadOp : public base::RefCountedThreadSafe<ReadOp> { |
123 public: | 124 public: |
124 ReadOp(scoped_refptr<FileHandleHolder> file_handle, | 125 ReadOp(scoped_refptr<FileHandleHolder> file_handle, |
125 int64_t offset, | 126 int64_t offset, |
126 int32_t bytes_to_read); | 127 int32_t bytes_to_read); |
127 | 128 |
128 // Reads the file. Called on the file thread (non-blocking) or the plugin | 129 // Reads the file. Called on the file thread (non-blocking) or the plugin |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 bool check_quota_; | 220 bool check_quota_; |
220 bool called_close_; | 221 bool called_close_; |
221 | 222 |
222 DISALLOW_COPY_AND_ASSIGN(FileIOResource); | 223 DISALLOW_COPY_AND_ASSIGN(FileIOResource); |
223 }; | 224 }; |
224 | 225 |
225 } // namespace proxy | 226 } // namespace proxy |
226 } // namespace ppapi | 227 } // namespace ppapi |
227 | 228 |
228 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 229 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
OLD | NEW |