feature_list.cc 1.3 KB

123456789101112131415161718192021222324252627282930313233343536
  1. // Copyright (c) 2019 GitHub, Inc.
  2. // Use of this source code is governed by the MIT license that can be
  3. // found in the LICENSE file.
  4. #include "electron/shell/browser/feature_list.h"
  5. #include <string>
  6. #include "base/base_switches.h"
  7. #include "base/command_line.h"
  8. #include "base/feature_list.h"
  9. #include "content/public/common/content_features.h"
  10. #include "electron/buildflags/buildflags.h"
  11. #include "media/base/media_switches.h"
  12. namespace electron {
  13. void InitializeFeatureList() {
  14. auto* cmd_line = base::CommandLine::ForCurrentProcess();
  15. auto enable_features =
  16. cmd_line->GetSwitchValueASCII(::switches::kEnableFeatures);
  17. auto disable_features =
  18. cmd_line->GetSwitchValueASCII(::switches::kDisableFeatures);
  19. // Disable creation of spare renderer process with site-per-process mode,
  20. // it interferes with our process preference tracking for non sandboxed mode.
  21. // Can be reenabled when our site instance policy is aligned with chromium
  22. // when node integration is enabled.
  23. disable_features +=
  24. std::string(",") + features::kSpareRendererForSitePerProcess.name;
  25. #if !BUILDFLAG(ENABLE_PICTURE_IN_PICTURE)
  26. disable_features += std::string(",") + media::kPictureInPicture.name;
  27. #endif
  28. base::FeatureList::InitializeInstance(enable_features, disable_features);
  29. }
  30. } // namespace electron