Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add enable_remote_module build flag #19821

Merged
merged 1 commit into from
Sep 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -579,6 +579,17 @@ source_set("electron_lib") {
]
}

if (enable_remote_module) {
sources += [
"shell/common/api/remote/object_life_monitor.cc",
"shell/common/api/remote/object_life_monitor.h",
"shell/common/api/remote/remote_callback_freer.cc",
"shell/common/api/remote/remote_callback_freer.h",
"shell/common/api/remote/remote_object_freer.cc",
"shell/common/api/remote/remote_object_freer.h",
]
}

if (enable_desktop_capturer) {
if (is_component_build && !is_linux) {
# On windows the implementation relies on unexported
Expand Down
1 change: 1 addition & 0 deletions buildflags/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildflag_header("buildflags") {
"ENABLE_DESKTOP_CAPTURER=$enable_desktop_capturer",
"ENABLE_RUN_AS_NODE=$enable_run_as_node",
"ENABLE_OSR=$enable_osr",
"ENABLE_REMOTE_MODULE=$enable_remote_module",
"ENABLE_VIEW_API=$enable_view_api",
"ENABLE_PEPPER_FLASH=$enable_pepper_flash",
"ENABLE_PDF_VIEWER=$enable_pdf_viewer",
Expand Down
2 changes: 2 additions & 0 deletions buildflags/buildflags.gni
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ declare_args() {

enable_osr = true

enable_remote_module = true

enable_view_api = false

enable_pdf_viewer = false
Expand Down
25 changes: 13 additions & 12 deletions filenames.auto.gni
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,19 @@ auto_filenames = {
"lib/common/api/module-list.ts",
"lib/common/api/native-image.js",
"lib/common/api/shell.js",
"lib/common/buffer-utils.ts",
"lib/common/clipboard-utils.ts",
"lib/common/crash-reporter.js",
"lib/common/define-properties.ts",
"lib/common/electron-binding-setup.ts",
"lib/common/error-utils.ts",
"lib/common/is-promise.ts",
"lib/common/remote/buffer-utils.ts",
"lib/common/remote/is-promise.ts",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we figure out how to remove these JS files from the bundle when the flag is off, too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that would be great

Copy link
Contributor Author

@miniak miniak Aug 27, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should do the same for the desktop-capturer. maybe a follow up PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@MarshallOfSound do you have any tips how to do this?

"lib/common/web-view-methods.ts",
"lib/renderer/api/crash-reporter.js",
"lib/renderer/api/desktop-capturer.ts",
"lib/renderer/api/ipc-renderer.ts",
"lib/renderer/api/remote.js",
"lib/renderer/api/web-frame.ts",
"lib/renderer/callbacks-registry.ts",
"lib/renderer/chrome-api.ts",
"lib/renderer/content-scripts-injector.ts",
"lib/renderer/extensions/event.ts",
Expand All @@ -156,6 +155,7 @@ auto_filenames = {
"lib/renderer/inspector.ts",
"lib/renderer/ipc-renderer-internal-utils.ts",
"lib/renderer/ipc-renderer-internal.ts",
"lib/renderer/remote/callbacks-registry.ts",
"lib/renderer/security-warnings.ts",
"lib/renderer/web-frame-init.ts",
"lib/renderer/web-view/guest-view-internal.ts",
Expand Down Expand Up @@ -258,23 +258,24 @@ auto_filenames = {
"lib/browser/ipc-main-internal-utils.ts",
"lib/browser/ipc-main-internal.ts",
"lib/browser/navigation-controller.js",
"lib/browser/objects-registry.js",
"lib/browser/remote/objects-registry.js",
"lib/browser/remote/server.js",
"lib/browser/rpc-server.js",
"lib/browser/utils.ts",
"lib/common/api/clipboard.js",
"lib/common/api/deprecate.ts",
"lib/common/api/module-list.ts",
"lib/common/api/native-image.js",
"lib/common/api/shell.js",
"lib/common/buffer-utils.ts",
"lib/common/clipboard-utils.ts",
"lib/common/crash-reporter.js",
"lib/common/define-properties.ts",
"lib/common/electron-binding-setup.ts",
"lib/common/error-utils.ts",
"lib/common/init.ts",
"lib/common/is-promise.ts",
"lib/common/parse-features-string.js",
"lib/common/remote/buffer-utils.ts",
"lib/common/remote/is-promise.ts",
"lib/common/reset-search-paths.ts",
"lib/common/web-view-methods.ts",
"lib/renderer/ipc-renderer-internal-utils.ts",
Expand All @@ -291,14 +292,14 @@ auto_filenames = {
"lib/common/api/module-list.ts",
"lib/common/api/native-image.js",
"lib/common/api/shell.js",
"lib/common/buffer-utils.ts",
"lib/common/clipboard-utils.ts",
"lib/common/crash-reporter.js",
"lib/common/define-properties.ts",
"lib/common/electron-binding-setup.ts",
"lib/common/error-utils.ts",
"lib/common/init.ts",
"lib/common/is-promise.ts",
"lib/common/remote/buffer-utils.ts",
"lib/common/remote/is-promise.ts",
"lib/common/reset-search-paths.ts",
"lib/common/web-view-methods.ts",
"lib/renderer/api/crash-reporter.js",
Expand All @@ -308,7 +309,6 @@ auto_filenames = {
"lib/renderer/api/module-list.ts",
"lib/renderer/api/remote.js",
"lib/renderer/api/web-frame.ts",
"lib/renderer/callbacks-registry.ts",
"lib/renderer/chrome-api.ts",
"lib/renderer/content-scripts-injector.ts",
"lib/renderer/extensions/event.ts",
Expand All @@ -319,6 +319,7 @@ auto_filenames = {
"lib/renderer/inspector.ts",
"lib/renderer/ipc-renderer-internal-utils.ts",
"lib/renderer/ipc-renderer-internal.ts",
"lib/renderer/remote/callbacks-registry.ts",
"lib/renderer/security-warnings.ts",
"lib/renderer/web-frame-init.ts",
"lib/renderer/web-view/guest-view-internal.ts",
Expand All @@ -341,14 +342,14 @@ auto_filenames = {
"lib/common/api/module-list.ts",
"lib/common/api/native-image.js",
"lib/common/api/shell.js",
"lib/common/buffer-utils.ts",
"lib/common/clipboard-utils.ts",
"lib/common/crash-reporter.js",
"lib/common/define-properties.ts",
"lib/common/electron-binding-setup.ts",
"lib/common/error-utils.ts",
"lib/common/init.ts",
"lib/common/is-promise.ts",
"lib/common/remote/buffer-utils.ts",
"lib/common/remote/is-promise.ts",
"lib/common/reset-search-paths.ts",
"lib/renderer/api/crash-reporter.js",
"lib/renderer/api/desktop-capturer.ts",
Expand All @@ -357,9 +358,9 @@ auto_filenames = {
"lib/renderer/api/module-list.ts",
"lib/renderer/api/remote.js",
"lib/renderer/api/web-frame.ts",
"lib/renderer/callbacks-registry.ts",
"lib/renderer/ipc-renderer-internal-utils.ts",
"lib/renderer/ipc-renderer-internal.ts",
"lib/renderer/remote/callbacks-registry.ts",
"lib/renderer/webpack-provider.ts",
"lib/worker/init.js",
"package.json",
Expand Down
6 changes: 0 additions & 6 deletions filenames.gni
Original file line number Diff line number Diff line change
Expand Up @@ -440,12 +440,6 @@ filenames = {
"shell/common/api/features.cc",
"shell/common/api/locker.cc",
"shell/common/api/locker.h",
"shell/common/api/object_life_monitor.cc",
"shell/common/api/object_life_monitor.h",
"shell/common/api/remote_callback_freer.cc",
"shell/common/api/remote_callback_freer.h",
"shell/common/api/remote_object_freer.cc",
"shell/common/api/remote_object_freer.h",
"shell/common/asar/archive.cc",
"shell/common/asar/archive.h",
"shell/common/asar/asar_util.cc",
Expand Down
8 changes: 7 additions & 1 deletion lib/browser/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,17 @@ app._setDefaultAppPaths(packagePath)
// Load the chrome devtools support.
require('@electron/internal/browser/devtools')

const features = process.electronBinding('features')

// Load the chrome extension support.
if (!process.electronBinding('features').isExtensionsEnabled()) {
if (!features.isExtensionsEnabled()) {
require('@electron/internal/browser/chrome-extension')
}

if (features.isRemoteModuleEnabled()) {
require('@electron/internal/browser/remote/server')
}

// Load protocol module to ensure it is populated on app ready
require('@electron/internal/browser/api/protocol')

Expand Down
File renamed without changes.
Loading