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

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

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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 | « base/file_version_info_unittest.cc ('k') | base/files/file.cc » ('j') | no next file with comments »
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 explicit File(PlatformFile platform_file); 169 explicit File(PlatformFile platform_file);
170 170
171 // Creates an object with a specific error_details code. 171 // Creates an object with a specific error_details code.
172 explicit File(Error error_details); 172 explicit File(Error error_details);
173 173
174 // Move constructor for C++03 move emulation of this type. 174 // Move constructor for C++03 move emulation of this type.
175 File(RValue other); 175 File(RValue other);
176 176
177 ~File(); 177 ~File();
178 178
179 // Takes ownership of |platform_file|.
180 static File CreateForAsyncHandle(PlatformFile platform_file);
181
179 // Move operator= for C++03 move emulation of this type. 182 // Move operator= for C++03 move emulation of this type.
180 File& operator=(RValue other); 183 File& operator=(RValue other);
181 184
182 // Creates or opens the given file. 185 // Creates or opens the given file.
183 void Initialize(const FilePath& path, uint32 flags); 186 void Initialize(const FilePath& path, uint32 flags);
184 187
185 bool IsValid() const; 188 bool IsValid() const;
186 189
187 // Returns true if a new file was created (or an old one truncated to zero 190 // Returns true if a new file was created (or an old one truncated to zero
188 // length to simulate a new file, which can happen with 191 // length to simulate a new file, which can happen with
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
345 // failing a CHECK if they do not. 348 // failing a CHECK if they do not.
346 void Check() const; 349 void Check() const;
347 350
348 void UpdateChecksum(); 351 void UpdateChecksum();
349 352
350 ScopedFD file_; 353 ScopedFD file_;
351 unsigned int file_memory_checksum_; 354 unsigned int file_memory_checksum_;
352 }; 355 };
353 #endif 356 #endif
354 357
355 // Creates or opens the given file. Only called if |path_| has no 358 // Creates or opens the given file. Only called if |path| has no
356 // traversal ('..') components. 359 // traversal ('..') components.
357 void DoInitialize(uint32 flags); 360 void DoInitialize(const FilePath& path, uint32 flags);
358 361
359 // TODO(tnagel): Reintegrate into Flush() once histogram isn't needed anymore, 362 // TODO(tnagel): Reintegrate into Flush() once histogram isn't needed anymore,
360 // cf. issue 473337. 363 // cf. issue 473337.
361 bool DoFlush(); 364 bool DoFlush();
362 365
363 void SetPlatformFile(PlatformFile file); 366 void SetPlatformFile(PlatformFile file);
364 367
365 #if defined(OS_WIN) 368 #if defined(OS_WIN)
366 win::ScopedHandle file_; 369 win::ScopedHandle file_;
367 #elif defined(OS_POSIX) 370 #elif defined(OS_POSIX)
368 MemoryCheckingScopedFD file_; 371 MemoryCheckingScopedFD file_;
369 #endif 372 #endif
370 373
371 // Path that |Initialize()| was called with. Only set if safe (i.e. no '..'). 374 // A path to use for tracing purposes. Set if file tracing is enabled during
372 FilePath path_; 375 // |Initialize()|.
376 FilePath tracing_path_;
373 377
374 // Object tied to the lifetime of |this| that enables/disables tracing. 378 // Object tied to the lifetime of |this| that enables/disables tracing.
375 FileTracing::ScopedEnabler trace_enabler_; 379 FileTracing::ScopedEnabler trace_enabler_;
376 380
377 Error error_details_; 381 Error error_details_;
378 bool created_; 382 bool created_;
379 bool async_; 383 bool async_;
380 }; 384 };
381 385
382 } // namespace base 386 } // namespace base
383 387
384 #endif // BASE_FILES_FILE_H_ 388 #endif // BASE_FILES_FILE_H_
OLDNEW
« no previous file with comments | « base/file_version_info_unittest.cc ('k') | base/files/file.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698