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

Unified Diff: chrome/browser/lifetime/application_lifetime.cc

Issue 385123004: Implement the WindowsLogoffRace finch experiment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add an additional timing check around EndSession to prevent test success when timing out on the blo… Created 6 years, 5 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: chrome/browser/lifetime/application_lifetime.cc
diff --git a/chrome/browser/lifetime/application_lifetime.cc b/chrome/browser/lifetime/application_lifetime.cc
index 21b9e3bda36e273f8b1bb21e662c098a55279e8c..38eaa56ceab8b01fd4740e33b29d61bfe65ad98c 100644
--- a/chrome/browser/lifetime/application_lifetime.cc
+++ b/chrome/browser/lifetime/application_lifetime.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "base/message_loop/message_loop.h"
+#include "base/metrics/field_trial.h"
#include "base/prefs/pref_service.h"
#include "base/process/kill.h"
#include "base/process/process.h"
@@ -249,6 +250,16 @@ void ExitCleanly() {
}
#endif
+namespace {
+
+bool ExperimentUseBrokenSynchronization() {
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("WindowsLogoffRace");
+ return group_name == "BrokenSynchronization";
+}
+
+} // namespace
+
void SessionEnding() {
// This is a time-limited shutdown where we need to write as much to
// disk as we can as soon as we can, and where we must kill the
@@ -280,25 +291,27 @@ void SessionEnding() {
#if defined(OS_WIN)
base::win::SetShouldCrashOnProcessDetach(false);
+#endif
- // On Windows 7 and later, the system will consider the process ripe for
- // termination as soon as it hides or destroys its windows. Since any
- // execution past that point will be non-deterministically cut short, we
- // might as well put ourselves out of that misery deterministically.
- base::KillProcess(base::Process::Current().handle(), 0, false);
-#else
- CloseAllBrowsers();
+ if (!ExperimentUseBrokenSynchronization()) {
Alexei Svitkine (slow) 2014/07/14 18:55:02 Nit: This would be easier to parse if you didn't h
Sigurður Ásgeirsson 2014/07/14 20:31:38 Too right, fixed.
+ // On Windows 7 and later, the system will consider the process ripe for
+ // termination as soon as it hides or destroys its windows. Since any
+ // execution past that point will be non-deterministically cut short, we
+ // might as well put ourselves out of that misery deterministically.
+ base::KillProcess(base::Process::Current().handle(), 0, false);
+ } else {
+ CloseAllBrowsers();
- // Send out notification. This is used during testing so that the test harness
- // can properly shutdown before we exit.
- content::NotificationService::current()->Notify(
- chrome::NOTIFICATION_SESSION_END,
- content::NotificationService::AllSources(),
- content::NotificationService::NoDetails());
+ // Send out notification. This is used during testing so that the test
+ // harness can properly shutdown before we exit.
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_SESSION_END,
+ content::NotificationService::AllSources(),
+ content::NotificationService::NoDetails());
- // This will end by terminating the process.
- content::ImmediateShutdownAndExitProcess();
-#endif // defined(OS_WIN)
+ // This will end by terminating the process.
+ content::ImmediateShutdownAndExitProcess();
+ }
}
void IncrementKeepAliveCount() {

Powered by Google App Engine
This is Rietveld 408576698