| Index: base/win/scoped_process_information.h
|
| diff --git a/base/win/scoped_process_information.h b/base/win/scoped_process_information.h
|
| index 2e240544122f13b07c53b78543a13883e8c7b0f4..1f404c2dbac77150f8279b1d25d037004f30207e 100644
|
| --- a/base/win/scoped_process_information.h
|
| +++ b/base/win/scoped_process_information.h
|
| @@ -18,9 +18,32 @@
|
| // structures. Allows clients to take ownership of either handle independently.
|
| class BASE_EXPORT ScopedProcessInformation {
|
| public:
|
| + // Helper object to contain the effect of Receive() to the funtion that needs
|
| + // a pointer.
|
| + class Receiver {
|
| + public:
|
| + explicit Receiver(ScopedProcessInformation* owner)
|
| + : info_(),
|
| + owner_(owner) {}
|
| + ~Receiver() { owner_->Set(info_); }
|
| +
|
| + operator PROCESS_INFORMATION*() { return &info_; }
|
| +
|
| + private:
|
| + PROCESS_INFORMATION info_;
|
| + ScopedProcessInformation* owner_;
|
| + };
|
| +
|
| ScopedProcessInformation();
|
| - explicit ScopedProcessInformation(const PROCESS_INFORMATION& process_info);
|
| ~ScopedProcessInformation();
|
| +
|
| + // Returns an object that may be passed to API calls such as CreateProcess.
|
| + // DCHECKs that the object is not currently holding any handles.
|
| + // HANDLEs stored in the returned PROCESS_INFORMATION will be owned by this
|
| + // instance.
|
| + // The intended use case is something like this:
|
| + // if (::CreateProcess(..., startup_info, scoped_proces_info.Receive()))
|
| + Receiver Receive();
|
|
|
| // Returns true iff this instance is holding a thread and/or process handle.
|
| bool IsValid() const;
|
|
|