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

Unified Diff: chrome/browser/chromeos/login/login_utils.cc

Issue 344883002: Collect UMA statistics on which chrome://flags lead to chrome restart on ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 6 years, 4 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
« no previous file with comments | « chrome/browser/about_flags_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/login_utils.cc
diff --git a/chrome/browser/chromeos/login/login_utils.cc b/chrome/browser/chromeos/login/login_utils.cc
index 37566aecab7633100390310472e9760ebd194e33..7e92c2bc2e55e0b926a2cbfd7432c184e1a03ef2 100644
--- a/chrome/browser/chromeos/login/login_utils.cc
+++ b/chrome/browser/chromeos/login/login_utils.cc
@@ -92,6 +92,20 @@
using content::BrowserThread;
+namespace {
+
+void LogCustomSwitches(const std::set<std::string>& switches) {
+ if (!VLOG_IS_ON(1))
+ return;
+ for (std::set<std::string>::const_iterator it = switches.begin();
+ it != switches.end();
+ ++it) {
+ VLOG(1) << "Switch leading to restart: '" << *it << "'";
+ }
+}
+
+} // anonymous namespace
+
namespace chromeos {
namespace {
@@ -106,7 +120,9 @@ CommandLine CreatePerSessionCommandLine(Profile* profile) {
}
// Returns true if restart is needed to apply per-session flags.
-bool NeedRestartToApplyPerSessionFlags(const CommandLine& user_flags) {
+bool NeedRestartToApplyPerSessionFlags(
+ const CommandLine& user_flags,
+ std::set<CommandLine::StringType>* out_command_line_difference) {
// Don't restart browser if it is not first profile in session.
if (user_manager::UserManager::Get()->GetLoggedInUsers().size() != 1)
return false;
@@ -116,7 +132,9 @@ bool NeedRestartToApplyPerSessionFlags(const CommandLine& user_flags) {
return false;
if (about_flags::AreSwitchesIdenticalToCurrentCommandLine(
- user_flags, *CommandLine::ForCurrentProcess())) {
+ user_flags,
+ *CommandLine::ForCurrentProcess(),
+ out_command_line_difference)) {
return false;
}
@@ -359,9 +377,14 @@ bool LoginUtilsImpl::RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
return false;
const CommandLine user_flags(CreatePerSessionCommandLine(profile));
- if (!NeedRestartToApplyPerSessionFlags(user_flags))
+ std::set<CommandLine::StringType> command_line_difference;
+ if (!NeedRestartToApplyPerSessionFlags(user_flags, &command_line_difference))
return false;
+ LogCustomSwitches(command_line_difference);
+
+ about_flags::ReportCustomFlags("Login.CustomFlags", command_line_difference);
+
CommandLine::StringVector flags;
// argv[0] is the program name |CommandLine::NO_PROGRAM|.
flags.assign(user_flags.argv().begin() + 1, user_flags.argv().end());
« no previous file with comments | « chrome/browser/about_flags_unittest.cc ('k') | chrome/chrome_tests_unit.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698