diff options
author | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 09:02:34 +0000 |
---|---|---|
committer | vitalybuka@chromium.org <vitalybuka@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-16 09:02:34 +0000 |
commit | e29e3f552af122c042dde824952e477ef6e5263c (patch) | |
tree | f300691f2bb8f2e4a24ec1830d02c741da1b25b2 /base/shared_memory_posix.cc | |
parent | fb57c430ca3716272f812309c74c3d358bca5318 (diff) | |
download | chromium_src-e29e3f552af122c042dde824952e477ef6e5263c.zip chromium_src-e29e3f552af122c042dde824952e477ef6e5263c.tar.gz chromium_src-e29e3f552af122c042dde824952e477ef6e5263c.tar.bz2 |
Added SharedMemory::MapFrom.
Fragmentation of address space may prevents process from allocate entire block of shared memory. Particularly in attached bug browser process can't allocate 250Mb to accept data from renderer Mapping smaller blocks is workaround.
BUG=93202
Review URL: https://chromiumcodereview.appspot.com/11876037
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@177109 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/shared_memory_posix.cc')
-rw-r--r-- | base/shared_memory_posix.cc | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/base/shared_memory_posix.cc b/base/shared_memory_posix.cc index 7862f42..260cdb3 100644 --- a/base/shared_memory_posix.cc +++ b/base/shared_memory_posix.cc @@ -219,7 +219,7 @@ bool SharedMemory::Open(const std::string& name, bool read_only) { #endif // !defined(OS_ANDROID) -bool SharedMemory::Map(size_t bytes) { +bool SharedMemory::MapAt(off_t offset, size_t bytes) { if (mapped_file_ == -1) return false; @@ -234,16 +234,16 @@ bool SharedMemory::Map(size_t bytes) { DCHECK_GE(static_cast<uint32>(ashmem_bytes), bytes); // The caller wants to determine the map region size from ashmem. - bytes = ashmem_bytes; + bytes = ashmem_bytes - offset; // TODO(port): we set the created size here so that it is available in // transport_dib_android.cc. We should use ashmem_get_size_region() // in transport_dib_android.cc. - created_size_ = bytes; + created_size_ = ashmem_bytes; } #endif memory_ = mmap(NULL, bytes, PROT_READ | (read_only_ ? 0 : PROT_WRITE), - MAP_SHARED, mapped_file_, 0); + MAP_SHARED, mapped_file_, offset); bool mmap_succeeded = memory_ != (void*)-1 && memory_ != NULL; if (mmap_succeeded) { |