summaryrefslogtreecommitdiffstats
path: root/chromium/base/files/file.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-13 13:24:50 +0200
committerAllan Sandfeld Jensen <allan.jensen@theqtcompany.com>2015-10-14 10:57:25 +0000
commitaf3d4809763ef308f08ced947a73b624729ac7ea (patch)
tree4402b911e30383f6c6dace1e8cf3b8e85355db3a /chromium/base/files/file.h
parent0e8ff63a407fe323e215bb1a2c423c09a4747c8a (diff)
BASELINE: Update Chromium to 47.0.2526.14
Also adding in sources needed for spellchecking. Change-Id: Idd44170fa1616f26315188970a8d5ba7d472b18a Reviewed-by: Michael BrĂ¼ning <michael.bruning@theqtcompany.com>
Diffstat (limited to 'chromium/base/files/file.h')
-rw-r--r--chromium/base/files/file.h53
1 files changed, 2 insertions, 51 deletions
diff --git a/chromium/base/files/file.h b/chromium/base/files/file.h
index cba43536356..976188b232e 100644
--- a/chromium/base/files/file.h
+++ b/chromium/base/files/file.h
@@ -21,7 +21,6 @@
#include "base/files/file_path.h"
#include "base/files/file_tracing.h"
#include "base/files/scoped_file.h"
-#include "base/gtest_prod_util.h"
#include "base/move.h"
#include "base/time/time.h"
@@ -29,8 +28,6 @@
#include "base/win/scoped_handle.h"
#endif
-FORWARD_DECLARE_TEST(FileTest, MemoryCorruption);
-
namespace base {
#if defined(OS_WIN)
@@ -306,55 +303,8 @@ class BASE_EXPORT File {
static std::string ErrorToString(Error error);
private:
- FRIEND_TEST_ALL_PREFIXES(::FileTest, MemoryCorruption);
-
friend class FileTracing::ScopedTrace;
-#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
- // detection of memory corruption.
-
- // TODO(gavinp): This is in place temporarily to help us debug
- // https://crbug.com/424562 , which can't be reproduced in valgrind. Remove
- // this code after we have fixed this issue.
- class MemoryCheckingScopedFD {
- public:
- MemoryCheckingScopedFD();
- MemoryCheckingScopedFD(int fd);
- ~MemoryCheckingScopedFD();
-
- bool is_valid() const { Check(); return file_.is_valid(); }
- int get() const { Check(); return file_.get(); }
-
- void reset() { Check(); file_.reset(); UpdateChecksum(); }
- void reset(int fd) { Check(); file_.reset(fd); UpdateChecksum(); }
- int release() {
- Check();
- int fd = file_.release();
- UpdateChecksum();
- return fd;
- }
-
- private:
- FRIEND_TEST_ALL_PREFIXES(::FileTest, MemoryCorruption);
-
- // Computes the checksum for the current value of |file_|. Returns via an
- // out parameter to guard against implicit conversions of unsigned integral
- // types.
- void ComputeMemoryChecksum(unsigned int* out_checksum) const;
-
- // Confirms that the current |file_| and |file_memory_checksum_| agree,
- // failing a CHECK if they do not.
- void Check() const;
-
- void UpdateChecksum();
-
- ScopedFD file_;
- unsigned int file_memory_checksum_;
- };
-#endif
-
// Creates or opens the given file. Only called if |path| has no
// traversal ('..') components.
void DoInitialize(const FilePath& path, uint32 flags);
@@ -368,7 +318,7 @@ class BASE_EXPORT File {
#if defined(OS_WIN)
win::ScopedHandle file_;
#elif defined(OS_POSIX)
- MemoryCheckingScopedFD file_;
+ ScopedFD file_;
#endif
// A path to use for tracing purposes. Set if file tracing is enabled during
@@ -386,3 +336,4 @@ class BASE_EXPORT File {
} // namespace base
#endif // BASE_FILES_FILE_H_
+