Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2659)

Unified Diff: base/file_util_posix.cc

Issue 12321062: base: Move MemoryMappedFile out of file_util.h and into its own header file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_frame again Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_posix.cc
diff --git a/base/file_util_posix.cc b/base/file_util_posix.cc
index 974b30dafbb70ca91f9b152f2a70a8813d333ff1..8b01412092c5fae44682d5e25ac6ed48c971470c 100644
--- a/base/file_util_posix.cc
+++ b/base/file_util_posix.cc
@@ -859,46 +859,6 @@ bool FileEnumerator::ReadDirectory(std::vector<DirectoryEntryInfo>* entries,
return true;
}
-///////////////////////////////////////////////
-// MemoryMappedFile
-
-MemoryMappedFile::MemoryMappedFile()
- : file_(base::kInvalidPlatformFileValue),
- data_(NULL),
- length_(0) {
-}
-
-bool MemoryMappedFile::MapFileToMemoryInternal() {
- base::ThreadRestrictions::AssertIOAllowed();
-
- struct stat file_stat;
- if (fstat(file_, &file_stat) == base::kInvalidPlatformFileValue) {
- DLOG(ERROR) << "Couldn't fstat " << file_ << ", errno " << errno;
- return false;
- }
- length_ = file_stat.st_size;
-
- data_ = static_cast<uint8*>(
- mmap(NULL, length_, PROT_READ, MAP_SHARED, file_, 0));
- if (data_ == MAP_FAILED)
- DLOG(ERROR) << "Couldn't mmap " << file_ << ", errno " << errno;
-
- return data_ != MAP_FAILED;
-}
-
-void MemoryMappedFile::CloseHandles() {
- base::ThreadRestrictions::AssertIOAllowed();
-
- if (data_ != NULL)
- munmap(data_, length_);
- if (file_ != base::kInvalidPlatformFileValue)
- ignore_result(HANDLE_EINTR(close(file_)));
-
- data_ = NULL;
- length_ = 0;
- file_ = base::kInvalidPlatformFileValue;
-}
-
bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info,
const base::Time& cutoff_time) {
return static_cast<time_t>(find_info.stat.st_mtime) >= cutoff_time.ToTimeT();
« no previous file with comments | « base/file_util.cc ('k') | base/file_util_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698