Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(78)

Side by Side Diff: ppapi/shared_impl/file_growth.cc

Issue 130053003: [Pepper] Wire up append mode writing support of FileIO (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: s/max_written_offsets/file_sizes/g Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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()
12 : max_written_offset(0), 12 : max_written_offset(0),
13 append_mode_write_amount(0) { 13 append_mode_write_amount(0) {
14 } 14 }
15 15
16 FileGrowth::FileGrowth(int64_t max_written_offset, 16 FileGrowth::FileGrowth(int64_t max_written_offset,
17 int64_t append_mode_write_amount) 17 int64_t append_mode_write_amount)
18 : max_written_offset(max_written_offset), 18 : max_written_offset(max_written_offset),
19 append_mode_write_amount(append_mode_write_amount) { 19 append_mode_write_amount(append_mode_write_amount) {
20 DCHECK_LE(0, max_written_offset); 20 DCHECK_LE(0, max_written_offset);
21 DCHECK_LE(0, append_mode_write_amount); 21 DCHECK_LE(0, append_mode_write_amount);
22 } 22 }
23 23
24 FileGrowthMap FileSizeMapToFileGrowthMap(const FileSizeMap& file_sizes) {
25 FileGrowthMap file_growths;
26 for (FileSizeMap::const_iterator it = file_sizes.begin();
27 it != file_sizes.end(); ++it)
28 file_growths[it->first] = FileGrowth(it->second, 0);
29 return file_growths;
30 }
31
32 FileSizeMap FileGrowthMapToFileSizeMap(const FileGrowthMap& file_growths) {
33 FileSizeMap file_sizes;
34 for (FileGrowthMap::const_iterator it = file_growths.begin();
35 it != file_growths.end(); ++it)
36 file_sizes[it->first] = it->second.max_written_offset;
37 return file_sizes;
38 }
39
24 } // namespace ppapi 40 } // namespace ppapi
OLDNEW
« ppapi/shared_impl/file_growth.h ('K') | « ppapi/shared_impl/file_growth.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698