OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "webkit/browser/fileapi/quota/open_file_handle.h" | |
6 | |
7 #include "webkit/browser/fileapi/quota/open_file_handle_context.h" | |
8 #include "webkit/browser/fileapi/quota/quota_reservation.h" | |
9 | |
10 namespace storage { | |
11 | |
12 OpenFileHandle::~OpenFileHandle() { | |
13 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
14 } | |
15 | |
16 void OpenFileHandle::UpdateMaxWrittenOffset(int64 offset) { | |
17 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
18 | |
19 int64 growth = context_->UpdateMaxWrittenOffset(offset); | |
20 if (growth > 0) | |
21 reservation_->ConsumeReservation(growth); | |
22 } | |
23 | |
24 void OpenFileHandle::AddAppendModeWriteAmount(int64 amount) { | |
25 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
26 if (amount <= 0) | |
27 return; | |
28 | |
29 context_->AddAppendModeWriteAmount(amount); | |
30 reservation_->ConsumeReservation(amount); | |
31 } | |
32 | |
33 int64 OpenFileHandle::GetEstimatedFileSize() const { | |
34 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
35 return context_->GetEstimatedFileSize(); | |
36 } | |
37 | |
38 int64 OpenFileHandle::GetMaxWrittenOffset() const { | |
39 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
40 return context_->GetMaxWrittenOffset(); | |
41 } | |
42 | |
43 const base::FilePath& OpenFileHandle::platform_path() const { | |
44 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
45 return context_->platform_path(); | |
46 } | |
47 | |
48 OpenFileHandle::OpenFileHandle(QuotaReservation* reservation, | |
49 OpenFileHandleContext* context) | |
50 : reservation_(reservation), | |
51 context_(context) { | |
52 DCHECK(sequence_checker_.CalledOnValidSequencedThread()); | |
53 } | |
54 | |
55 } // namespace storage | |
OLD | NEW |