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

Unified Diff: base/memory/shared_memory_handle_win.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_mac.cc ('k') | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_handle_win.cc
diff --git a/base/memory/shared_memory_handle_win.cc b/base/memory/shared_memory_handle_win.cc
index 82ded3453dd27af6afa76252dbb7f7bc1069a57d..7480151b1ab3a8bd0474f576e898fc3e9ce85102 100644
--- a/base/memory/shared_memory_handle_win.cc
+++ b/base/memory/shared_memory_handle_win.cc
@@ -9,14 +9,13 @@
namespace base {
SharedMemoryHandle::SharedMemoryHandle()
- : handle_(nullptr), pid_(kNullProcessId), ownership_passes_to_ipc_(false) {}
+ : handle_(nullptr), ownership_passes_to_ipc_(false) {}
-SharedMemoryHandle::SharedMemoryHandle(HANDLE h, base::ProcessId pid)
- : handle_(h), pid_(pid), ownership_passes_to_ipc_(false) {}
+SharedMemoryHandle::SharedMemoryHandle(HANDLE h)
+ : handle_(h), ownership_passes_to_ipc_(false) {}
SharedMemoryHandle::SharedMemoryHandle(const SharedMemoryHandle& handle)
: handle_(handle.handle_),
- pid_(handle.pid_),
ownership_passes_to_ipc_(handle.ownership_passes_to_ipc_) {}
SharedMemoryHandle& SharedMemoryHandle::operator=(
@@ -25,14 +24,12 @@ SharedMemoryHandle& SharedMemoryHandle::operator=(
return *this;
handle_ = handle.handle_;
- pid_ = handle.pid_;
ownership_passes_to_ipc_ = handle.ownership_passes_to_ipc_;
return *this;
}
void SharedMemoryHandle::Close() const {
DCHECK(handle_ != nullptr);
- DCHECK(BelongsToCurrentProcess());
::CloseHandle(handle_);
}
@@ -41,7 +38,6 @@ bool SharedMemoryHandle::IsValid() const {
}
SharedMemoryHandle SharedMemoryHandle::Duplicate() const {
- DCHECK(BelongsToCurrentProcess());
HANDLE duped_handle;
ProcessHandle process = GetCurrentProcess();
BOOL success = ::DuplicateHandle(process, handle_, process, &duped_handle, 0,
@@ -49,27 +45,15 @@ SharedMemoryHandle SharedMemoryHandle::Duplicate() const {
if (!success)
return SharedMemoryHandle();
- base::SharedMemoryHandle handle(duped_handle, GetCurrentProcId());
+ base::SharedMemoryHandle handle(duped_handle);
handle.SetOwnershipPassesToIPC(true);
return handle;
}
-bool SharedMemoryHandle::BelongsToCurrentProcess() const {
- return pid_ == base::GetCurrentProcId();
-}
-
-bool SharedMemoryHandle::NeedsBrokering() const {
- return BelongsToCurrentProcess();
-}
-
HANDLE SharedMemoryHandle::GetHandle() const {
return handle_;
}
-base::ProcessId SharedMemoryHandle::GetPID() const {
- return pid_;
-}
-
void SharedMemoryHandle::SetOwnershipPassesToIPC(bool ownership_passes) {
ownership_passes_to_ipc_ = ownership_passes;
}
« no previous file with comments | « base/memory/shared_memory_handle_mac.cc ('k') | base/memory/shared_memory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698