OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "url/gurl.h" | 16 #include "url/gurl.h" |
17 #include "webkit/browser/webkit_storage_browser_export.h" | 17 #include "webkit/browser/storage_export.h" |
18 #include "webkit/common/fileapi/file_system_types.h" | 18 #include "webkit/common/fileapi/file_system_types.h" |
19 | 19 |
20 namespace content { | 20 namespace content { |
21 class QuotaReservationManagerTest; | 21 class QuotaReservationManagerTest; |
22 } | 22 } |
23 | 23 |
24 namespace storage { | 24 namespace storage { |
25 | 25 |
26 class QuotaReservation; | 26 class QuotaReservation; |
27 class QuotaReservationBuffer; | 27 class QuotaReservationBuffer; |
28 class OpenFileHandle; | 28 class OpenFileHandle; |
29 class OpenFileHandleContext; | 29 class OpenFileHandleContext; |
30 | 30 |
31 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager { | 31 class STORAGE_EXPORT QuotaReservationManager { |
32 public: | 32 public: |
33 // Callback for ReserveQuota. When this callback returns false, ReserveQuota | 33 // Callback for ReserveQuota. When this callback returns false, ReserveQuota |
34 // operation should be reverted. | 34 // operation should be reverted. |
35 typedef base::Callback<bool(base::File::Error error, int64 delta)> | 35 typedef base::Callback<bool(base::File::Error error, int64 delta)> |
36 ReserveQuotaCallback; | 36 ReserveQuotaCallback; |
37 | 37 |
38 // An abstraction of backing quota system. | 38 // An abstraction of backing quota system. |
39 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaBackend { | 39 class STORAGE_EXPORT QuotaBackend { |
40 public: | 40 public: |
41 QuotaBackend() {} | 41 QuotaBackend() {} |
42 virtual ~QuotaBackend() {} | 42 virtual ~QuotaBackend() {} |
43 | 43 |
44 // Reserves or reclaims |delta| of quota for |origin| and |type| pair. | 44 // Reserves or reclaims |delta| of quota for |origin| and |type| pair. |
45 // Reserved quota should be counted as usage, but it should be on-memory | 45 // Reserved quota should be counted as usage, but it should be on-memory |
46 // and be cleared by a browser restart. | 46 // and be cleared by a browser restart. |
47 // Invokes |callback| upon completion with an error code. | 47 // Invokes |callback| upon completion with an error code. |
48 // |callback| should return false if it can't accept the reservation, in | 48 // |callback| should return false if it can't accept the reservation, in |
49 // that case, the backend should roll back the reservation. | 49 // that case, the backend should roll back the reservation. |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 base::SequenceChecker sequence_checker_; | 119 base::SequenceChecker sequence_checker_; |
120 base::WeakPtrFactory<QuotaReservationManager> weak_ptr_factory_; | 120 base::WeakPtrFactory<QuotaReservationManager> weak_ptr_factory_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(QuotaReservationManager); | 122 DISALLOW_COPY_AND_ASSIGN(QuotaReservationManager); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace storage | 125 } // namespace storage |
126 | 126 |
127 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ | 127 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ |
OLD | NEW |