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

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

Issue 1103733002: Make unused InitializeUnsafe private and rename to DoInitialize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@less-base
Patch Set: based on topic branch Created 5 years, 8 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
« no previous file with comments | « no previous file | base/files/file.cc » ('j') | base/files/file_win.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef BASE_FILES_FILE_H_ 5 #ifndef BASE_FILES_FILE_H_
6 #define BASE_FILES_FILE_H_ 6 #define BASE_FILES_FILE_H_
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <windows.h> 10 #include <windows.h>
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 File(RValue other); 175 File(RValue other);
176 176
177 ~File(); 177 ~File();
178 178
179 // Move operator= for C++03 move emulation of this type. 179 // Move operator= for C++03 move emulation of this type.
180 File& operator=(RValue other); 180 File& operator=(RValue other);
181 181
182 // Creates or opens the given file. 182 // Creates or opens the given file.
183 void Initialize(const FilePath& name, uint32 flags); 183 void Initialize(const FilePath& name, uint32 flags);
184 184
185 // Creates or opens the given file, allowing paths with traversal ('..')
186 // components. Use only with extreme care.
187 void InitializeUnsafe(const FilePath& name, uint32 flags);
188
189 bool IsValid() const; 185 bool IsValid() const;
190 186
191 // Returns true if a new file was created (or an old one truncated to zero 187 // Returns true if a new file was created (or an old one truncated to zero
192 // length to simulate a new file, which can happen with 188 // length to simulate a new file, which can happen with
193 // FLAG_CREATE_ALWAYS), and false otherwise. 189 // FLAG_CREATE_ALWAYS), and false otherwise.
194 bool created() const { return created_; } 190 bool created() const { return created_; }
195 191
196 // Returns the OS result of opening this file. Note that the way to verify 192 // Returns the OS result of opening this file. Note that the way to verify
197 // the success of the operation is to use IsValid(), not this method: 193 // the success of the operation is to use IsValid(), not this method:
198 // File file(name, flags); 194 // File file(name, flags);
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 // failing a CHECK if they do not. 343 // failing a CHECK if they do not.
348 void Check() const; 344 void Check() const;
349 345
350 void UpdateChecksum(); 346 void UpdateChecksum();
351 347
352 ScopedFD file_; 348 ScopedFD file_;
353 unsigned int file_memory_checksum_; 349 unsigned int file_memory_checksum_;
354 }; 350 };
355 #endif 351 #endif
356 352
353 // Creates or opens the given file. Only called if |name| has no traversal
354 // ('..') components.
355 void DoInitialize(const FilePath& name, uint32 flags);
356
357 // TODO(tnagel): Reintegrate into Flush() once histogram isn't needed anymore, 357 // TODO(tnagel): Reintegrate into Flush() once histogram isn't needed anymore,
358 // cf. issue 473337. 358 // cf. issue 473337.
359 bool DoFlush(); 359 bool DoFlush();
360 360
361 void SetPlatformFile(PlatformFile file); 361 void SetPlatformFile(PlatformFile file);
362 362
363 #if defined(OS_WIN) 363 #if defined(OS_WIN)
364 win::ScopedHandle file_; 364 win::ScopedHandle file_;
365 #elif defined(OS_POSIX) 365 #elif defined(OS_POSIX)
366 MemoryCheckingScopedFD file_; 366 MemoryCheckingScopedFD file_;
367 #endif 367 #endif
368 368
369 Error error_details_; 369 Error error_details_;
370 bool created_; 370 bool created_;
371 bool async_; 371 bool async_;
372 }; 372 };
373 373
374 } // namespace base 374 } // namespace base
375 375
376 #endif // BASE_FILES_FILE_H_ 376 #endif // BASE_FILES_FILE_H_
OLDNEW
« no previous file with comments | « no previous file | base/files/file.cc » ('j') | base/files/file_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698