Skip to content

Commit

Permalink
Added a comment that File::IsValid can be called outside of file thread.
Browse files Browse the repository at this point in the history
File::IsValid ends up calling either ScopedFS::is_valid() or
win::ScopedHandle::is_valid() - both of these classes inherit is_valid()
from ScopedGeneric, which implements is_valid() as a memory-only
operation that don't touch the file system:

  bool is_valid() const { return data_.generic != traits_type::InvalidValue(); }

BUG=

Review URL: https://codereview.chromium.org/1409323005

Cr-Commit-Position: refs/heads/master@{#355402}
  • Loading branch information
anforowicz authored and Commit bot committed Oct 21, 2015
1 parent a22b073 commit 7b718e8
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions base/files/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ class BASE_EXPORT File {
// Creates or opens the given file.
void Initialize(const FilePath& path, uint32 flags);

// Returns |true| if the handle / fd wrapped by this object is valid. This
// method doesn't interact with the file system (and is safe to be called from
// ThreadRestrictions::SetIOAllowed(false) threads).
bool IsValid() const;

// Returns true if a new file was created (or an old one truncated to zero
Expand Down

0 comments on commit 7b718e8

Please sign in to comment.