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

Side by Side Diff: webkit/browser/fileapi/quota/quota_backend_impl.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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_
6 #define WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/memory/weak_ptr.h"
10 #include "webkit/browser/fileapi/quota/quota_reservation_manager.h"
11 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h"
12 #include "webkit/browser/webkit_storage_browser_export.h"
13 #include "webkit/common/quota/quota_status_code.h"
14
15 namespace base {
16 class SequencedTaskRunner;
17 }
18
19 namespace quota {
20 class QuotaManagerProxy;
21 }
22
23 namespace fileapi {
24
25 class FileSystemUsageCache;
26 class ObfuscatedFileUtil;
27
28 // An instance of this class is owned by QuotaReservationManager.
29 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaBackendImpl
30 : public QuotaReservationManager::QuotaBackend {
31 public:
32 typedef QuotaReservationManager::StatusCallback
33 StatusCallback;
34 typedef QuotaReservationManager::ReserveQuotaCallback
35 ReserveQuotaCallback;
kinuko 2013/11/07 10:10:09 nit: I think we can omit these typedefs in a subcl
nhiroki 2013/11/08 00:12:05 QuotaReservationManager is not a superclass of Quo
36
37 QuotaBackendImpl(base::SequencedTaskRunner* file_task_runner,
38 ObfuscatedFileUtil* obfuscated_file_util,
39 FileSystemUsageCache* file_system_usage_cache,
40 quota::QuotaManagerProxy* quota_manager_proxy);
41 virtual ~QuotaBackendImpl();
42
43 // QuotaReservationManager::QuotaBackend overrides.
44 virtual void ReserveQuota(
45 const GURL& origin,
46 FileSystemType type,
47 int64 delta,
48 const ReserveQuotaCallback& callback) OVERRIDE;
49 virtual void ReleaseReservedQuota(
50 const GURL& origin,
51 FileSystemType type,
52 int64 size) OVERRIDE;
53 virtual void CommitQuotaUsage(
54 const GURL& origin,
55 FileSystemType type,
56 int64 delta,
57 const StatusCallback& callback) OVERRIDE;
58 virtual void IncrementDirtyCount(
59 const GURL& origin,
60 FileSystemType type) OVERRIDE;
61 virtual void DecrementDirtyCount(
62 const GURL& origin,
63 FileSystemType type) OVERRIDE;
64
65 private:
66 friend class QuotaBackendImplTest;
67
68 struct QuotaReservationInfo {
69 QuotaReservationInfo(const GURL& origin, FileSystemType type, int64 delta);
70 ~QuotaReservationInfo();
71
72 GURL origin;
73 FileSystemType type;
74 int64 delta;
75 };
76
77 void DidGetUsageAndQuotaForReserveQuota(
78 const QuotaReservationInfo& info,
79 const ReserveQuotaCallback& callback,
80 quota::QuotaStatusCode status,
81 int64 usage,
82 int64 quota);
83 void DidGetUsageAndQuotaForCommitQuotaUsage(
84 const QuotaReservationInfo& info,
85 const StatusCallback& callback,
86 quota::QuotaStatusCode status,
87 int64 usage,
88 int64 quota);
89
90 void ReserveQuotaInternal(
91 const QuotaReservationInfo& info);
92 base::PlatformFileError CommitQuotaUsageInternal(
93 const QuotaReservationInfo& info);
94 base::PlatformFileError GetUsageCachePath(
95 const GURL& origin,
96 FileSystemType type,
97 base::FilePath* usage_file_path);
98
99 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
100
101 // Owned by SandboxFileSystemBackendDelegate.
102 ObfuscatedFileUtil* obfuscated_file_util_;
103 FileSystemUsageCache* file_system_usage_cache_;
104
105 scoped_refptr<quota::QuotaManagerProxy> quota_manager_proxy_;
106
107 base::WeakPtrFactory<QuotaBackendImpl> weak_ptr_factory_;
108
109 DISALLOW_COPY_AND_ASSIGN(QuotaBackendImpl);
110 };
111
112 } // namespace fileapi
113
114 #endif // WEBKIT_BROWSER_FILEAPI_QUOTA_QUOTA_BACKEND_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698