| 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..07beacc327763f82cf2cfa30eef6df8152e09790 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"
|
| @@ -25,13 +26,17 @@ 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.
|
| @@ -52,23 +57,18 @@ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager {
|
| // Invokes |callback| upon completion with an error code.
|
| virtual void CommitQuotaUsage(const GURL& origin,
|
| FileSystemType type,
|
| - int64 delta,
|
| - const StatusCallback& callback) = 0;
|
| + int64 delta) = 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);
|
| };
|
|
|
| - explicit QuotaReservationManager(QuotaBackend* backend);
|
| + explicit QuotaReservationManager(scoped_ptr<QuotaBackend> backend);
|
| ~QuotaReservationManager();
|
|
|
| // The entry point of the quota reservation. Creates new reservation object
|
| @@ -83,6 +83,7 @@ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager {
|
|
|
| friend class QuotaReservation;
|
| friend class QuotaReservationBuffer;
|
| + friend class QuotaReservationManagerTest;
|
|
|
| void ReserveQuota(const GURL& origin,
|
| FileSystemType type,
|
| @@ -95,20 +96,17 @@ class WEBKIT_STORAGE_BROWSER_EXPORT QuotaReservationManager {
|
|
|
| void CommitQuotaUsage(const GURL& origin,
|
| FileSystemType type,
|
| - int64 delta,
|
| - const StatusCallback& callback);
|
| + int64 delta);
|
|
|
| - 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.
|
|
|