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_H_ | 5 #ifndef WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ |
6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ | 6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/memory/ref_counted.h" | 11 #include "base/memory/ref_counted.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "webkit/browser/fileapi/quota/quota_reservation_manager.h" | 13 #include "storage/browser/fileapi/quota/quota_reservation_manager.h" |
14 #include "webkit/browser/webkit_storage_browser_export.h" | 14 #include "storage/common/storage_export.h" |
15 #include "webkit/common/fileapi/file_system_types.h" | 15 #include "storage/common/fileapi/file_system_types.h" |
16 | 16 |
17 class GURL; | 17 class GURL; |
18 | 18 |
19 namespace fileapi { | 19 namespace storage { |
20 | 20 |
21 class QuotaReservationBuffer; | 21 class QuotaReservationBuffer; |
22 class OpenFileHandle; | 22 class OpenFileHandle; |
23 | 23 |
24 // Represents a unit of quota reservation. | 24 // Represents a unit of quota reservation. |
25 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservation | 25 class STORAGE_EXPORT QuotaReservation |
26 : public base::RefCounted<QuotaReservation> { | 26 : public base::RefCounted<QuotaReservation> { |
27 public: | 27 public: |
28 typedef base::Callback<void(base::File::Error error)> StatusCallback; | 28 typedef base::Callback<void(base::File::Error error)> StatusCallback; |
29 | 29 |
30 // Reclaims unused quota and reserves another |size| of quota. So that the | 30 // Reclaims unused quota and reserves another |size| of quota. So that the |
31 // resulting new |remaining_quota_| will be same as |size| as far as available | 31 // resulting new |remaining_quota_| will be same as |size| as far as available |
32 // space is enough. |remaining_quota_| may be less than |size| if there is | 32 // space is enough. |remaining_quota_| may be less than |size| if there is |
33 // not enough space available. | 33 // not enough space available. |
34 // Invokes |callback| upon completion. | 34 // Invokes |callback| upon completion. |
35 void RefreshReservation(int64 size, const StatusCallback& callback); | 35 void RefreshReservation(int64 size, const StatusCallback& callback); |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 int64 remaining_quota_; | 83 int64 remaining_quota_; |
84 | 84 |
85 scoped_refptr<QuotaReservationBuffer> reservation_buffer_; | 85 scoped_refptr<QuotaReservationBuffer> reservation_buffer_; |
86 | 86 |
87 base::SequenceChecker sequence_checker_; | 87 base::SequenceChecker sequence_checker_; |
88 base::WeakPtrFactory<QuotaReservation> weak_ptr_factory_; | 88 base::WeakPtrFactory<QuotaReservation> weak_ptr_factory_; |
89 | 89 |
90 DISALLOW_COPY_AND_ASSIGN(QuotaReservation); | 90 DISALLOW_COPY_AND_ASSIGN(QuotaReservation); |
91 }; | 91 }; |
92 | 92 |
93 } // namespace fileapi | 93 } // namespace storage |
94 | 94 |
95 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ | 95 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_H_ |
OLD | NEW |