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

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

Issue 131043002: [Pepper] Use platform path for QuotaReservation::GetOpenFileHandle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: suppress DCHECK failure Created 6 years, 11 months 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
« no previous file with comments | « content/browser/renderer_host/pepper/quota_reservation_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_buffer.h" 5 #include "webkit/browser/fileapi/quota/quota_reservation_buffer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "webkit/browser/fileapi/quota/open_file_handle.h" 8 #include "webkit/browser/fileapi/quota/open_file_handle.h"
9 #include "webkit/browser/fileapi/quota/open_file_handle_context.h" 9 #include "webkit/browser/fileapi/quota/open_file_handle_context.h"
10 #include "webkit/browser/fileapi/quota/quota_reservation.h" 10 #include "webkit/browser/fileapi/quota/quota_reservation.h"
(...skipping 28 matching lines...) Expand all
39 return make_scoped_ptr(new OpenFileHandle(reservation, *open_file)); 39 return make_scoped_ptr(new OpenFileHandle(reservation, *open_file));
40 } 40 }
41 41
42 void QuotaReservationBuffer::CommitFileGrowth(int64 quota_consumption, 42 void QuotaReservationBuffer::CommitFileGrowth(int64 quota_consumption,
43 int64 usage_delta) { 43 int64 usage_delta) {
44 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 44 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
45 if (!reservation_manager_) 45 if (!reservation_manager_)
46 return; 46 return;
47 reservation_manager_->CommitQuotaUsage(origin_, type_, usage_delta); 47 reservation_manager_->CommitQuotaUsage(origin_, type_, usage_delta);
48 48
49 DCHECK_LE(quota_consumption, reserved_quota_);
50 if (quota_consumption > 0) { 49 if (quota_consumption > 0) {
50 if (quota_consumption > reserved_quota_) {
51 LOG(ERROR) << "Detected over consumption of the storage quota beyond its"
52 << " reservation";
53 quota_consumption = reserved_quota_;
54 }
55
51 reserved_quota_ -= quota_consumption; 56 reserved_quota_ -= quota_consumption;
52 reservation_manager_->ReleaseReservedQuota( 57 reservation_manager_->ReleaseReservedQuota(
53 origin_, type_, quota_consumption); 58 origin_, type_, quota_consumption);
54 } 59 }
55 } 60 }
56 61
57 void QuotaReservationBuffer::DetachOpenFileHandleContext( 62 void QuotaReservationBuffer::DetachOpenFileHandleContext(
58 OpenFileHandleContext* open_file) { 63 OpenFileHandleContext* open_file) {
59 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 64 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
60 DCHECK_EQ(open_file, open_files_[open_file->platform_path()]); 65 DCHECK_EQ(open_file, open_files_[open_file->platform_path()]);
(...skipping 30 matching lines...) Expand all
91 DCHECK(origin.is_valid()); 96 DCHECK(origin.is_valid());
92 if (error == base::PLATFORM_FILE_OK && reservation_manager) { 97 if (error == base::PLATFORM_FILE_OK && reservation_manager) {
93 reservation_manager->DecrementDirtyCount(origin, type); 98 reservation_manager->DecrementDirtyCount(origin, type);
94 return true; 99 return true;
95 } 100 }
96 return false; 101 return false;
97 } 102 }
98 103
99 104
100 } // namespace fileapi 105 } // namespace fileapi
OLDNEW
« no previous file with comments | « content/browser/renderer_host/pepper/quota_reservation_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698