зеркало из https://github.com/electron/electron.git
feat: initialize field trials from command line arguments (#28305)
Fixes: #27877
This commit is contained in:
Родитель
521146f71e
Коммит
2632564ccf
|
@ -75,6 +75,12 @@ This switch can not be used in `app.commandLine.appendSwitch` since it is parsed
|
||||||
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
|
earlier than user's app is loaded, but you can set the `ELECTRON_ENABLE_LOGGING`
|
||||||
environment variable to achieve the same effect.
|
environment variable to achieve the same effect.
|
||||||
|
|
||||||
|
## --force-fieldtrials=`trials`
|
||||||
|
|
||||||
|
Field trials to be forcefully enabled or disabled.
|
||||||
|
|
||||||
|
For example: `WebRTC-Audio-Red-For-Opus/Enabled/`
|
||||||
|
|
||||||
### --host-rules=`rules`
|
### --host-rules=`rules`
|
||||||
|
|
||||||
A comma-separated list of `rules` that control how hostnames are mapped.
|
A comma-separated list of `rules` that control how hostnames are mapped.
|
||||||
|
|
|
@ -279,6 +279,9 @@ void ElectronBrowserMainParts::PostEarlyInitialization() {
|
||||||
base::FeatureList::ClearInstanceForTesting();
|
base::FeatureList::ClearInstanceForTesting();
|
||||||
InitializeFeatureList();
|
InitializeFeatureList();
|
||||||
|
|
||||||
|
// Initialize field trials.
|
||||||
|
InitializeFieldTrials();
|
||||||
|
|
||||||
// Initialize after user script environment creation.
|
// Initialize after user script environment creation.
|
||||||
fake_browser_process_->PostEarlyInitialization();
|
fake_browser_process_->PostEarlyInitialization();
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "base/base_switches.h"
|
#include "base/base_switches.h"
|
||||||
#include "base/command_line.h"
|
#include "base/command_line.h"
|
||||||
#include "base/feature_list.h"
|
#include "base/feature_list.h"
|
||||||
|
#include "base/metrics/field_trial.h"
|
||||||
#include "content/public/common/content_features.h"
|
#include "content/public/common/content_features.h"
|
||||||
#include "electron/buildflags/buildflags.h"
|
#include "electron/buildflags/buildflags.h"
|
||||||
#include "media/base/media_switches.h"
|
#include "media/base/media_switches.h"
|
||||||
|
@ -49,4 +50,12 @@ void InitializeFeatureList() {
|
||||||
base::FeatureList::InitializeInstance(enable_features, disable_features);
|
base::FeatureList::InitializeInstance(enable_features, disable_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void InitializeFieldTrials() {
|
||||||
|
auto* cmd_line = base::CommandLine::ForCurrentProcess();
|
||||||
|
auto force_fieldtrials =
|
||||||
|
cmd_line->GetSwitchValueASCII(::switches::kForceFieldTrials);
|
||||||
|
|
||||||
|
base::FieldTrialList::CreateTrialsFromString(force_fieldtrials);
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace electron
|
} // namespace electron
|
||||||
|
|
|
@ -7,6 +7,7 @@
|
||||||
|
|
||||||
namespace electron {
|
namespace electron {
|
||||||
void InitializeFeatureList();
|
void InitializeFeatureList();
|
||||||
}
|
void InitializeFieldTrials();
|
||||||
|
} // namespace electron
|
||||||
|
|
||||||
#endif // SHELL_BROWSER_FEATURE_LIST_H_
|
#endif // SHELL_BROWSER_FEATURE_LIST_H_
|
||||||
|
|
Загрузка…
Ссылка в новой задаче