Index: base/shared_memory_win.cc |
diff --git a/base/shared_memory_win.cc b/base/shared_memory_win.cc |
index 877ccd76e3310370b0394f196cbb6bee9290c581..e29b87a4ed5d891dd0a613af071e71157624845d 100644 |
--- a/base/shared_memory_win.cc |
+++ b/base/shared_memory_win.cc |
@@ -5,6 +5,7 @@ |
#include "base/shared_memory.h" |
#include "base/logging.h" |
+#include "base/sys_info.h" |
#include "base/utf_string_conversions.h" |
namespace base { |
@@ -134,15 +135,20 @@ bool SharedMemory::Open(const std::string& name, bool read_only) { |
return false; |
} |
-bool SharedMemory::Map(size_t bytes) { |
+bool SharedMemory::MapFrom(off_t offset, size_t bytes) { |
if (mapped_file_ == NULL) |
return false; |
if (bytes > static_cast<size_t>(std::numeric_limits<int>::max())) |
return false; |
+ DCHECK_EQ(0U, offset & (SysInfo::VMAllocationGranularity() - 1)); |
Mark Mentovai
2013/01/15 21:51:42
Same.
Vitaly Buka (NO REVIEWS)
2013/01/15 22:13:05
So do you advise to remove DCHECK?
|
memory_ = MapViewOfFile(mapped_file_, |
- read_only_ ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS, 0, 0, bytes); |
+ read_only_ ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS, |
+ static_cast<uint64>(offset) >> 32, |
+ static_cast<DWORD>(offset), |
+ bytes); |
+ int e = GetLastError(); |
Mark Mentovai
2013/01/15 21:51:42
Unused.
Vitaly Buka (NO REVIEWS)
2013/01/15 22:13:05
Done.
|
if (memory_ != NULL) { |
DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) & |
(SharedMemory::MAP_MINIMUM_ALIGNMENT - 1)); |