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

Unified Diff: third_party/crashpad/crashpad/test/win/win_multiprocess.h

Issue 2804713002: Update Crashpad to b4095401639ebe2ad33169e5c1d994065cbff1b8 (Closed)
Patch Set: Created 3 years, 8 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: third_party/crashpad/crashpad/test/win/win_multiprocess.h
diff --git a/third_party/crashpad/crashpad/test/win/win_multiprocess.h b/third_party/crashpad/crashpad/test/win/win_multiprocess.h
index 663c7594b4323b7b523ce35abf379167dde80277..b9e1564c9c2987118e6de9c2a74e38240e52418e 100644
--- a/third_party/crashpad/crashpad/test/win/win_multiprocess.h
+++ b/third_party/crashpad/crashpad/test/win/win_multiprocess.h
@@ -43,12 +43,16 @@ class WinMultiprocess {
ASSERT_NO_FATAL_FAILURE(
WinChildProcess::EntryPoint<ChildProcessHelper<T>>());
// If WinChildProcess::EntryPoint returns, we are in the parent process.
+ T parent_process;
+ WinMultiprocess* parent_multiprocess = &parent_process;
+
+ parent_multiprocess->WinMultiprocessParentBeforeChild();
+
std::unique_ptr<WinChildProcess::Handles> child_handles =
WinChildProcess::Launch();
ASSERT_TRUE(child_handles.get());
- T parent_process;
parent_process.child_handles_ = child_handles.get();
- static_cast<WinMultiprocess*>(&parent_process)->WinMultiprocessParent();
+ parent_multiprocess->WinMultiprocessParent();
// Close our side of the handles now that we're done. The child can
// use this to know when it's safe to complete.
@@ -56,12 +60,15 @@ class WinMultiprocess {
child_handles->write.reset();
// Wait for the child to complete.
- ASSERT_EQ(WAIT_OBJECT_0,
- WaitForSingleObject(child_handles->process.get(), INFINITE));
+ ASSERT_EQ(WaitForSingleObject(child_handles->process.get(), INFINITE),
+ WAIT_OBJECT_0);
DWORD exit_code;
ASSERT_TRUE(GetExitCodeProcess(child_handles->process.get(), &exit_code));
- ASSERT_EQ(parent_process.exit_code_, exit_code);
+ ASSERT_EQ(exit_code, parent_process.exit_code_);
+
+ parent_multiprocess->WinMultiprocessParentAfterChild(
+ child_handles->process.get());
}
protected:
@@ -162,6 +169,20 @@ class WinMultiprocess {
//! Subclasses must implement this method to define how the parent operates.
virtual void WinMultiprocessParent() = 0;
+ //! \brief The optional routine run in parent before the child is spawned.
+ //!
+ //! Subclasses may implement this method to prepare the environment for
+ //! the child process.
+ virtual void WinMultiprocessParentBeforeChild() {}
+
+ //! \brief The optional routine run in parent after the child exits.
+ //!
+ //! Subclasses may implement this method to clean up the environment after
+ //! the child process has exited.
+ //!
+ //! \param[in] child A handle to the exited child process.
+ virtual void WinMultiprocessParentAfterChild(HANDLE child) {}
+
//! \brief The subclass-provided child routine.
//!
//! Test failures should be reported via gtest: `EXPECT_*()`, `ASSERT_*()`,

Powered by Google App Engine
This is Rietveld 408576698