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

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

Issue 140833003: [Pepper][FileAPI] Interface clean up (3/6) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
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.h" 5 #include "webkit/browser/fileapi/quota/open_file_handle.h"
6 6
7 #include "webkit/browser/fileapi/quota/open_file_handle_context.h" 7 #include "webkit/browser/fileapi/quota/open_file_handle_context.h"
8 #include "webkit/browser/fileapi/quota/quota_reservation.h" 8 #include "webkit/browser/fileapi/quota/quota_reservation.h"
9 9
10 namespace fileapi { 10 namespace fileapi {
11 11
12 OpenFileHandle::~OpenFileHandle() { 12 OpenFileHandle::~OpenFileHandle() {
13 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 13 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
14 } 14 }
15 15
16 int64 OpenFileHandle::UpdateMaxWrittenOffset(int64 offset) { 16 void OpenFileHandle::UpdateMaxWrittenOffset(int64 offset) {
17 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 17 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
18 18
19 int64 new_file_size = 0; 19 int64 growth = context_->UpdateMaxWrittenOffset(offset);
20 int64 growth = 0;
21 context_->UpdateMaxWrittenOffset(offset, &new_file_size, &growth);
22
23 if (growth > 0) 20 if (growth > 0)
24 reservation_->ConsumeReservation(growth); 21 reservation_->ConsumeReservation(growth);
25
26 return new_file_size;
27 } 22 }
28 23
29 int64 OpenFileHandle::base_file_size() const { 24 int64 OpenFileHandle::GetEstimatedFileSize() const {
30 return context_->base_file_size(); 25 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
26 return context_->GetEstimatedFileSize();
31 } 27 }
32 28
33 OpenFileHandle::OpenFileHandle(QuotaReservation* reservation, 29 OpenFileHandle::OpenFileHandle(QuotaReservation* reservation,
34 OpenFileHandleContext* context) 30 OpenFileHandleContext* context)
35 : reservation_(reservation), 31 : reservation_(reservation),
36 context_(context) { 32 context_(context) {
37 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); 33 DCHECK(sequence_checker_.CalledOnValidSequencedThread());
38 } 34 }
39 35
40 } // namespace fileapi 36 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698