diff options
Diffstat (limited to 'chromium/base/files/file.cc')
-rw-r--r-- | chromium/base/files/file.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/chromium/base/files/file.cc b/chromium/base/files/file.cc index 58f80c52322..47b9f88f188 100644 --- a/chromium/base/files/file.cc +++ b/chromium/base/files/file.cc @@ -52,7 +52,7 @@ File::File(Error error_details) File::File(RValue other) : file_(other.object->TakePlatformFile()), - path_(other.object->path_), + tracing_path_(other.object->tracing_path_), error_details_(other.object->error_details()), created_(other.object->created()), async_(other.object->async_) { @@ -63,11 +63,20 @@ File::~File() { Close(); } +// static +File File::CreateForAsyncHandle(PlatformFile platform_file) { + File file(platform_file); + // It would be nice if we could validate that |platform_file| was opened with + // FILE_FLAG_OVERLAPPED on Windows but this doesn't appear to be possible. + file.async_ = true; + return file.Pass(); +} + File& File::operator=(RValue other) { if (this != other.object) { Close(); SetPlatformFile(other.object->TakePlatformFile()); - path_ = other.object->path_; + tracing_path_ = other.object->tracing_path_; error_details_ = other.object->error_details(); created_ = other.object->created(); async_ = other.object->async_; @@ -81,9 +90,10 @@ void File::Initialize(const FilePath& path, uint32 flags) { error_details_ = FILE_ERROR_ACCESS_DENIED; return; } - path_ = path; + if (FileTracing::IsCategoryEnabled()) + tracing_path_ = path; SCOPED_FILE_TRACE("Initialize"); - DoInitialize(flags); + DoInitialize(path, flags); } #endif |