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

Unified Diff: base/memory/shared_memory_win.cc

Issue 1641513004: Update //base to chromium 9659b08ea5a34f889dc4166217f438095ddc10d2 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 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
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_win.cc
diff --git a/base/memory/shared_memory_win.cc b/base/memory/shared_memory_win.cc
index eacf0d6ccefcd97bd42d6758d4c99597d41f1730..40dcaae54d71b50925cf994495027fb29b43d5bc 100644
--- a/base/memory/shared_memory_win.cc
+++ b/base/memory/shared_memory_win.cc
@@ -29,40 +29,34 @@ namespace base {
SharedMemory::SharedMemory()
: mapped_file_(NULL),
+ mapped_size_(0),
memory_(NULL),
read_only_(false),
- mapped_size_(0),
- requested_size_(0),
- lock_(NULL) {
-}
+ requested_size_(0) {}
SharedMemory::SharedMemory(const std::wstring& name)
- : mapped_file_(NULL),
+ : name_(name),
+ mapped_file_(NULL),
+ mapped_size_(0),
memory_(NULL),
read_only_(false),
- requested_size_(0),
- mapped_size_(0),
- lock_(NULL),
- name_(name) {
-}
+ requested_size_(0) {}
-SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only)
+SharedMemory::SharedMemory(const SharedMemoryHandle& handle, bool read_only)
: mapped_file_(handle),
+ mapped_size_(0),
memory_(NULL),
read_only_(read_only),
- requested_size_(0),
- mapped_size_(0),
- lock_(NULL) {
-}
+ requested_size_(0) {}
-SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only,
+SharedMemory::SharedMemory(const SharedMemoryHandle& handle,
+ bool read_only,
ProcessHandle process)
: mapped_file_(NULL),
+ mapped_size_(0),
memory_(NULL),
read_only_(read_only),
- requested_size_(0),
- mapped_size_(0),
- lock_(NULL) {
+ requested_size_(0) {
::DuplicateHandle(process, handle,
GetCurrentProcess(), &mapped_file_,
read_only_ ? FILE_MAP_READ : FILE_MAP_READ |
@@ -73,8 +67,6 @@ SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only,
SharedMemory::~SharedMemory() {
Unmap();
Close();
- if (lock_ != NULL)
- CloseHandle(lock_);
}
// static
@@ -270,26 +262,6 @@ void SharedMemory::Close() {
}
}
-void SharedMemory::LockDeprecated() {
- if (lock_ == NULL) {
- std::wstring name = name_;
- name.append(L"lock");
- lock_ = CreateMutex(NULL, FALSE, name.c_str());
- if (lock_ == NULL) {
- DPLOG(ERROR) << "Could not create mutex.";
- NOTREACHED();
- return; // There is nothing good we can do here.
- }
- }
- DWORD result = WaitForSingleObject(lock_, INFINITE);
- DCHECK_EQ(result, WAIT_OBJECT_0);
-}
-
-void SharedMemory::UnlockDeprecated() {
- DCHECK(lock_ != NULL);
- ReleaseMutex(lock_);
-}
-
SharedMemoryHandle SharedMemory::handle() const {
return mapped_file_;
}
« no previous file with comments | « base/memory/shared_memory_unittest.cc ('k') | base/message_loop/message_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698