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
3 // found in the LICENSE file.
5 #include "storage/browser/fileapi/quota/open_file_handle.h"
7 #include "storage/browser/fileapi/quota/open_file_handle_context.h"
8 #include "storage/browser/fileapi/quota/quota_reservation.h"
12 OpenFileHandle::~OpenFileHandle() {
13 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
16 void OpenFileHandle::UpdateMaxWrittenOffset(int64 offset
) {
17 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
19 int64 growth
= context_
->UpdateMaxWrittenOffset(offset
);
21 reservation_
->ConsumeReservation(growth
);
24 void OpenFileHandle::AddAppendModeWriteAmount(int64 amount
) {
25 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
29 context_
->AddAppendModeWriteAmount(amount
);
30 reservation_
->ConsumeReservation(amount
);
33 int64
OpenFileHandle::GetEstimatedFileSize() const {
34 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
35 return context_
->GetEstimatedFileSize();
38 int64
OpenFileHandle::GetMaxWrittenOffset() const {
39 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
40 return context_
->GetMaxWrittenOffset();
43 const base::FilePath
& OpenFileHandle::platform_path() const {
44 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
45 return context_
->platform_path();
48 OpenFileHandle::OpenFileHandle(QuotaReservation
* reservation
,
49 OpenFileHandleContext
* context
)
50 : reservation_(reservation
),
52 DCHECK(sequence_checker_
.CalledOnValidSequencedThread());
55 } // namespace storage