| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 | 105 |
| 105 // Class to perform file query operations across multiple threads. | 106 // Class to perform file query operations across multiple threads. |
| 106 class QueryOp : public base::RefCountedThreadSafe<QueryOp> { | 107 class QueryOp : public base::RefCountedThreadSafe<QueryOp> { |
| 107 public: | 108 public: |
| 108 explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle); | 109 explicit QueryOp(scoped_refptr<FileHandleHolder> file_handle); |
| 109 | 110 |
| 110 // Queries the file. Called on the file thread (non-blocking) or the plugin | 111 // Queries the file. Called on the file thread (non-blocking) or the plugin |
| 111 // thread (blocking). This should not be called when we hold the proxy lock. | 112 // thread (blocking). This should not be called when we hold the proxy lock. |
| 112 int32_t DoWork(); | 113 int32_t DoWork(); |
| 113 | 114 |
| 114 const base::PlatformFileInfo& file_info() const { return file_info_; } | 115 const base::File::Info& file_info() const { return file_info_; } |
| 115 | 116 |
| 116 private: | 117 private: |
| 117 friend class base::RefCountedThreadSafe<QueryOp>; | 118 friend class base::RefCountedThreadSafe<QueryOp>; |
| 118 ~QueryOp(); | 119 ~QueryOp(); |
| 119 | 120 |
| 120 scoped_refptr<FileHandleHolder> file_handle_; | 121 scoped_refptr<FileHandleHolder> file_handle_; |
| 121 base::PlatformFileInfo file_info_; | 122 base::File::Info file_info_; |
| 122 }; | 123 }; |
| 123 | 124 |
| 124 // Class to perform file read operations across multiple threads. | 125 // Class to perform file read operations across multiple threads. |
| 125 class ReadOp : public base::RefCountedThreadSafe<ReadOp> { | 126 class ReadOp : public base::RefCountedThreadSafe<ReadOp> { |
| 126 public: | 127 public: |
| 127 ReadOp(scoped_refptr<FileHandleHolder> file_handle, | 128 ReadOp(scoped_refptr<FileHandleHolder> file_handle, |
| 128 int64_t offset, | 129 int64_t offset, |
| 129 int32_t bytes_to_read); | 130 int32_t bytes_to_read); |
| 130 | 131 |
| 131 // Reads the file. Called on the file thread (non-blocking) or the plugin | 132 // Reads the file. Called on the file thread (non-blocking) or the plugin |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 bool check_quota_; | 224 bool check_quota_; |
| 224 bool called_close_; | 225 bool called_close_; |
| 225 | 226 |
| 226 DISALLOW_COPY_AND_ASSIGN(FileIOResource); | 227 DISALLOW_COPY_AND_ASSIGN(FileIOResource); |
| 227 }; | 228 }; |
| 228 | 229 |
| 229 } // namespace proxy | 230 } // namespace proxy |
| 230 } // namespace ppapi | 231 } // namespace ppapi |
| 231 | 232 |
| 232 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 233 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
| OLD | NEW |