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

Side by Side Diff: base/files/file.cc

Issue 1148383003: Only support seeking file streams from the beginning of the file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: One more instance where files need to be tagged as async. Created 5 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/files/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/files/file_tracing.h" 7 #include "base/files/file_tracing.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/timer/elapsed_timer.h" 9 #include "base/timer/elapsed_timer.h"
10 10
(...skipping 26 matching lines...) Expand all
37 File::File(PlatformFile platform_file) 37 File::File(PlatformFile platform_file)
38 : file_(platform_file), 38 : file_(platform_file),
39 error_details_(FILE_OK), 39 error_details_(FILE_OK),
40 created_(false), 40 created_(false),
41 async_(false) { 41 async_(false) {
42 #if defined(OS_POSIX) 42 #if defined(OS_POSIX)
43 DCHECK_GE(platform_file, -1); 43 DCHECK_GE(platform_file, -1);
44 #endif 44 #endif
45 } 45 }
46 46
47 File::File(PlatformFile platform_file, bool async)
48 : file_(platform_file),
49 error_details_(FILE_OK),
50 created_(false),
51 async_(async) {
52 #if defined(OS_POSIX)
53 DCHECK_GE(platform_file, -1);
54 #endif
55 }
56
47 File::File(Error error_details) 57 File::File(Error error_details)
48 : error_details_(error_details), 58 : error_details_(error_details),
49 created_(false), 59 created_(false),
50 async_(false) { 60 async_(false) {
51 } 61 }
52 62
53 File::File(RValue other) 63 File::File(RValue other)
54 : file_(other.object->TakePlatformFile()), 64 : file_(other.object->TakePlatformFile()),
55 path_(other.object->path_), 65 path_(other.object->path_),
56 error_details_(other.object->error_details()), 66 error_details_(other.object->error_details()),
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 143
134 bool File::Flush() { 144 bool File::Flush() {
135 ElapsedTimer timer; 145 ElapsedTimer timer;
136 SCOPED_FILE_TRACE("Flush"); 146 SCOPED_FILE_TRACE("Flush");
137 bool return_value = DoFlush(); 147 bool return_value = DoFlush();
138 UMA_HISTOGRAM_TIMES("PlatformFile.FlushTime", timer.Elapsed()); 148 UMA_HISTOGRAM_TIMES("PlatformFile.FlushTime", timer.Elapsed());
139 return return_value; 149 return return_value;
140 } 150 }
141 151
142 } // namespace base 152 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698