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

Unified Diff: chromecast/browser/cast_browser_main_parts.cc

Issue 1812883003: Enable features API for content shell and webview (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: do not override dummy instance Created 4 years, 9 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: chromecast/browser/cast_browser_main_parts.cc
diff --git a/chromecast/browser/cast_browser_main_parts.cc b/chromecast/browser/cast_browser_main_parts.cc
index b4202898a59a35bdca35fcae6509eb4dc46d85cc..e5823ca8fd6a2984e2310ecf2c1bd9c225aaadbb 100644
--- a/chromecast/browser/cast_browser_main_parts.cc
+++ b/chromecast/browser/cast_browser_main_parts.cc
@@ -10,6 +10,7 @@
#include <string>
#include "base/command_line.h"
+#include "base/feature_list.h"
#include "base/files/file_util.h"
#include "base/macros.h"
#include "base/message_loop/message_loop.h"
@@ -295,6 +296,19 @@ void CastBrowserMainParts::ToolkitInitialized() {
}
int CastBrowserMainParts::PreCreateThreads() {
+ // The only case GetInstance() returns null should be when you are running a
+ // C++ test, in which case currently we do not support command line features.
+ // This allows Test::SetUp() to enable/disable features as necessary. See
+ // crbug.com/596021 for more details.
+ if (!base::FeatureList::GetInstance()) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ scoped_ptr<base::FeatureList> feature_list(new base::FeatureList);
+ feature_list->InitializeFromCommandLine(
+ command_line->GetSwitchValueASCII(switches::kEnableFeatures),
+ command_line->GetSwitchValueASCII(switches::kDisableFeatures));
+ base::FeatureList::SetInstance(std::move(feature_list));
+ }
+
#if defined(OS_ANDROID)
// GPU process is started immediately after threads are created, requiring
// CrashDumpManager to be initialized beforehand.

Powered by Google App Engine
This is Rietveld 408576698