build: add enable_remote_module build flag (#19821)

This commit is contained in:
Milan Burda 2019-09-18 09:52:06 -07:00 committed by Alexey Kuzmin
parent 8bf74164e2
commit 11cd0db86b
32 changed files with 585 additions and 497 deletions

View file

@ -6,16 +6,20 @@
#include <utility>
#include "base/hash/hash.h"
#include "electron/buildflags/buildflags.h"
#include "native_mate/dictionary.h"
#include "shell/common/api/atom_api_key_weak_map.h"
#include "shell/common/api/remote_callback_freer.h"
#include "shell/common/api/remote_object_freer.h"
#include "shell/common/native_mate_converters/content_converter.h"
#include "shell/common/native_mate_converters/gurl_converter.h"
#include "shell/common/node_includes.h"
#include "url/origin.h"
#include "v8/include/v8-profiler.h"
#if BUILDFLAG(ENABLE_REMOTE_MODULE)
#include "shell/common/api/atom_api_key_weak_map.h"
#include "shell/common/api/remote/remote_callback_freer.h"
#include "shell/common/api/remote/remote_object_freer.h"
#endif
namespace std {
// The hash function used by DoubleIDWeakMap.
@ -117,6 +121,7 @@ void Initialize(v8::Local<v8::Object> exports,
dict.SetMethod("deleteHiddenValue", &DeleteHiddenValue);
dict.SetMethod("getObjectHash", &GetObjectHash);
dict.SetMethod("takeHeapSnapshot", &TakeHeapSnapshot);
#if BUILDFLAG(ENABLE_REMOTE_MODULE)
dict.SetMethod("setRemoteCallbackFreer",
&electron::RemoteCallbackFreer::BindTo);
dict.SetMethod("setRemoteObjectFreer", &electron::RemoteObjectFreer::BindTo);
@ -126,6 +131,7 @@ void Initialize(v8::Local<v8::Object> exports,
dict.SetMethod(
"createDoubleIDWeakMap",
&electron::api::KeyWeakMap<std::pair<std::string, int32_t>>::Create);
#endif
dict.SetMethod("requestGarbageCollectionForTesting",
&RequestGarbageCollectionForTesting);
dict.SetMethod("isSameOrigin", &IsSameOrigin);

View file

@ -17,6 +17,10 @@ bool IsOffscreenRenderingEnabled() {
return BUILDFLAG(ENABLE_OSR);
}
bool IsRemoteModuleEnabled() {
return BUILDFLAG(ENABLE_REMOTE_MODULE);
}
bool IsPDFViewerEnabled() {
return BUILDFLAG(ENABLE_PDF_VIEWER);
}
@ -64,6 +68,7 @@ void Initialize(v8::Local<v8::Object> exports,
mate::Dictionary dict(context->GetIsolate(), exports);
dict.SetMethod("isDesktopCapturerEnabled", &IsDesktopCapturerEnabled);
dict.SetMethod("isOffscreenRenderingEnabled", &IsOffscreenRenderingEnabled);
dict.SetMethod("isRemoteModuleEnabled", &IsRemoteModuleEnabled);
dict.SetMethod("isPDFViewerEnabled", &IsPDFViewerEnabled);
dict.SetMethod("isRunAsNodeEnabled", &IsRunAsNodeEnabled);
dict.SetMethod("isFakeLocationProviderEnabled",

View file

@ -3,7 +3,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/api/object_life_monitor.h"
#include "shell/common/api/remote/object_life_monitor.h"
#include "base/bind.h"
#include "base/message_loop/message_loop.h"

View file

@ -2,8 +2,8 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_COMMON_API_OBJECT_LIFE_MONITOR_H_
#define SHELL_COMMON_API_OBJECT_LIFE_MONITOR_H_
#ifndef SHELL_COMMON_API_REMOTE_OBJECT_LIFE_MONITOR_H_
#define SHELL_COMMON_API_REMOTE_OBJECT_LIFE_MONITOR_H_
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
@ -31,4 +31,4 @@ class ObjectLifeMonitor {
} // namespace electron
#endif // SHELL_COMMON_API_OBJECT_LIFE_MONITOR_H_
#endif // SHELL_COMMON_API_REMOTE_OBJECT_LIFE_MONITOR_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/api/remote_callback_freer.h"
#include "shell/common/api/remote/remote_callback_freer.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"

View file

@ -2,13 +2,13 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_COMMON_API_REMOTE_CALLBACK_FREER_H_
#define SHELL_COMMON_API_REMOTE_CALLBACK_FREER_H_
#ifndef SHELL_COMMON_API_REMOTE_REMOTE_CALLBACK_FREER_H_
#define SHELL_COMMON_API_REMOTE_REMOTE_CALLBACK_FREER_H_
#include <string>
#include "content/public/browser/web_contents_observer.h"
#include "shell/common/api/object_life_monitor.h"
#include "shell/common/api/remote/object_life_monitor.h"
namespace electron {
@ -43,4 +43,4 @@ class RemoteCallbackFreer : public ObjectLifeMonitor,
} // namespace electron
#endif // SHELL_COMMON_API_REMOTE_CALLBACK_FREER_H_
#endif // SHELL_COMMON_API_REMOTE_REMOTE_CALLBACK_FREER_H_

View file

@ -2,7 +2,7 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include "shell/common/api/remote_object_freer.h"
#include "shell/common/api/remote/remote_object_freer.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"

View file

@ -2,13 +2,13 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef SHELL_COMMON_API_REMOTE_OBJECT_FREER_H_
#define SHELL_COMMON_API_REMOTE_OBJECT_FREER_H_
#ifndef SHELL_COMMON_API_REMOTE_REMOTE_OBJECT_FREER_H_
#define SHELL_COMMON_API_REMOTE_REMOTE_OBJECT_FREER_H_
#include <map>
#include <string>
#include "shell/common/api/object_life_monitor.h"
#include "shell/common/api/remote/object_life_monitor.h"
namespace electron {
@ -42,4 +42,4 @@ class RemoteObjectFreer : public ObjectLifeMonitor {
} // namespace electron
#endif // SHELL_COMMON_API_REMOTE_OBJECT_FREER_H_
#endif // SHELL_COMMON_API_REMOTE_REMOTE_OBJECT_FREER_H_