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

Unified Diff: chrome/browser/about_flags.h

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: Move ReportCustomFlags to about_flags.cc 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.h
diff --git a/chrome/browser/about_flags.h b/chrome/browser/about_flags.h
index 55859db985106a932db1ab706f74d13f416c2512..f26704498f571594a9e8074bf54b40253af206e2 100644
--- a/chrome/browser/about_flags.h
+++ b/chrome/browser/about_flags.h
@@ -6,10 +6,12 @@
#define CHROME_BROWSER_ABOUT_FLAGS_H_
#include <map>
+#include <set>
#include <string>
#include "base/command_line.h"
#include "base/strings/string16.h"
+#include "chrome/browser/about_flags_switches_histogram_ids.h"
class PrefService;
@@ -58,6 +60,12 @@ struct Experiment {
const char* command_line_switch;
// Simple switches that have no value should use "" for command_line_value.
const char* command_line_value;
+
+ // ID of command_line_switch in UMA histograms.
+ // On ChromeOS experiments lead to chrome process restart when user logs in.
+ // IDs of switches that lead to restart are reported.
+ // Must be zero for entries without command_line_switches.
+ const int command_line_switch_histogram_id;
Ilya Sherman 2014/07/08 04:22:11 Why is this of type int, rather than of type Switc
Alexander Alekseev 2014/07/08 20:45:36 Done.
};
// The internal name of the experiment. This is never shown to the user.
@@ -85,11 +93,16 @@ struct Experiment {
const char* command_line_switch;
// Simple switches that have no value should use "" for command_line_value.
const char* command_line_value;
+ // ID of command_line_switch in UMA histograms.
+ // (See Choice::command_line_switch_histogram_id.)
+ // Must be zero for entries without command_line_switches.
+ const int command_line_switch_histogram_id;
// For ENABLE_DISABLE_VALUE, the command line switch and value to explictly
// disable the feature.
const char* disable_command_line_switch;
const char* disable_command_line_value;
+ const int disable_command_line_switch_histogram_id;
// This is used if type is MULTI_VALUE.
const Choice* choices;
@@ -109,17 +122,27 @@ struct Experiment {
// whether it should add the sentinel switches around flags.
enum SentinelsMode { kNoSentinels, kAddSentinels };
+// A simple map 'command line switch' -> 'histogram ID'.
+typedef std::map<std::string, int> SwitchesHistogramIDs;
+
// Reads the Labs |prefs| (called "Labs" for historical reasons) and adds the
// commandline flags belonging to the active experiments to |command_line|.
void ConvertFlagsToSwitches(FlagsStorage* flags_storage,
base::CommandLine* command_line,
SentinelsMode sentinels);
+// Returns a map <command_line_switch, switch_histogram_id>.
+// Map is created if it doesn't exist.
+const SwitchesHistogramIDs& GetSwitchesHistogramIds();
+
// Compares a set of switches of the two provided command line objects and
// returns true if they are the same and false otherwise.
+// If |out_difference| is not NULL, it's filled with set_symmetric_difference
+// between sets.
bool AreSwitchesIdenticalToCurrentCommandLine(
const base::CommandLine& new_cmdline,
- const base::CommandLine& active_cmdline);
+ const base::CommandLine& active_cmdline,
+ std::set<CommandLine::StringType>* out_difference);
// Differentiate between generic flags available on a per session base and flags
// that influence the whole machine and can be said by the admin only. This flag
@@ -160,6 +183,13 @@ int GetCurrentPlatform();
// startup.
void RecordUMAStatistics(FlagsStorage* flags_storage);
+// Sends stats (as UMA histogram) about command_line_difference.
+// This is used on ChromeOS to report flags that lead to browser restart.
+// |command_line_difference| is the result of
+// AreSwitchesIdenticalToCurrentCommandLine().
+void ReportCustomFlags(const std::string& uma_histogram_hame,
+ const std::set<std::string>& command_line_difference);
+
namespace testing {
// Clears internal global state, for unit tests.

Powered by Google App Engine
This is Rietveld 408576698