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

Unified Diff: base/win/scoped_process_information.cc

Issue 71013004: Base: Remove Receive() from ScopedHandle. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix delegate_execute for google_chrome_build Created 7 years, 1 month 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/win/scoped_process_information.h ('k') | base/win/scoped_process_information_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/win/scoped_process_information.cc
diff --git a/base/win/scoped_process_information.cc b/base/win/scoped_process_information.cc
index cb7a30e2f542b4ca1426b3e2ab4de67a667bc5d8..bb2463774a8a326ffb769d7aadf6852bf53e802f 100644
--- a/base/win/scoped_process_information.cc
+++ b/base/win/scoped_process_information.cc
@@ -15,7 +15,7 @@ namespace {
// 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, HANDLE* target) {
+bool CheckAndDuplicateHandle(HANDLE source, ScopedHandle* target) {
if (!source)
return true;
@@ -26,7 +26,7 @@ bool CheckAndDuplicateHandle(HANDLE source, HANDLE* target) {
DPLOG(ERROR) << "Failed to duplicate a handle.";
return false;
}
- *target = temp;
+ target->Set(temp);
return true;
}
@@ -36,13 +36,13 @@ ScopedProcessInformation::ScopedProcessInformation()
: process_id_(0), thread_id_(0) {
}
-ScopedProcessInformation::~ScopedProcessInformation() {
- Close();
+ScopedProcessInformation::ScopedProcessInformation(
+ const PROCESS_INFORMATION& process_info) : process_id_(0), thread_id_(0) {
+ Set(process_info);
}
-ScopedProcessInformation::Receiver ScopedProcessInformation::Receive() {
- DCHECK(!IsValid()) << "process_information_ must be NULL";
- return Receiver(this);
+ScopedProcessInformation::~ScopedProcessInformation() {
+ Close();
}
bool ScopedProcessInformation::IsValid() const {
@@ -72,10 +72,8 @@ bool ScopedProcessInformation::DuplicateFrom(
DCHECK(!IsValid()) << "target ScopedProcessInformation must be NULL";
DCHECK(other.IsValid()) << "source ScopedProcessInformation must be valid";
- if (CheckAndDuplicateHandle(other.process_handle(),
- process_handle_.Receive()) &&
- CheckAndDuplicateHandle(other.thread_handle(),
- thread_handle_.Receive())) {
+ if (CheckAndDuplicateHandle(other.process_handle(), &process_handle_) &&
+ CheckAndDuplicateHandle(other.thread_handle(), &thread_handle_)) {
process_id_ = other.process_id();
thread_id_ = other.thread_id();
return true;
« no previous file with comments | « base/win/scoped_process_information.h ('k') | base/win/scoped_process_information_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698