diff options
author | rvargas <rvargas@chromium.org> | 2015-02-04 13:11:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-02-04 21:12:35 +0000 |
commit | 6b039c379ae314520617fae279194b77f2441ea9 (patch) | |
tree | 1b807f607ce37544762acca0f3bbd23b50b6b68d /base/memory | |
parent | afebf76e26c5cecb3fa043c410f64ed96243a09e (diff) | |
download | chromium_src-6b039c379ae314520617fae279194b77f2441ea9.zip chromium_src-6b039c379ae314520617fae279194b77f2441ea9.tar.gz chromium_src-6b039c379ae314520617fae279194b77f2441ea9.tar.bz2 |
Move OpenProcessHandle to Process::Open.
This removes another source of raw process handles.
BUG=417532
Review URL: https://codereview.chromium.org/868543002
Cr-Commit-Position: refs/heads/master@{#314633}
Diffstat (limited to 'base/memory')
-rw-r--r-- | base/memory/scoped_open_process.h | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/base/memory/scoped_open_process.h b/base/memory/scoped_open_process.h deleted file mode 100644 index 8bb19e2..0000000 --- a/base/memory/scoped_open_process.h +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef BASE_MEMORY_SCOPED_OPEN_PROCESS_H_ -#define BASE_MEMORY_SCOPED_OPEN_PROCESS_H_ - -#include "base/process/process_handle.h" - -namespace base { - -// A class that opens a process from its process id and closes it when the -// instance goes out of scope. -class ScopedOpenProcess { - public: - ScopedOpenProcess() : handle_(kNullProcessHandle) { - } - - // Automatically close the process. - ~ScopedOpenProcess() { - Close(); - } - - // Open a new process by pid. Closes any previously opened process (even if - // opening the new one fails). - bool Open(ProcessId pid) { - Close(); - return OpenProcessHandle(pid, &handle_); - } - - // Close the previously opened process. - void Close() { - if (handle_ == kNullProcessHandle) - return; - - CloseProcessHandle(handle_); - handle_ = kNullProcessHandle; - } - - ProcessHandle handle() const { return handle_; } - - private: - ProcessHandle handle_; - DISALLOW_COPY_AND_ASSIGN(ScopedOpenProcess); -}; -} // namespace base - -#endif // BASE_MEMORY_SCOPED_OPEN_PROCESS_H_ |