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

Unified Diff: chrome/browser/about_flags.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: Created 6 years, 6 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/about_flags.cc
diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc
index 7577556a0b3e3a97ca013d70cf3a88c938e8c25c..3f25c3a918404c43bc116e91e5ba9a486a3b2049 100644
--- a/chrome/browser/about_flags.cc
+++ b/chrome/browser/about_flags.cc
@@ -2144,17 +2144,32 @@ void ConvertFlagsToSwitches(FlagsStorage* flags_storage,
}
bool AreSwitchesIdenticalToCurrentCommandLine(
- const CommandLine& new_cmdline, const CommandLine& active_cmdline) {
+ const CommandLine& new_cmdline,
+ const CommandLine& active_cmdline,
+ std::set<CommandLine::StringType>* out_difference) {
std::set<CommandLine::StringType> new_flags =
ExtractFlagsFromCommandLine(new_cmdline);
std::set<CommandLine::StringType> active_flags =
ExtractFlagsFromCommandLine(active_cmdline);
+ bool result = true;
// Needed because std::equal doesn't check if the 2nd set is empty.
- if (new_flags.size() != active_flags.size())
- return false;
+ if (new_flags.size() != active_flags.size()) {
+ result = false;
+ } else {
+ std::equal(new_flags.begin(), new_flags.end(), active_flags.begin());
Nikita (slow) 2014/06/19 17:08:07 result =
Alexander Alekseev 2014/06/19 18:17:47 Done.
+ }
- return std::equal(new_flags.begin(), new_flags.end(), active_flags.begin());
+ if (out_difference && !result) {
+ std::set_symmetric_difference(
+ new_flags.begin(),
+ new_flags.end(),
+ active_flags.begin(),
+ active_flags.end(),
+ std::inserter(*out_difference, out_difference->begin()));
+ }
+
+ return result;
}
void GetFlagsExperimentsData(FlagsStorage* flags_storage,

Powered by Google App Engine
This is Rietveld 408576698