Index: base/win/scoped_process_information.cc |
=================================================================== |
--- base/win/scoped_process_information.cc (revision 237598) |
+++ base/win/scoped_process_information.cc (working copy) |
@@ -15,7 +15,7 @@ |
// Duplicates source into target, returning true upon success. |target| is |
// guaranteed to be untouched in case of failure. Succeeds with no side-effects |
// if source is NULL. |
-bool CheckAndDuplicateHandle(HANDLE source, ScopedHandle* target) { |
+bool CheckAndDuplicateHandle(HANDLE source, HANDLE* target) { |
if (!source) |
return true; |
@@ -26,7 +26,7 @@ |
DPLOG(ERROR) << "Failed to duplicate a handle."; |
return false; |
} |
- target->Set(temp); |
+ *target = temp; |
return true; |
} |
@@ -36,15 +36,15 @@ |
: process_id_(0), thread_id_(0) { |
} |
-ScopedProcessInformation::ScopedProcessInformation( |
- const PROCESS_INFORMATION& process_info) : process_id_(0), thread_id_(0) { |
- Set(process_info); |
-} |
- |
ScopedProcessInformation::~ScopedProcessInformation() { |
Close(); |
} |
+ScopedProcessInformation::Receiver ScopedProcessInformation::Receive() { |
+ DCHECK(!IsValid()) << "process_information_ must be NULL"; |
+ return Receiver(this); |
+} |
+ |
bool ScopedProcessInformation::IsValid() const { |
return process_id_ || process_handle_.Get() || |
thread_id_ || thread_handle_.Get(); |
@@ -72,8 +72,10 @@ |
DCHECK(!IsValid()) << "target ScopedProcessInformation must be NULL"; |
DCHECK(other.IsValid()) << "source ScopedProcessInformation must be valid"; |
- if (CheckAndDuplicateHandle(other.process_handle(), &process_handle_) && |
- CheckAndDuplicateHandle(other.thread_handle(), &thread_handle_)) { |
+ if (CheckAndDuplicateHandle(other.process_handle(), |
+ process_handle_.Receive()) && |
+ CheckAndDuplicateHandle(other.thread_handle(), |
+ thread_handle_.Receive())) { |
process_id_ = other.process_id(); |
thread_id_ = other.thread_id(); |
return true; |