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

Side by Side Diff: webkit/browser/fileapi/quota/quota_reservation_manager.cc

Issue 61593002: Quota: Implement QuotaBackendImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: build fix 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
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 #include "webkit/browser/fileapi/quota/quota_reservation_manager.h" 5 #include "webkit/browser/fileapi/quota/quota_reservation_manager.h"
6 6
7 #include "webkit/browser/fileapi/quota/quota_reservation.h" 7 #include "webkit/browser/fileapi/quota/quota_reservation.h"
8 #include "webkit/browser/fileapi/quota/quota_reservation_buffer.h" 8 #include "webkit/browser/fileapi/quota/quota_reservation_buffer.h"
9 9
10 namespace fileapi { 10 namespace fileapi {
11 11
12 QuotaReservationManager::QuotaReservationManager(QuotaBackend* backend) 12 QuotaReservationManager::QuotaReservationManager(
13 : backend_(backend), 13 scoped_ptr<QuotaBackend> backend)
14 : backend_(backend.Pass()),
14 weak_ptr_factory_(this) { 15 weak_ptr_factory_(this) {
15 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 16 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
16 } 17 }
17 18
18 QuotaReservationManager::~QuotaReservationManager() { 19 QuotaReservationManager::~QuotaReservationManager() {
19 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 20 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
20 } 21 }
21 22
22 void QuotaReservationManager::ReserveQuota( 23 void QuotaReservationManager::ReserveQuota(
23 const GURL& origin, 24 const GURL& origin,
24 FileSystemType type, 25 FileSystemType type,
25 int64 size, 26 int64 size,
26 const ReserveQuotaCallback& callback) { 27 const ReserveQuotaCallback& callback) {
27 backend_->ReserveQuota(origin, type, size, callback); 28 backend_->ReserveQuota(origin, type, size, callback);
28 } 29 }
29 30
30 void QuotaReservationManager::ReleaseReservedQuota( 31 void QuotaReservationManager::ReleaseReservedQuota(
31 const GURL& origin, 32 const GURL& origin,
32 FileSystemType type, 33 FileSystemType type,
33 int64 size) { 34 int64 size) {
34 backend_->ReleaseReservedQuota(origin, type, size); 35 backend_->ReleaseReservedQuota(origin, type, size);
35 } 36 }
36 37
37 void QuotaReservationManager::CommitQuotaUsage( 38 void QuotaReservationManager::CommitQuotaUsage(
38 const GURL& origin, 39 const GURL& origin,
39 FileSystemType type, 40 FileSystemType type,
40 int64 delta, 41 int64 delta) {
41 const StatusCallback& callback) { 42 backend_->CommitQuotaUsage(origin, type, delta);
42 backend_->CommitQuotaUsage(origin, type, delta, callback);
43 } 43 }
44 44
45 void QuotaReservationManager::IncreaseDirtyCount(const GURL& origin, 45 void QuotaReservationManager::IncrementDirtyCount(const GURL& origin,
46 FileSystemType type) { 46 FileSystemType type) {
47 backend_->IncreaseDirtyCount(origin, type); 47 backend_->IncrementDirtyCount(origin, type);
48 } 48 }
49 49
50 void QuotaReservationManager::DecreaseDirtyCount(const GURL& origin, 50 void QuotaReservationManager::DecrementDirtyCount(const GURL& origin,
51 FileSystemType type) { 51 FileSystemType type) {
52 backend_->DecreaseDirtyCount(origin, type); 52 backend_->DecrementDirtyCount(origin, type);
53 } 53 }
54 54
55 scoped_refptr<QuotaReservationBuffer> 55 scoped_refptr<QuotaReservationBuffer>
56 QuotaReservationManager::GetReservationBuffer( 56 QuotaReservationManager::GetReservationBuffer(
57 const GURL& origin, 57 const GURL& origin,
58 FileSystemType type) { 58 FileSystemType type) {
59 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 59 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
60 QuotaReservationBuffer** buffer = 60 QuotaReservationBuffer** buffer =
61 &reservation_buffers_[std::make_pair(origin, type)]; 61 &reservation_buffers_[std::make_pair(origin, type)];
62 if (!*buffer) { 62 if (!*buffer) {
(...skipping 12 matching lines...) Expand all
75 reservation_buffers_.erase(key); 75 reservation_buffers_.erase(key);
76 } 76 }
77 77
78 scoped_refptr<QuotaReservation> QuotaReservationManager::CreateReservation( 78 scoped_refptr<QuotaReservation> QuotaReservationManager::CreateReservation(
79 const GURL& origin, 79 const GURL& origin,
80 FileSystemType type) { 80 FileSystemType type) {
81 return GetReservationBuffer(origin, type)->CreateReservation();; 81 return GetReservationBuffer(origin, type)->CreateReservation();;
82 } 82 }
83 83
84 } // namespace fileapi 84 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698