| 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/webkit_storage_browser_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 { |
| 21 class QuotaReservationManagerTest; |
| 22 } |
| 23 |
| 20 namespace fileapi { | 24 namespace fileapi { |
| 21 | 25 |
| 22 class QuotaReservation; | 26 class QuotaReservation; |
| 23 class QuotaReservationBuffer; | 27 class QuotaReservationBuffer; |
| 24 class OpenFileHandle; | 28 class OpenFileHandle; |
| 25 class OpenFileHandleContext; | 29 class OpenFileHandleContext; |
| 26 | 30 |
| 27 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager { | 31 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager { |
| 28 public: | 32 public: |
| 29 // Callback for ReserveQuota. When this callback returns false, ReserveQuota | 33 // Callback for ReserveQuota. When this callback returns false, ReserveQuota |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 scoped_refptr<QuotaReservation> CreateReservation( | 80 scoped_refptr<QuotaReservation> CreateReservation( |
| 77 const GURL& origin, | 81 const GURL& origin, |
| 78 FileSystemType type); | 82 FileSystemType type); |
| 79 | 83 |
| 80 private: | 84 private: |
| 81 typedef std::map<std::pair<GURL, FileSystemType>, QuotaReservationBuffer*> | 85 typedef std::map<std::pair<GURL, FileSystemType>, QuotaReservationBuffer*> |
| 82 ReservationBufferByOriginAndType; | 86 ReservationBufferByOriginAndType; |
| 83 | 87 |
| 84 friend class QuotaReservation; | 88 friend class QuotaReservation; |
| 85 friend class QuotaReservationBuffer; | 89 friend class QuotaReservationBuffer; |
| 86 friend class QuotaReservationManagerTest; | 90 friend class content::QuotaReservationManagerTest; |
| 87 | 91 |
| 88 void ReserveQuota(const GURL& origin, | 92 void ReserveQuota(const GURL& origin, |
| 89 FileSystemType type, | 93 FileSystemType type, |
| 90 int64 delta, | 94 int64 delta, |
| 91 const ReserveQuotaCallback& callback); | 95 const ReserveQuotaCallback& callback); |
| 92 | 96 |
| 93 void ReleaseReservedQuota(const GURL& origin, | 97 void ReleaseReservedQuota(const GURL& origin, |
| 94 FileSystemType type, | 98 FileSystemType type, |
| 95 int64 size); | 99 int64 size); |
| 96 | 100 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 114 | 118 |
| 115 base::SequenceChecker sequence_checker_; | 119 base::SequenceChecker sequence_checker_; |
| 116 base::WeakPtrFactory<QuotaReservationManager> weak_ptr_factory_; | 120 base::WeakPtrFactory<QuotaReservationManager> weak_ptr_factory_; |
| 117 | 121 |
| 118 DISALLOW_COPY_AND_ASSIGN(QuotaReservationManager); | 122 DISALLOW_COPY_AND_ASSIGN(QuotaReservationManager); |
| 119 }; | 123 }; |
| 120 | 124 |
| 121 } // namespace fileapi | 125 } // namespace fileapi |
| 122 | 126 |
| 123 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ | 127 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_ |
| OLD | NEW |