Chromium Code Reviews| Index: base/files/file.h |
| diff --git a/base/files/file.h b/base/files/file.h |
| index 89077b41c1d8d03a9aa1e33ea822b9fb9454f807..55595804be6e6891fadeb8ff311d29a84f80932f 100644 |
| --- a/base/files/file.h |
| +++ b/base/files/file.h |
| @@ -18,6 +18,7 @@ |
| #include "base/base_export.h" |
| #include "base/basictypes.h" |
| +#include "base/files/file_path.h" |
| #include "base/files/scoped_file.h" |
| #include "base/gtest_prod_util.h" |
| #include "base/move.h" |
| @@ -31,8 +32,6 @@ FORWARD_DECLARE_TEST(FileTest, MemoryCorruption); |
| namespace base { |
| -class FilePath; |
| - |
| #if defined(OS_WIN) |
| typedef HANDLE PlatformFile; |
| #elif defined(OS_POSIX) |
| @@ -162,8 +161,8 @@ class BASE_EXPORT File { |
| File(); |
| // Creates or opens the given file. This will fail with 'access denied' if the |
| - // |name| contains path traversal ('..') components. |
| - File(const FilePath& name, uint32 flags); |
| + // |path| contains path traversal ('..') components. |
| + File(const FilePath& path, uint32 flags); |
| // Takes ownership of |platform_file|. |
| explicit File(PlatformFile platform_file); |
| @@ -180,7 +179,7 @@ class BASE_EXPORT File { |
| File& operator=(RValue other); |
| // Creates or opens the given file. |
| - void Initialize(const FilePath& name, uint32 flags); |
| + void Initialize(const FilePath& path, uint32 flags); |
| bool IsValid() const; |
| @@ -191,7 +190,7 @@ class BASE_EXPORT File { |
| // Returns the OS result of opening this file. Note that the way to verify |
| // the success of the operation is to use IsValid(), not this method: |
| - // File file(name, flags); |
| + // File file(path, flags); |
| // if (!file.IsValid()) |
| // return; |
| Error error_details() const { return error_details_; } |
| @@ -305,6 +304,9 @@ class BASE_EXPORT File { |
| private: |
| FRIEND_TEST_ALL_PREFIXES(::FileTest, MemoryCorruption); |
| + // The tracing group file traces will show up as. |
| + static const char kTraceGroup[]; |
|
Sami
2015/04/28 11:10:39
nit: Usually we just write the trace category expl
Dan Beam
2015/04/28 15:47:58
I guess I can do this, it's just... TRACE_DISABLED
Sami
2015/04/28 15:51:05
I don't think it's a hard rule, so I'll leave it u
groby-ooo-7-16
2015/04/28 20:26:54
I don't have a specific preference, but consider n
Dan Beam
2015/04/29 02:48:03
$ git grep \\bkTraceGroup\\b
yields only these re
|
| + |
| #if defined(OS_POSIX) |
| // Encloses a single ScopedFD, saving a cheap tamper resistent memory checksum |
| // alongside it. This checksum is validated at every access, allowing early |
| @@ -350,9 +352,9 @@ class BASE_EXPORT File { |
| }; |
| #endif |
| - // Creates or opens the given file. Only called if |name| has no traversal |
| + // Creates or opens the given file. Only called if |path_| has no traversal |
| // ('..') components. |
| - void DoInitialize(const FilePath& name, uint32 flags); |
| + void DoInitialize(uint32 flags); |
| // TODO(tnagel): Reintegrate into Flush() once histogram isn't needed anymore, |
| // cf. issue 473337. |
| @@ -366,6 +368,9 @@ class BASE_EXPORT File { |
| MemoryCheckingScopedFD file_; |
| #endif |
|
groby-ooo-7-16
2015/04/28 20:26:54
|unsafe_path_|, then?
Dan Beam
2015/04/29 02:48:02
Done.
|
| + // Path that |Initialize()| was called with. Can be unsafe (e.g. have '..'). |
| + FilePath path_; |
| + |
| Error error_details_; |
| bool created_; |
| bool async_; |