Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(701)

Unified Diff: webkit/browser/fileapi/quota/quota_reservation_manager.h

Issue 61593002: Quota: Implement QuotaBackendImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix build and test Created 7 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/browser/fileapi/quota/quota_reservation_manager.h
diff --git a/webkit/browser/fileapi/quota/quota_reservation_manager.h b/webkit/browser/fileapi/quota/quota_reservation_manager.h
index 2e3ae9358998baa42d48c96f635a514522db9660..d4c58ac9ab641bb28b288134db940bb2be860e2c 100644
--- a/webkit/browser/fileapi/quota/quota_reservation_manager.h
+++ b/webkit/browser/fileapi/quota/quota_reservation_manager.h
@@ -6,6 +6,7 @@
#define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_RESERVATION_MANAGER_H_
#include <map>
+#include <utility>
#include "base/basictypes.h"
#include "base/callback_forward.h"
@@ -26,12 +27,18 @@ class OpenFileHandleContext;
class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager {
public:
typedef base::Callback<void(base::PlatformFileError error)> StatusCallback;
+
+ // Callback for ReserveQuota. When this callback returns false, ReserveQuota
+ // operation should be reverted.
typedef base::Callback<bool(base::PlatformFileError error)>
ReserveQuotaCallback;
// An abstraction of backing quota system.
- class QuotaBackend {
+ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaBackend {
public:
+ QuotaBackend() {}
+ virtual ~QuotaBackend() {}
+
// Reserves or reclaims |delta| of quota for |origin| and |type| pair.
// Reserved quota should be counted as usage, but it should be on-memory
// and be cleared by a browser restart.
@@ -55,15 +62,11 @@ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager {
int64 delta,
const StatusCallback& callback) = 0;
- virtual void IncreaseDirtyCount(const GURL& origin,
+ virtual void IncrementDirtyCount(const GURL& origin,
FileSystemType type) = 0;
- virtual void DecreaseDirtyCount(const GURL& origin,
+ virtual void DecrementDirtyCount(const GURL& origin,
FileSystemType type) = 0;
- protected:
- QuotaBackend() {}
- virtual ~QuotaBackend() {}
-
private:
DISALLOW_COPY_AND_ASSIGN(QuotaBackend);
};
@@ -98,17 +101,15 @@ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager {
int64 delta,
const StatusCallback& callback);
- void IncreaseDirtyCount(const GURL& origin, FileSystemType type);
- void DecreaseDirtyCount(const GURL& origin, FileSystemType type);
+ void IncrementDirtyCount(const GURL& origin, FileSystemType type);
+ void DecrementDirtyCount(const GURL& origin, FileSystemType type);
scoped_refptr<QuotaReservationBuffer> GetReservationBuffer(
const GURL& origin,
FileSystemType type);
void ReleaseReservationBuffer(QuotaReservationBuffer* reservation_pool);
-
- // Not owned. |backend_| should outlive QuotaReservationManager
- QuotaBackend* backend_;
+ scoped_ptr<QuotaBackend> backend_;
// Not owned. The destructor of ReservationBuffer should erase itself from
// |reservation_buffers_| by calling ReleaseReservationBuffer.

Powered by Google App Engine
This is Rietveld 408576698