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

Unified Diff: base/memory/shared_memory_handle_mac.cc

Issue 2849243002: Get rid of all pid references from base::SharedMemoryHandle. (Closed)
Patch Set: fix invalid handle Chrome IPC. Created 3 years, 8 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_handle.h ('k') | base/memory/shared_memory_handle_win.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_handle_mac.cc
diff --git a/base/memory/shared_memory_handle_mac.cc b/base/memory/shared_memory_handle_mac.cc
index d5c5fbad415d05363678e65f6da76a7197624a2c..3f1d4d83748657a72366535c55aea37d077c3832 100644
--- a/base/memory/shared_memory_handle_mac.cc
+++ b/base/memory/shared_memory_handle_mac.cc
@@ -39,17 +39,14 @@ SharedMemoryHandle::SharedMemoryHandle(mach_vm_size_t size) {
memory_object_ = named_right;
size_ = size;
- pid_ = GetCurrentProcId();
ownership_passes_to_ipc_ = false;
}
SharedMemoryHandle::SharedMemoryHandle(mach_port_t memory_object,
- mach_vm_size_t size,
- base::ProcessId pid)
+ mach_vm_size_t size)
: type_(MACH),
memory_object_(memory_object),
size_(size),
- pid_(pid),
ownership_passes_to_ipc_(false) {}
SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle) {
@@ -78,7 +75,7 @@ SharedMemoryHandle SharedMemoryHandle::Duplicate() const {
}
case MACH: {
if (!IsValid())
- return SharedMemoryHandle(MACH_PORT_NULL, 0, 0);
+ return SharedMemoryHandle();
// Increment the ref count.
kern_return_t kr = mach_port_mod_refs(mach_task_self(), memory_object_,
@@ -137,7 +134,6 @@ bool SharedMemoryHandle::MapAt(off_t offset,
MAP_SHARED, file_descriptor_.fd, offset);
return *memory != MAP_FAILED;
case SharedMemoryHandle::MACH:
- DCHECK_EQ(pid_, GetCurrentProcId());
kern_return_t kr = mach_vm_map(
mach_task_self(),
reinterpret_cast<mach_vm_address_t*>(memory), // Output parameter
@@ -190,7 +186,6 @@ void SharedMemoryHandle::CopyRelevantData(const SharedMemoryHandle& handle) {
case MACH:
memory_object_ = handle.memory_object_;
size_ = handle.size_;
- pid_ = handle.pid_;
ownership_passes_to_ipc_ = handle.ownership_passes_to_ipc_;
break;
}
« no previous file with comments | « base/memory/shared_memory_handle.h ('k') | base/memory/shared_memory_handle_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698