Chromium Code Reviews| Index: base/files/file.cc |
| diff --git a/base/files/file.cc b/base/files/file.cc |
| index 4c0e5ded47c90d000a7fb6e80ff1e5a160445743..fde7e60321820d0546316ec077e54ce64bfbaa43 100644 |
| --- a/base/files/file.cc |
| +++ b/base/files/file.cc |
| @@ -6,6 +6,8 @@ |
| #include "base/files/file_path.h" |
| #include "base/metrics/histogram.h" |
| #include "base/timer/elapsed_timer.h" |
| +#include "base/trace_event/scoped_file_trace.h" |
| +#include "base/trace_event/trace_event.h" |
| #if defined(OS_POSIX) |
| #include "base/files/file_posix_hooks_internal.h" |
| @@ -29,11 +31,11 @@ File::File() |
| } |
| #if !defined(OS_NACL) |
| -File::File(const FilePath& name, uint32 flags) |
| +File::File(const FilePath& path, uint32 flags) |
| : error_details_(FILE_OK), |
| created_(false), |
| async_(false) { |
| - Initialize(name, flags); |
| + Initialize(path, flags); |
| } |
| #endif |
| @@ -57,18 +59,21 @@ File::File(Error error_details) |
| File::File(RValue other) |
| : file_(other.object->TakePlatformFile()), |
| + path_(other.object->path_), |
| error_details_(other.object->error_details()), |
| created_(other.object->created()), |
| async_(other.object->async_) { |
| #if defined(OS_POSIX) |
| - if (IsValid()) |
| - ProtectFileDescriptor(GetPlatformFile()); |
| + if (IsValid()) |
| + ProtectFileDescriptor(GetPlatformFile()); |
| #endif |
| } |
| File::~File() { |
| // Go through the AssertIOAllowed logic. |
| Close(); |
| + TRACE_EVENT_ASYNC_END1(ScopedFileTrace::kGroup, "File", this, |
| + "path", path_.AsUTF8Unsafe()); |
| } |
| File& File::operator=(RValue other) { |
| @@ -83,12 +88,15 @@ File& File::operator=(RValue other) { |
| } |
| #if !defined(OS_NACL) |
| -void File::Initialize(const FilePath& name, uint32 flags) { |
| - if (name.ReferencesParent()) { |
| +void File::Initialize(const FilePath& path, uint32 flags) { |
| + path_ = path; |
| + if (path_.ReferencesParent()) { |
| error_details_ = FILE_ERROR_ACCESS_DENIED; |
| return; |
| } |
| - DoInitialize(name, flags); |
| + TRACE_EVENT_ASYNC_BEGIN1(ScopedFileTrace::kGroup, "File", this, |
| + "path", path_.AsUTF8Unsafe()); |
|
Dan Beam
2015/04/23 22:32:19
this seemed like the sanest place to start this, b
|
| + DoInitialize(flags); |
| } |
| #endif |