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

Side by Side Diff: storage/browser/fileapi/quota/open_file_handle_context.cc

Issue 442383002: Move storage-related files from webkit/ to new top-level directory storage/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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
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/open_file_handle_context.h" 5 #include "storage/browser/fileapi/quota/open_file_handle_context.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "webkit/browser/fileapi/quota/quota_reservation_buffer.h" 8 #include "storage/browser/fileapi/quota/quota_reservation_buffer.h"
9 9
10 namespace fileapi { 10 namespace storage {
11 11
12 OpenFileHandleContext::OpenFileHandleContext( 12 OpenFileHandleContext::OpenFileHandleContext(
13 const base::FilePath& platform_path, 13 const base::FilePath& platform_path,
14 QuotaReservationBuffer* reservation_buffer) 14 QuotaReservationBuffer* reservation_buffer)
15 : initial_file_size_(0), 15 : initial_file_size_(0),
16 maximum_written_offset_(0), 16 maximum_written_offset_(0),
17 append_mode_write_amount_(0), 17 append_mode_write_amount_(0),
18 platform_path_(platform_path), 18 platform_path_(platform_path),
19 reservation_buffer_(reservation_buffer) { 19 reservation_buffer_(reservation_buffer) {
20 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 20 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 base::GetFileSize(platform_path_, &file_size); 57 base::GetFileSize(platform_path_, &file_size);
58 int64 usage_delta = file_size - initial_file_size_; 58 int64 usage_delta = file_size - initial_file_size_;
59 59
60 // |reserved_quota_consumption| may be greater than the recorded file growth 60 // |reserved_quota_consumption| may be greater than the recorded file growth
61 // when a plugin crashed before reporting its consumption. 61 // when a plugin crashed before reporting its consumption.
62 // In this case, the reserved quota for the plugin should be handled as 62 // In this case, the reserved quota for the plugin should be handled as
63 // consumed quota. 63 // consumed quota.
64 int64 reserved_quota_consumption = 64 int64 reserved_quota_consumption =
65 std::max(GetEstimatedFileSize(), file_size) - initial_file_size_; 65 std::max(GetEstimatedFileSize(), file_size) - initial_file_size_;
66 66
67 reservation_buffer_->CommitFileGrowth( 67 reservation_buffer_->CommitFileGrowth(reserved_quota_consumption,
68 reserved_quota_consumption, usage_delta); 68 usage_delta);
69 reservation_buffer_->DetachOpenFileHandleContext(this); 69 reservation_buffer_->DetachOpenFileHandleContext(this);
70 } 70 }
71 71
72 } // namespace fileapi 72 } // namespace storage
OLDNEW
« no previous file with comments | « storage/browser/fileapi/quota/open_file_handle_context.h ('k') | storage/browser/fileapi/quota/quota_backend_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698