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

Unified Diff: base/shared_memory_win.cc

Issue 11876037: Added SharedMemory::MapFrom. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 11 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
« base/shared_memory_posix.cc ('K') | « base/shared_memory_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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));
« base/shared_memory_posix.cc ('K') | « base/shared_memory_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698