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

Unified Diff: chrome/browser/browser_hangs_experiment.cc

Issue 1905293003: Use CONTINUE_ON_SHUTDOWN for IncidentReportingService tasks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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: chrome/browser/browser_hangs_experiment.cc
diff --git a/chrome/browser/browser_hangs_experiment.cc b/chrome/browser/browser_hangs_experiment.cc
new file mode 100644
index 0000000000000000000000000000000000000000..858a8e45b185249df6f2ce51e58ab4eeca660875
--- /dev/null
+++ b/chrome/browser/browser_hangs_experiment.cc
@@ -0,0 +1,28 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/browser_hangs_experiment.h"
+
+#include <string>
+
+#include "base/command_line.h"
+#include "base/metrics/field_trial.h"
grt (UTC plus 2) 2016/04/25 13:37:53 use base/feature_list.h instead of field_trial.h?
Patrick Monette 2016/04/25 18:14:27 Ooohh shiny!
+#include "base/strings/string_util.h"
+
+bool IsBrowserHangsExperimentEnabled() {
+ using base::CommandLine;
+
+ // Note: It's important to query the field trial state first, to ensure that
+ // UMA reports the correct group.
manzagop (departed) 2016/04/25 13:37:39 For my benefit, what gets reported in the case of
Patrick Monette 2016/04/25 18:14:27 The whole experiment is set server-side. There is
+ const std::string group_name =
+ base::FieldTrialList::FindFullName("BrowserHangsExperiment");
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
manzagop (departed) 2016/04/25 13:37:39 Need to check InitializedForCurrentProcess first?
Patrick Monette 2016/04/25 18:14:27 No longer using CommandLine::ForCurrentProcess().
+ "disable-browser-hangs-experiment"))
+ return false;
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ "enable-browser-hangs-experiment"))
+ return true;
+
+ return base::StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE);
manzagop (departed) 2016/04/25 13:37:39 Where does "Enabled" come from? Is it a standard g
Patrick Monette 2016/04/25 18:14:27 The only place it'll be reuse is in the finch conf
+}

Powered by Google App Engine
This is Rietveld 408576698