OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/shared_impl/file_growth.h" | 5 #include "ppapi/shared_impl/file_growth.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace ppapi { | 9 namespace ppapi { |
10 | 10 |
11 FileGrowth::FileGrowth() | 11 FileGrowth::FileGrowth() : max_written_offset(0), append_mode_write_amount(0) {} |
12 : max_written_offset(0), | |
13 append_mode_write_amount(0) { | |
14 } | |
15 | 12 |
16 FileGrowth::FileGrowth(int64_t max_written_offset, | 13 FileGrowth::FileGrowth(int64_t max_written_offset, |
17 int64_t append_mode_write_amount) | 14 int64_t append_mode_write_amount) |
18 : max_written_offset(max_written_offset), | 15 : max_written_offset(max_written_offset), |
19 append_mode_write_amount(append_mode_write_amount) { | 16 append_mode_write_amount(append_mode_write_amount) { |
20 DCHECK_LE(0, max_written_offset); | 17 DCHECK_LE(0, max_written_offset); |
21 DCHECK_LE(0, append_mode_write_amount); | 18 DCHECK_LE(0, append_mode_write_amount); |
22 } | 19 } |
23 | 20 |
24 FileGrowthMap FileSizeMapToFileGrowthMapForTesting( | 21 FileGrowthMap FileSizeMapToFileGrowthMapForTesting( |
25 const FileSizeMap& file_sizes) { | 22 const FileSizeMap& file_sizes) { |
26 FileGrowthMap file_growths; | 23 FileGrowthMap file_growths; |
27 for (FileSizeMap::const_iterator it = file_sizes.begin(); | 24 for (FileSizeMap::const_iterator it = file_sizes.begin(); |
28 it != file_sizes.end(); ++it) | 25 it != file_sizes.end(); |
| 26 ++it) |
29 file_growths[it->first] = FileGrowth(it->second, 0); | 27 file_growths[it->first] = FileGrowth(it->second, 0); |
30 return file_growths; | 28 return file_growths; |
31 } | 29 } |
32 | 30 |
33 FileSizeMap FileGrowthMapToFileSizeMapForTesting( | 31 FileSizeMap FileGrowthMapToFileSizeMapForTesting( |
34 const FileGrowthMap& file_growths) { | 32 const FileGrowthMap& file_growths) { |
35 FileSizeMap file_sizes; | 33 FileSizeMap file_sizes; |
36 for (FileGrowthMap::const_iterator it = file_growths.begin(); | 34 for (FileGrowthMap::const_iterator it = file_growths.begin(); |
37 it != file_growths.end(); ++it) | 35 it != file_growths.end(); |
| 36 ++it) |
38 file_sizes[it->first] = it->second.max_written_offset; | 37 file_sizes[it->first] = it->second.max_written_offset; |
39 return file_sizes; | 38 return file_sizes; |
40 } | 39 } |
41 | 40 |
42 } // namespace ppapi | 41 } // namespace ppapi |
OLD | NEW |