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

Unified Diff: base/files/memory_mapped_file.cc

Issue 1156183003: Pass file Regions along with FDs to child processes on Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: actual fix Created 5 years, 7 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/files/memory_mapped_file.h ('k') | content/app/android/child_process_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/files/memory_mapped_file.cc
diff --git a/base/files/memory_mapped_file.cc b/base/files/memory_mapped_file.cc
index 891fcffc4cb434b74729657b7981a400729f2e61..45015b7aa34b49e8dc087c8e612f2d290bdda54b 100644
--- a/base/files/memory_mapped_file.cc
+++ b/base/files/memory_mapped_file.cc
@@ -16,10 +16,11 @@ const MemoryMappedFile::Region MemoryMappedFile::Region::kWholeFile(
MemoryMappedFile::Region::Region(base::LinkerInitialized) : offset(0), size(0) {
}
+MemoryMappedFile::Region::Region() : offset(-1), size(-1) {
+}
+
MemoryMappedFile::Region::Region(int64 offset, int64 size)
: offset(offset), size(size) {
- DCHECK_GE(offset, 0);
- DCHECK_GT(size, 0);
}
bool MemoryMappedFile::Region::operator==(
@@ -59,6 +60,11 @@ bool MemoryMappedFile::Initialize(File file, const Region& region) {
if (IsValid())
return false;
+ if (!(region == Region::kWholeFile)) {
Lei Zhang 2015/06/02 18:59:11 should we implement operator!= ?
agrieve 2015/06/02 19:21:38 Seems reasonable doesn't it? :) Done!
+ DCHECK_GE(region.offset, 0);
+ DCHECK_GT(region.size, 0);
+ }
+
file_ = file.Pass();
if (!MapFileRegionToMemory(region)) {
« no previous file with comments | « base/files/memory_mapped_file.h ('k') | content/app/android/child_process_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698