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 CONTENT_BROWSER_RENDERER_HOST_PEPPER_QUOTA_RESERVATION_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_PEPPER_QUOTA_RESERVATION_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_QUOTA_RESERVATION_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_PEPPER_QUOTA_RESERVATION_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 // Closes the file opened by OpenFile with the given id. | 48 // Closes the file opened by OpenFile with the given id. |
49 void CloseFile(int32_t id, int64_t max_written_offset); | 49 void CloseFile(int32_t id, int64_t max_written_offset); |
50 // Refreshes the quota reservation to a new amount. A map that associates file | 50 // Refreshes the quota reservation to a new amount. A map that associates file |
51 // ids with maximum written offsets is provided as input. The callback will | 51 // ids with maximum written offsets is provided as input. The callback will |
52 // receive a similar map with the updated file sizes. | 52 // receive a similar map with the updated file sizes. |
53 typedef std::map<int32_t, int64_t> OffsetMap; | 53 typedef std::map<int32_t, int64_t> OffsetMap; |
54 typedef base::Callback<void(int64_t, const OffsetMap&)> ReserveQuotaCallback; | 54 typedef base::Callback<void(int64_t, const OffsetMap&)> ReserveQuotaCallback; |
55 void ReserveQuota(int64_t amount, | 55 void ReserveQuota(int64_t amount, |
56 const OffsetMap& max_written_offsets, | 56 const OffsetMap& max_written_offsets, |
57 const ReserveQuotaCallback& callback); | 57 const ReserveQuotaCallback& callback); |
58 | |
59 // Notifies underlying QuotaReservation of the associated client crashed, and | |
60 // the reserved quota is no longer tracable. | |
bbudge
2014/01/07 14:48:18
Comment suggestion:
// Notifies underlying QuotaRe
tzik
2014/01/08 11:59:29
Done.
| |
61 void OnClientCrash(); | |
62 | |
58 private: | 63 private: |
59 friend class base::RefCountedThreadSafe<QuotaReservation, | 64 friend class base::RefCountedThreadSafe<QuotaReservation, |
60 QuotaReservationDeleter>; | 65 QuotaReservationDeleter>; |
61 friend class base::DeleteHelper<QuotaReservation>; | 66 friend class base::DeleteHelper<QuotaReservation>; |
62 friend struct QuotaReservationDeleter; | 67 friend struct QuotaReservationDeleter; |
63 friend class QuotaReservationTest; | 68 friend class QuotaReservationTest; |
64 | 69 |
65 QuotaReservation( | 70 QuotaReservation( |
66 scoped_refptr<fileapi::FileSystemContext> file_system_context, | 71 scoped_refptr<fileapi::FileSystemContext> file_system_context, |
67 const GURL& origin_url, | 72 const GURL& origin_url, |
(...skipping 23 matching lines...) Expand all Loading... | |
91 | 96 |
92 struct QuotaReservationDeleter { | 97 struct QuotaReservationDeleter { |
93 static void Destruct(const QuotaReservation* quota_reservation) { | 98 static void Destruct(const QuotaReservation* quota_reservation) { |
94 quota_reservation->DeleteOnCorrectThread(); | 99 quota_reservation->DeleteOnCorrectThread(); |
95 } | 100 } |
96 }; | 101 }; |
97 | 102 |
98 } // namespace content | 103 } // namespace content |
99 | 104 |
100 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_QUOTA_RESERVATION_H_ | 105 #endif // CONTENT_BROWSER_RENDERER_HOST_PEPPER_QUOTA_RESERVATION_H_ |
OLD | NEW |