Allow script to request durable storage permission (chrome side)
[chromium-blink-merge.git] / ppapi / shared_impl / file_growth.cc
blob79f6b5cded246dfff3366991e09cde0115e1631f
1 // Copyright 2014 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 "ppapi/shared_impl/file_growth.h"
7 #include "base/logging.h"
9 namespace ppapi {
11 FileGrowth::FileGrowth() : max_written_offset(0), append_mode_write_amount(0) {}
13 FileGrowth::FileGrowth(int64_t max_written_offset,
14 int64_t append_mode_write_amount)
15 : max_written_offset(max_written_offset),
16 append_mode_write_amount(append_mode_write_amount) {
17 DCHECK_LE(0, max_written_offset);
18 DCHECK_LE(0, append_mode_write_amount);
21 FileGrowthMap FileSizeMapToFileGrowthMapForTesting(
22 const FileSizeMap& file_sizes) {
23 FileGrowthMap file_growths;
24 for (FileSizeMap::const_iterator it = file_sizes.begin();
25 it != file_sizes.end();
26 ++it)
27 file_growths[it->first] = FileGrowth(it->second, 0);
28 return file_growths;
31 FileSizeMap FileGrowthMapToFileSizeMapForTesting(
32 const FileGrowthMap& file_growths) {
33 FileSizeMap file_sizes;
34 for (FileGrowthMap::const_iterator it = file_growths.begin();
35 it != file_growths.end();
36 ++it)
37 file_sizes[it->first] = it->second.max_written_offset;
38 return file_sizes;
41 } // namespace ppapi