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 WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ | 5 #ifndef WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ |
6 #define WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ | 6 #define WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ |
7 | 7 |
8 #include <deque> | 8 #include <deque> |
9 | 9 |
10 #include "base/file_util_proxy.h" | 10 #include "base/file_util_proxy.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 typedef base::FileUtilProxy::StatusCallback StatusCallback; | 28 typedef base::FileUtilProxy::StatusCallback StatusCallback; |
29 | 29 |
30 QuotaFileIO(PluginInstance* instance, | 30 QuotaFileIO(PluginInstance* instance, |
31 base::PlatformFile file, | 31 base::PlatformFile file, |
32 const GURL& path_url, | 32 const GURL& path_url, |
33 PP_FileSystemType type); | 33 PP_FileSystemType type); |
34 ~QuotaFileIO(); | 34 ~QuotaFileIO(); |
35 | 35 |
36 // Performs write or setlength operation with quota checks. | 36 // Performs write or setlength operation with quota checks. |
37 // Returns true when the operation is successfully dispatched. | 37 // Returns true when the operation is successfully dispatched. |
| 38 // |bytes_to_write| must be geater than zero. |
38 // |callback| will be dispatched when the operation completes. | 39 // |callback| will be dispatched when the operation completes. |
39 // Otherwise it returns false and |callback| will not be dispatched. | 40 // Otherwise it returns false and |callback| will not be dispatched. |
40 // |callback| will not be dispatched either when this instance is | 41 // |callback| will not be dispatched either when this instance is |
41 // destroyed before the operation completes. | 42 // destroyed before the operation completes. |
42 // SetLength/WillSetLength cannot be called while there're any inflight | 43 // SetLength/WillSetLength cannot be called while there're any inflight |
43 // operations. For Write/WillWrite it is guaranteed that |callback| are | 44 // operations. For Write/WillWrite it is guaranteed that |callback| are |
44 // always dispatched in the same order as Write being called. | 45 // always dispatched in the same order as Write being called. |
45 bool Write(int64_t offset, | 46 bool Write(int64_t offset, |
46 const char* buffer, | 47 const char* buffer, |
47 int32_t bytes_to_write, | 48 int32_t bytes_to_write, |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 int inflight_operations_; | 99 int inflight_operations_; |
99 | 100 |
100 base::ScopedCallbackFactory<QuotaFileIO> callback_factory_; | 101 base::ScopedCallbackFactory<QuotaFileIO> callback_factory_; |
101 DISALLOW_COPY_AND_ASSIGN(QuotaFileIO); | 102 DISALLOW_COPY_AND_ASSIGN(QuotaFileIO); |
102 }; | 103 }; |
103 | 104 |
104 } // namespace ppapi | 105 } // namespace ppapi |
105 } // namespace webkit | 106 } // namespace webkit |
106 | 107 |
107 #endif // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ | 108 #endif // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ |
OLD | NEW |