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

Unified Diff: snapshot/win/process_reader_win.h

Issue 1326443007: win: Fix incorrect thread suspend count due to ScopedProcessSuspend (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@master
Patch Set: pass in state Created 5 years, 3 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
Index: snapshot/win/process_reader_win.h
diff --git a/snapshot/win/process_reader_win.h b/snapshot/win/process_reader_win.h
index 3ef738adcffaa3d4ad3443d9282a4b11404b385f..9dbd6298a96f870d450461781e549edb20a0b382 100644
--- a/snapshot/win/process_reader_win.h
+++ b/snapshot/win/process_reader_win.h
@@ -26,6 +26,15 @@
namespace crashpad {
+//! \brief State of process being read by ProcessReaderWin.
+enum class ProcessSuspensionState : bool {
+ //! \brief The process is suspended.
Mark Mentovai 2015/09/09 18:57:27 Reverse these so that “running” = “false” (not sus
scottmg 2015/09/09 19:13:25 Done.
+ kSuspended,
+
+ //! \brief The process has not been suspended.
+ kRunning,
+};
+
//! \brief Accesses information about another process, identified by a `HANDLE`.
class ProcessReaderWin {
public:
@@ -52,11 +61,17 @@ class ProcessReaderWin {
//!
//! \param[in] process Process handle, must have `PROCESS_QUERY_INFORMATION`,
//! `PROCESS_VM_READ`, and `PROCESS_DUP_HANDLE` access.
+ //! \param[in] process_state Whether \a process has already been suspended
+ //! by the caller. Typically, this will be
+ //! ProcessSuspensionState::kSuspended, except for testing uses and where
+ //! the reader is reading itself.
//!
//! \return `true` on success, indicating that this object will respond
//! validly to further method calls. `false` on failure. On failure, no
//! further method calls should be made.
- bool Initialize(HANDLE process);
+ //!
+ //! \sa ScopedProcessSuspend
+ bool Initialize(HANDLE process, ProcessSuspensionState process_state);
//! \return `true` if the target task is a 64-bit process.
bool Is64Bit() const { return process_info_.Is64Bit(); }
@@ -96,6 +111,7 @@ class ProcessReaderWin {
ProcessInfo process_info_;
std::vector<Thread> threads_;
std::vector<ProcessInfo::Module> modules_;
+ ProcessSuspensionState process_state_;
Mark Mentovai 2015/09/09 18:57:27 process_state_ sounds like it can mean a few other
scottmg 2015/09/09 19:13:25 Done.
bool initialized_threads_;
InitializationStateDcheck initialized_;

Powered by Google App Engine
This is Rietveld 408576698