| 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 "ppapi/c/private/pp_file_handle.h" |
| 10 #include "ppapi/proxy/connection.h" | 11 #include "ppapi/proxy/connection.h" |
| 11 #include "ppapi/proxy/plugin_resource.h" | 12 #include "ppapi/proxy/plugin_resource.h" |
| 12 #include "ppapi/proxy/ppapi_proxy_export.h" | 13 #include "ppapi/proxy/ppapi_proxy_export.h" |
| 13 #include "ppapi/shared_impl/file_io_state_manager.h" | 14 #include "ppapi/shared_impl/file_io_state_manager.h" |
| 14 #include "ppapi/thunk/ppb_file_io_api.h" | 15 #include "ppapi/thunk/ppb_file_io_api.h" |
| 15 | 16 |
| 16 namespace ppapi { | 17 namespace ppapi { |
| 17 | 18 |
| 18 class TrackedCallback; | 19 class TrackedCallback; |
| 19 | 20 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 48 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 49 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 49 virtual int32_t Write(int64_t offset, | 50 virtual int32_t Write(int64_t offset, |
| 50 const char* buffer, | 51 const char* buffer, |
| 51 int32_t bytes_to_write, | 52 int32_t bytes_to_write, |
| 52 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 53 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 53 virtual int32_t SetLength(int64_t length, | 54 virtual int32_t SetLength(int64_t length, |
| 54 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 55 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 55 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE; | 56 virtual int32_t Flush(scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 56 virtual void Close() OVERRIDE; | 57 virtual void Close() OVERRIDE; |
| 57 virtual int32_t GetOSFileDescriptor() OVERRIDE; | 58 virtual int32_t GetOSFileDescriptor() OVERRIDE; |
| 59 virtual int32_t GetOSFileHandle( |
| 60 PP_FileHandle* handle, |
| 61 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 58 virtual int32_t WillWrite(int64_t offset, | 62 virtual int32_t WillWrite(int64_t offset, |
| 59 int32_t bytes_to_write, | 63 int32_t bytes_to_write, |
| 60 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 64 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 61 virtual int32_t WillSetLength( | 65 virtual int32_t WillSetLength( |
| 62 int64_t length, | 66 int64_t length, |
| 63 scoped_refptr<TrackedCallback> callback) OVERRIDE; | 67 scoped_refptr<TrackedCallback> callback) OVERRIDE; |
| 64 | 68 |
| 65 private: | 69 private: |
| 66 int32_t ReadValidated(int64_t offset, | 70 int32_t ReadValidated(int64_t offset, |
| 67 int32_t bytes_to_read, | 71 int32_t bytes_to_read, |
| 68 const PP_ArrayOutput& array_output, | 72 const PP_ArrayOutput& array_output, |
| 69 scoped_refptr<TrackedCallback> callback); | 73 scoped_refptr<TrackedCallback> callback); |
| 70 | 74 |
| 71 // Handlers of reply messages. Note that all of them have a callback | 75 // Handlers of reply messages. Note that all of them have a callback |
| 72 // parameters bound when call to the host. | 76 // parameters bound when call to the host. |
| 73 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback, | 77 void OnPluginMsgGeneralComplete(scoped_refptr<TrackedCallback> callback, |
| 74 const ResourceMessageReplyParams& params); | 78 const ResourceMessageReplyParams& params); |
| 75 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback, | 79 void OnPluginMsgOpenFileComplete(scoped_refptr<TrackedCallback> callback, |
| 76 const ResourceMessageReplyParams& params); | 80 const ResourceMessageReplyParams& params); |
| 77 void OnPluginMsgQueryComplete(scoped_refptr<TrackedCallback> callback, | 81 void OnPluginMsgQueryComplete(scoped_refptr<TrackedCallback> callback, |
| 78 PP_FileInfo* output_info_, | 82 PP_FileInfo* output_info_, |
| 79 const ResourceMessageReplyParams& params, | 83 const ResourceMessageReplyParams& params, |
| 80 const PP_FileInfo& info); | 84 const PP_FileInfo& info); |
| 81 void OnPluginMsgReadComplete(scoped_refptr<TrackedCallback> callback, | 85 void OnPluginMsgReadComplete(scoped_refptr<TrackedCallback> callback, |
| 82 PP_ArrayOutput array_output, | 86 PP_ArrayOutput array_output, |
| 83 const ResourceMessageReplyParams& params, | 87 const ResourceMessageReplyParams& params, |
| 84 const std::string& data); | 88 const std::string& data); |
| 89 void OnPluginMsgGetOSFileHandleComplete( |
| 90 scoped_refptr<TrackedCallback> callback, |
| 91 PP_FileHandle* output_handle, |
| 92 const ResourceMessageReplyParams& params); |
| 85 | 93 |
| 86 FileIOStateManager state_manager_; | 94 FileIOStateManager state_manager_; |
| 87 | 95 |
| 88 DISALLOW_COPY_AND_ASSIGN(FileIOResource); | 96 DISALLOW_COPY_AND_ASSIGN(FileIOResource); |
| 89 }; | 97 }; |
| 90 | 98 |
| 91 } // namespace proxy | 99 } // namespace proxy |
| 92 } // namespace ppapi | 100 } // namespace ppapi |
| 93 | 101 |
| 94 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ | 102 #endif // PPAPI_PROXY_FILE_IO_RESOURCE_H_ |
| 95 | |
| OLD | NEW |