Skip to content

Commit

Permalink
feat: remove enable_run_as_node flag
Browse files Browse the repository at this point in the history
  • Loading branch information
Milan Burda committed May 23, 2023
1 parent e7b8bb4 commit 0bc8003
Show file tree
Hide file tree
Showing 14 changed files with 9 additions and 66 deletions.
29 changes: 3 additions & 26 deletions .circleci/config/base.yml
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,6 @@ env-mac-large-release: &env-mac-large-release
env-ninja-status: &env-ninja-status
NINJA_STATUS: "[%r processes, %f/%t @ %o/s : %es] "

env-disable-run-as-node: &env-disable-run-as-node
GN_BUILDFLAG_ARGS: 'enable_run_as_node = false'

env-32bit-release: &env-32bit-release
# Set symbol level to 1 for 32 bit releases because of https://crbug.com/648948
GN_BUILDFLAG_ARGS: 'symbol_level = 1'
Expand Down Expand Up @@ -256,7 +253,7 @@ step-depot-tools-get: &step-depot-tools-get
--- a/gclient.py
+++ b/gclient.py
@@ -712,7 +712,8 @@ class Dependency(gclient_utils.WorkItem, DependencySettings):
if dep_type == 'cipd':
cipd_root = self.GetCipdRoot()
- for package in dep_value.get('packages', []):
Expand Down Expand Up @@ -1042,7 +1039,7 @@ commands:
artifact-key:
type: string
build-type:
type: string
type: string
build-nonproprietary-ffmpeg:
type: boolean
default: true
Expand Down Expand Up @@ -1286,7 +1283,7 @@ commands:
artifact-key:
type: string
build-type:
type: string
type: string
after-build-and-save:
type: steps
default: []
Expand Down Expand Up @@ -1721,23 +1718,6 @@ jobs:
artifact-key: 'linux-x64-asan'
build-type: 'Linux'

linux-x64-testing-no-run-as-node:
executor:
name: linux-docker
size: xlarge
environment:
<<: *env-linux-2xlarge
<<: *env-testing-build
<<: *env-ninja-status
<<: *env-disable-run-as-node
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_arm64=True'
steps:
- electron-build:
persist: false
checkout: true
artifact-key: 'linux-x64-no-run-as-node'
build-type: 'Linux'

linux-x64-testing-gn-check:
executor:
name: linux-docker
Expand Down Expand Up @@ -2222,9 +2202,6 @@ workflows:
- linux-x64-testing-asan:
requires:
- linux-make-src-cache
- linux-x64-testing-no-run-as-node:
requires:
- linux-make-src-cache
- linux-x64-testing-gn-check:
requires:
- linux-make-src-cache
Expand Down
7 changes: 0 additions & 7 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -671,13 +671,6 @@ source_set("electron_lib") {
]
}

if (enable_run_as_node) {
sources += [
"shell/app/node_main.cc",
"shell/app/node_main.h",
]
}

if (enable_osr) {
sources += [
"shell/browser/osr/osr_host_display_client.cc",
Expand Down
1 change: 0 additions & 1 deletion buildflags/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ buildflag_header("buildflags") {

flags = [
"ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer",
"ENABLE_RUN_AS_NODE=$enable_run_as_node",
"ENABLE_OSR=$enable_osr",
"ENABLE_VIEWS_API=$enable_views_api",
"ENABLE_PDF_VIEWER=$enable_pdf_viewer",
Expand Down
3 changes: 0 additions & 3 deletions buildflags/buildflags.gni
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
declare_args() {
enable_desktop_capturer = true

# Allow running Electron as a node binary.
enable_run_as_node = true

enable_osr = true

enable_views_api = true
Expand Down
2 changes: 2 additions & 0 deletions filenames.gni
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ filenames = {
"shell/app/electron_crash_reporter_client.h",
"shell/app/electron_main_delegate.cc",
"shell/app/electron_main_delegate.h",
"shell/app/node_main.cc",
"shell/app/node_main.h",
"shell/app/uv_task_runner.cc",
"shell/app/uv_task_runner.h",
"shell/browser/api/electron_api_app.cc",
Expand Down
3 changes: 0 additions & 3 deletions shell/app/electron_library_main.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@
#if BUILDFLAG(IS_MAC)
extern "C" {
__attribute__((visibility("default"))) int ElectronMain(int argc, char* argv[]);

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
__attribute__((visibility("default"))) int ElectronInitializeICUandStartNode(
int argc,
char* argv[]);
#endif
}
#endif

Expand Down
2 changes: 0 additions & 2 deletions shell/app/electron_library_main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ int ElectronMain(int argc, char* argv[]) {
return content::ContentMain(std::move(params));
}

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
if (!electron::fuses::IsRunAsNodeEnabled()) {
CHECK(false) << "run_as_node fuse is disabled";
Expand All @@ -43,4 +42,3 @@ int ElectronInitializeICUandStartNode(int argc, char* argv[]) {
base::i18n::InitializeICU();
return electron::NodeMain(argc, argv);
}
#endif
2 changes: 0 additions & 2 deletions shell/app/electron_main_linux.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,13 @@
int main(int argc, char* argv[]) {
FixStdioStreams();

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
char* indicator = getenv(electron::kRunAsNode);
if (electron::fuses::IsRunAsNodeEnabled() && indicator &&
indicator[0] != '\0') {
base::i18n::InitializeICU();
base::AtExitManager atexit_manager;
return electron::NodeMain(argc, argv);
}
#endif

electron::ElectronMainDelegate delegate;
content::ContentMainParams params(&delegate);
Expand Down
2 changes: 0 additions & 2 deletions shell/app/electron_main_mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,10 @@ int main(int argc, char* argv[]) {
partition_alloc::EarlyMallocZoneRegistration();
FixStdioStreams();

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (electron::fuses::IsRunAsNodeEnabled() &&
IsEnvSet("ELECTRON_RUN_AS_NODE")) {
return ElectronInitializeICUandStartNode(argc, argv);
}
#endif

#if defined(HELPER_EXECUTABLE) && !IS_MAS_BUILD()
uint32_t exec_path_size = 0;
Expand Down
8 changes: 1 addition & 7 deletions shell/app/electron_main_win.cc
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,8 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
}
#endif

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
bool run_as_node =
electron::fuses::IsRunAsNodeEnabled() && IsEnvSet(electron::kRunAsNode);
#else
bool run_as_node = false;
#endif

// Make sure the output is printed to console.
if (run_as_node || !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE"))
Expand All @@ -164,15 +160,13 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
std::vector<char*> argv(arguments.argc);
std::transform(arguments.argv, arguments.argv + arguments.argc, argv.begin(),
[](auto& a) { return _strdup(base::WideToUTF8(a).c_str()); });
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (electron::fuses::IsRunAsNodeEnabled() && run_as_node) {
if (run_as_node) {
base::AtExitManager atexit_manager;
base::i18n::InitializeICU();
auto ret = electron::NodeMain(argv.size(), argv.data());
std::for_each(argv.begin(), argv.end(), free);
return ret;
}
#endif

base::CommandLine::Init(argv.size(), argv.data());
const base::CommandLine* command_line =
Expand Down
2 changes: 1 addition & 1 deletion shell/common/api/features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ bool IsPDFViewerEnabled() {
}

bool IsRunAsNodeEnabled() {
return electron::fuses::IsRunAsNodeEnabled() && BUILDFLAG(ENABLE_RUN_AS_NODE);
return electron::fuses::IsRunAsNodeEnabled();
}

bool IsFakeLocationProviderEnabled() {
Expand Down
10 changes: 2 additions & 8 deletions shell/common/crash_keys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,8 @@ void GetCrashKeys(std::map<std::string, std::string>* keys) {

namespace {
bool IsRunningAsNode() {
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (!electron::fuses::IsRunAsNodeEnabled())
return false;

return base::Environment::Create()->HasVar(electron::kRunAsNode);
#else
return false;
#endif
return electron::fuses::IsRunAsNodeEnabled() &&
base::Environment::Create()->HasVar(electron::kRunAsNode);
}
} // namespace

Expand Down
2 changes: 0 additions & 2 deletions shell/common/electron_constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,7 @@ const char kDeviceVendorIdKey[] = "vendorId";
const char kDeviceProductIdKey[] = "productId";
const char kDeviceSerialNumberKey[] = "serialNumber";

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
const char kRunAsNode[] = "ELECTRON_RUN_AS_NODE";
#endif

#if BUILDFLAG(ENABLE_PDF_VIEWER)
const char kPDFExtensionPluginName[] = "Chromium PDF Viewer";
Expand Down
2 changes: 0 additions & 2 deletions shell/common/electron_constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ extern const char kDeviceVendorIdKey[];
extern const char kDeviceProductIdKey[];
extern const char kDeviceSerialNumberKey[];

#if BUILDFLAG(ENABLE_RUN_AS_NODE)
extern const char kRunAsNode[];
#endif

#if BUILDFLAG(ENABLE_PDF_VIEWER)
extern const char kPDFExtensionPluginName[];
Expand Down

0 comments on commit 0bc8003

Please sign in to comment.