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"
11 FileGrowth::FileGrowth()
12 : max_written_offset(0),
13 append_mode_write_amount(0) {
16 FileGrowth::FileGrowth(int64_t max_written_offset,
17 int64_t append_mode_write_amount)
18 : max_written_offset(max_written_offset),
19 append_mode_write_amount(append_mode_write_amount) {
20 DCHECK_LE(0, max_written_offset);
21 DCHECK_LE(0, append_mode_write_amount);
24 FileGrowthMap FileSizeMapToFileGrowthMapForTesting(
25 const FileSizeMap& file_sizes) {
26 FileGrowthMap file_growths;
27 for (FileSizeMap::const_iterator it = file_sizes.begin();
28 it != file_sizes.end(); ++it)
29 file_growths[it->first] = FileGrowth(it->second, 0);
33 FileSizeMap FileGrowthMapToFileSizeMapForTesting(
34 const FileGrowthMap& file_growths) {
35 FileSizeMap file_sizes;
36 for (FileGrowthMap::const_iterator it = file_growths.begin();
37 it != file_growths.end(); ++it)
38 file_sizes[it->first] = it->second.max_written_offset;