| 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/callback.h" |
| 10 #include "base/file_util_proxy.h" | 11 #include "base/file_util_proxy.h" |
| 11 #include "base/memory/scoped_callback_factory.h" | |
| 12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
| 13 #include "base/platform_file.h" | 13 #include "base/platform_file.h" |
| 14 #include "googleurl/src/gurl.h" | 14 #include "googleurl/src/gurl.h" |
| 15 #include "ppapi/c/pp_file_info.h" | 15 #include "ppapi/c/pp_file_info.h" |
| 16 #include "ppapi/c/pp_instance.h" | 16 #include "ppapi/c/pp_instance.h" |
| 17 #include "webkit/quota/quota_types.h" | 17 #include "webkit/quota/quota_types.h" |
| 18 | 18 |
| 19 namespace webkit { | 19 namespace webkit { |
| 20 namespace ppapi { | 20 namespace ppapi { |
| 21 | 21 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 41 // |callback| will be dispatched when the operation completes. | 41 // |callback| will be dispatched when the operation completes. |
| 42 // Otherwise it returns false and |callback| will not be dispatched. | 42 // Otherwise it returns false and |callback| will not be dispatched. |
| 43 // |callback| will not be dispatched either when this instance is | 43 // |callback| will not be dispatched either when this instance is |
| 44 // destroyed before the operation completes. | 44 // destroyed before the operation completes. |
| 45 // SetLength/WillSetLength cannot be called while there're any inflight | 45 // SetLength/WillSetLength cannot be called while there're any inflight |
| 46 // operations. For Write/WillWrite it is guaranteed that |callback| are | 46 // operations. For Write/WillWrite it is guaranteed that |callback| are |
| 47 // always dispatched in the same order as Write being called. | 47 // always dispatched in the same order as Write being called. |
| 48 bool Write(int64_t offset, | 48 bool Write(int64_t offset, |
| 49 const char* buffer, | 49 const char* buffer, |
| 50 int32_t bytes_to_write, | 50 int32_t bytes_to_write, |
| 51 WriteCallback* callback); | 51 const WriteCallback& callback); |
| 52 bool WillWrite(int64_t offset, | 52 bool WillWrite(int64_t offset, |
| 53 int32_t bytes_to_write, | 53 int32_t bytes_to_write, |
| 54 WriteCallback* callback); | 54 const WriteCallback& callback); |
| 55 | 55 |
| 56 bool SetLength(int64_t length, StatusCallback* callback); | 56 bool SetLength(int64_t length, const StatusCallback& callback); |
| 57 bool WillSetLength(int64_t length, StatusCallback* callback); | 57 bool WillSetLength(int64_t length, const StatusCallback& callback); |
| 58 | 58 |
| 59 // Returns the plugin delegate or NULL if the resource has outlived the | 59 // Returns the plugin delegate or NULL if the resource has outlived the |
| 60 // instance. | 60 // instance. |
| 61 PluginDelegate* GetPluginDelegate() const; | 61 PluginDelegate* GetPluginDelegate() const; |
| 62 | 62 |
| 63 private: | 63 private: |
| 64 class PendingOperationBase; | 64 class PendingOperationBase; |
| 65 class WriteOperation; | 65 class WriteOperation; |
| 66 class SetLengthOperation; | 66 class SetLengthOperation; |
| 67 | 67 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 97 int64_t cached_available_space_; | 97 int64_t cached_available_space_; |
| 98 | 98 |
| 99 // Quota-related queries and errors occured during inflight quota checks. | 99 // Quota-related queries and errors occured during inflight quota checks. |
| 100 int outstanding_quota_queries_; | 100 int outstanding_quota_queries_; |
| 101 int outstanding_errors_; | 101 int outstanding_errors_; |
| 102 | 102 |
| 103 // For parallel writes bookkeeping. | 103 // For parallel writes bookkeeping. |
| 104 int64_t max_written_offset_; | 104 int64_t max_written_offset_; |
| 105 int inflight_operations_; | 105 int inflight_operations_; |
| 106 | 106 |
| 107 base::ScopedCallbackFactory<QuotaFileIO> callback_factory_; | |
| 108 base::WeakPtrFactory<QuotaFileIO> weak_ptr_factory_; | 107 base::WeakPtrFactory<QuotaFileIO> weak_ptr_factory_; |
| 109 DISALLOW_COPY_AND_ASSIGN(QuotaFileIO); | 108 DISALLOW_COPY_AND_ASSIGN(QuotaFileIO); |
| 110 }; | 109 }; |
| 111 | 110 |
| 112 } // namespace ppapi | 111 } // namespace ppapi |
| 113 } // namespace webkit | 112 } // namespace webkit |
| 114 | 113 |
| 115 #endif // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ | 114 #endif // WEBKIT_PLUGINS_PPAPI_QUOTA_FILE_IO_H_ |
| OLD | NEW |