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

Unified Diff: syzygy/agent/asan/reporters/crashpad_reporter.cc

Issue 2576003002: Add the ability to defer the initialization of the SyzyAsan crash reporter. (Closed)
Patch Set: Add an entry point to reinitialize the crash reporter. Created 4 years 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: syzygy/agent/asan/reporters/crashpad_reporter.cc
diff --git a/syzygy/agent/asan/reporters/crashpad_reporter.cc b/syzygy/agent/asan/reporters/crashpad_reporter.cc
index f0f05bfc328debcd3487b29e1d56b7302838fd14..39356700cabbb1efd3bb2b9b703f817701a9b809 100644
--- a/syzygy/agent/asan/reporters/crashpad_reporter.cc
+++ b/syzygy/agent/asan/reporters/crashpad_reporter.cc
@@ -49,13 +49,17 @@ bool EnsureCrashpadConnected() {
// Only initialize once.
if (initialized)
return crashpad_present;
- initialized = true;
// Get the name of the crashpad endpoint, failing if none exists.
std::unique_ptr<base::Environment> env(base::Environment::Create());
std::string pipe_name;
if (!env->GetVar(kCrashpadPipeNameVar, &pipe_name))
return false;
+
+ // Only flip the initialization bit once we've been able to read the
+ // environment variable to make this work if Crashpad wasn't present
+ // during the process initialization but is here later.
+ initialized = true;
std::wstring pipe_name_w = base::UTF8ToWide(pipe_name);
// Initialize the crashpad client.

Powered by Google App Engine
This is Rietveld 408576698