blob: f0f69c665877d40052dc0a4bdbc36bf9c6cfcc4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
// Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "webkit/browser/fileapi/quota/open_file_handle.h"
#include "webkit/browser/fileapi/quota/open_file_handle_context.h"
#include "webkit/browser/fileapi/quota/quota_reservation.h"
namespace fileapi {
OpenFileHandle::~OpenFileHandle() {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
}
int64 OpenFileHandle::UpdateMaxWrittenOffset(int64 offset) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
int64 new_file_size = 0;
int64 growth = 0;
context_->UpdateMaxWrittenOffset(offset, &new_file_size, &growth);
if (growth > 0)
reservation_->ConsumeReservation(growth);
return new_file_size;
}
int64 OpenFileHandle::base_file_size() const {
return context_->base_file_size();
}
OpenFileHandle::OpenFileHandle(QuotaReservation* reservation,
OpenFileHandleContext* context)
: reservation_(reservation),
context_(context) {
DCHECK(sequence_checker_.CalledOnValidSequencedThread());
}
} // namespace fileapi
|