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

Unified Diff: webkit/browser/fileapi/quota/open_file_handle_context.cc

Issue 140833003: [Pepper][FileAPI] Interface clean up (3/6) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment 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 side-by-side diff with in-line comments
Download patch
Index: webkit/browser/fileapi/quota/open_file_handle_context.cc
diff --git a/webkit/browser/fileapi/quota/open_file_handle_context.cc b/webkit/browser/fileapi/quota/open_file_handle_context.cc
index 0928fff7ee299384e6c8c3e1771495cfaa7e0c09..82cec2a9c4bb7b0db8d3cc13942b5e38f09ed1f2 100644
--- a/webkit/browser/fileapi/quota/open_file_handle_context.cc
+++ b/webkit/browser/fileapi/quota/open_file_handle_context.cc
@@ -22,19 +22,19 @@ OpenFileHandleContext::OpenFileHandleContext(
maximum_written_offset_ = initial_file_size_;
}
-void OpenFileHandleContext::UpdateMaxWrittenOffset(
- int64 offset,
- int64* new_file_size,
- int64* growth) {
+int64 OpenFileHandleContext::UpdateMaxWrittenOffset(int64 offset) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
- if (offset > maximum_written_offset_) {
- *growth = offset - maximum_written_offset_;
- maximum_written_offset_ = offset;
- } else {
- *growth = 0;
- }
-
- *new_file_size = maximum_written_offset_;
+ if (offset <= maximum_written_offset_)
+ return 0;
+
+ int64 growth = offset - maximum_written_offset_;
+ maximum_written_offset_ = offset;
+ return growth;
+}
+
+int64 OpenFileHandleContext::GetEstimatedFileSize() const {
+ DCHECK(sequence_checker_.CalledOnValidSequencedThread());
+ return maximum_written_offset_;
}
OpenFileHandleContext::~OpenFileHandleContext() {
@@ -51,7 +51,7 @@ OpenFileHandleContext::~OpenFileHandleContext() {
// In this case, the reserved quota for the plugin should be handled as
// consumed quota.
int64 quota_consumption =
- std::max(maximum_written_offset_, file_size) - initial_file_size_;
+ std::max(GetEstimatedFileSize(), file_size) - initial_file_size_;
reservation_buffer_->CommitFileGrowth(quota_consumption, usage_delta);
reservation_buffer_->DetachOpenFileHandleContext(this);

Powered by Google App Engine
This is Rietveld 408576698