chore: rename atomBinding to electronBinding (#17419)
This commit is contained in:
parent
5025c991ee
commit
38d75010c7
81 changed files with 167 additions and 164 deletions
|
@ -10,7 +10,7 @@
|
|||
#include "atom/app/uv_task_runner.h"
|
||||
#include "atom/browser/javascript_environment.h"
|
||||
#include "atom/browser/node_debugger.h"
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
#include "atom/common/atom_version.h"
|
||||
#include "atom/common/crash_reporter/crash_reporter.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
|
@ -70,9 +70,9 @@ int NodeMain(int argc, char* argv[]) {
|
|||
|
||||
mate::Dictionary process(gin_env.isolate(), env->process_object());
|
||||
#if defined(OS_WIN)
|
||||
process.SetMethod("log", &AtomBindings::Log);
|
||||
process.SetMethod("log", &ElectronBindings::Log);
|
||||
#endif
|
||||
process.SetMethod("crash", &AtomBindings::Crash);
|
||||
process.SetMethod("crash", &ElectronBindings::Crash);
|
||||
|
||||
// Setup process.crashReporter.start in child node processes
|
||||
auto reporter = mate::Dictionary::CreateEmpty(gin_env.isolate());
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "atom/browser/media/media_capture_devices_dispatcher.h"
|
||||
#include "atom/browser/node_debugger.h"
|
||||
#include "atom/browser/ui/devtools_manager_delegate.h"
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
#include "atom/common/application_info.h"
|
||||
#include "atom/common/asar/asar_util.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
|
@ -234,7 +234,7 @@ AtomBrowserMainParts::AtomBrowserMainParts(
|
|||
: fake_browser_process_(new BrowserProcessImpl),
|
||||
browser_(new Browser),
|
||||
node_bindings_(NodeBindings::Create(NodeBindings::BROWSER)),
|
||||
atom_bindings_(new AtomBindings(uv_default_loop())),
|
||||
electron_bindings_(new ElectronBindings(uv_default_loop())),
|
||||
main_function_params_(params) {
|
||||
DCHECK(!self_) << "Cannot have two AtomBrowserMainParts";
|
||||
self_ = this;
|
||||
|
@ -323,7 +323,7 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
|
|||
node_debugger_->Start();
|
||||
|
||||
// Add Electron extended APIs.
|
||||
atom_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
||||
electron_bindings_->BindTo(js_env_->isolate(), env->process_object());
|
||||
|
||||
// Load everything.
|
||||
node_bindings_->LoadEnvironment(env);
|
||||
|
|
|
@ -29,7 +29,7 @@ class WMState;
|
|||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings;
|
||||
class ElectronBindings;
|
||||
class Browser;
|
||||
class JavascriptEnvironment;
|
||||
class NodeBindings;
|
||||
|
@ -123,7 +123,7 @@ class AtomBrowserMainParts : public content::BrowserMainParts {
|
|||
std::unique_ptr<Browser> browser_;
|
||||
std::unique_ptr<JavascriptEnvironment> js_env_;
|
||||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
std::unique_ptr<AtomBindings> atom_bindings_;
|
||||
std::unique_ptr<ElectronBindings> electron_bindings_;
|
||||
std::unique_ptr<NodeEnvironment> node_env_;
|
||||
std::unique_ptr<NodeDebugger> node_debugger_;
|
||||
std::unique_ptr<IconManager> icon_manager_;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
|
@ -43,23 +43,23 @@ struct DummyClass {
|
|||
// we can get the stack trace.
|
||||
void FatalErrorCallback(const char* location, const char* message) {
|
||||
LOG(ERROR) << "Fatal error in V8: " << location << " " << message;
|
||||
AtomBindings::Crash();
|
||||
ElectronBindings::Crash();
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
AtomBindings::AtomBindings(uv_loop_t* loop) {
|
||||
ElectronBindings::ElectronBindings(uv_loop_t* loop) {
|
||||
uv_async_init(loop, &call_next_tick_async_, OnCallNextTick);
|
||||
call_next_tick_async_.data = this;
|
||||
metrics_ = base::ProcessMetrics::CreateCurrentProcessMetrics();
|
||||
}
|
||||
|
||||
AtomBindings::~AtomBindings() {
|
||||
ElectronBindings::~ElectronBindings() {
|
||||
uv_close(reinterpret_cast<uv_handle_t*>(&call_next_tick_async_), nullptr);
|
||||
}
|
||||
|
||||
// static
|
||||
void AtomBindings::BindProcess(v8::Isolate* isolate,
|
||||
void ElectronBindings::BindProcess(v8::Isolate* isolate,
|
||||
mate::Dictionary* process,
|
||||
base::ProcessMetrics* metrics) {
|
||||
// These bindings are shared between sandboxed & unsandboxed renderers
|
||||
|
@ -73,7 +73,7 @@ void AtomBindings::BindProcess(v8::Isolate* isolate,
|
|||
process->SetMethod("getSystemVersion",
|
||||
&base::SysInfo::OperatingSystemVersion);
|
||||
process->SetMethod("getIOCounters", &GetIOCounters);
|
||||
process->SetMethod("getCPUUsage", base::Bind(&AtomBindings::GetCPUUsage,
|
||||
process->SetMethod("getCPUUsage", base::Bind(&ElectronBindings::GetCPUUsage,
|
||||
base::Unretained(metrics)));
|
||||
|
||||
#if defined(MAS_BUILD)
|
||||
|
@ -86,7 +86,8 @@ void AtomBindings::BindProcess(v8::Isolate* isolate,
|
|||
#endif
|
||||
}
|
||||
|
||||
void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process) {
|
||||
void ElectronBindings::BindTo(v8::Isolate* isolate,
|
||||
v8::Local<v8::Object> process) {
|
||||
isolate->SetFatalErrorHandler(FatalErrorCallback);
|
||||
|
||||
mate::Dictionary dict(isolate, process);
|
||||
|
@ -96,7 +97,7 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process) {
|
|||
#if defined(OS_POSIX)
|
||||
dict.SetMethod("setFdLimit", &base::IncreaseFdLimitTo);
|
||||
#endif
|
||||
dict.SetMethod("activateUvLoop", base::Bind(&AtomBindings::ActivateUVLoop,
|
||||
dict.SetMethod("activateUvLoop", base::Bind(&ElectronBindings::ActivateUVLoop,
|
||||
base::Unretained(this)));
|
||||
|
||||
mate::Dictionary versions;
|
||||
|
@ -106,14 +107,14 @@ void AtomBindings::BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process) {
|
|||
}
|
||||
}
|
||||
|
||||
void AtomBindings::EnvironmentDestroyed(node::Environment* env) {
|
||||
void ElectronBindings::EnvironmentDestroyed(node::Environment* env) {
|
||||
auto it =
|
||||
std::find(pending_next_ticks_.begin(), pending_next_ticks_.end(), env);
|
||||
if (it != pending_next_ticks_.end())
|
||||
pending_next_ticks_.erase(it);
|
||||
}
|
||||
|
||||
void AtomBindings::ActivateUVLoop(v8::Isolate* isolate) {
|
||||
void ElectronBindings::ActivateUVLoop(v8::Isolate* isolate) {
|
||||
node::Environment* env = node::Environment::GetCurrent(isolate);
|
||||
if (std::find(pending_next_ticks_.begin(), pending_next_ticks_.end(), env) !=
|
||||
pending_next_ticks_.end())
|
||||
|
@ -124,8 +125,8 @@ void AtomBindings::ActivateUVLoop(v8::Isolate* isolate) {
|
|||
}
|
||||
|
||||
// static
|
||||
void AtomBindings::OnCallNextTick(uv_async_t* handle) {
|
||||
AtomBindings* self = static_cast<AtomBindings*>(handle->data);
|
||||
void ElectronBindings::OnCallNextTick(uv_async_t* handle) {
|
||||
ElectronBindings* self = static_cast<ElectronBindings*>(handle->data);
|
||||
for (std::list<node::Environment*>::const_iterator it =
|
||||
self->pending_next_ticks_.begin();
|
||||
it != self->pending_next_ticks_.end(); ++it) {
|
||||
|
@ -141,23 +142,23 @@ void AtomBindings::OnCallNextTick(uv_async_t* handle) {
|
|||
}
|
||||
|
||||
// static
|
||||
void AtomBindings::Log(const base::string16& message) {
|
||||
void ElectronBindings::Log(const base::string16& message) {
|
||||
std::cout << message << std::flush;
|
||||
}
|
||||
|
||||
// static
|
||||
void AtomBindings::Crash() {
|
||||
void ElectronBindings::Crash() {
|
||||
static_cast<DummyClass*>(nullptr)->crash = true;
|
||||
}
|
||||
|
||||
// static
|
||||
void AtomBindings::Hang() {
|
||||
void ElectronBindings::Hang() {
|
||||
for (;;)
|
||||
base::PlatformThread::Sleep(base::TimeDelta::FromSeconds(1));
|
||||
}
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> AtomBindings::GetHeapStatistics(v8::Isolate* isolate) {
|
||||
v8::Local<v8::Value> ElectronBindings::GetHeapStatistics(v8::Isolate* isolate) {
|
||||
v8::HeapStatistics v8_heap_stats;
|
||||
isolate->GetHeapStatistics(&v8_heap_stats);
|
||||
|
||||
|
@ -187,7 +188,7 @@ v8::Local<v8::Value> AtomBindings::GetHeapStatistics(v8::Isolate* isolate) {
|
|||
}
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> AtomBindings::GetCreationTime(v8::Isolate* isolate) {
|
||||
v8::Local<v8::Value> ElectronBindings::GetCreationTime(v8::Isolate* isolate) {
|
||||
auto timeValue = base::Process::Current().CreationTime();
|
||||
if (timeValue.is_null()) {
|
||||
return v8::Null(isolate);
|
||||
|
@ -197,7 +198,8 @@ v8::Local<v8::Value> AtomBindings::GetCreationTime(v8::Isolate* isolate) {
|
|||
}
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> AtomBindings::GetSystemMemoryInfo(v8::Isolate* isolate,
|
||||
v8::Local<v8::Value> ElectronBindings::GetSystemMemoryInfo(
|
||||
v8::Isolate* isolate,
|
||||
mate::Arguments* args) {
|
||||
base::SystemMemoryInfoKB mem_info;
|
||||
if (!base::GetSystemMemoryInfo(&mem_info)) {
|
||||
|
@ -228,7 +230,7 @@ v8::Local<v8::Value> AtomBindings::GetSystemMemoryInfo(v8::Isolate* isolate,
|
|||
}
|
||||
|
||||
// static
|
||||
v8::Local<v8::Promise> AtomBindings::GetProcessMemoryInfo(
|
||||
v8::Local<v8::Promise> ElectronBindings::GetProcessMemoryInfo(
|
||||
v8::Isolate* isolate) {
|
||||
util::Promise promise(isolate);
|
||||
v8::Local<v8::Promise> handle = promise.GetHandle();
|
||||
|
@ -243,13 +245,13 @@ v8::Local<v8::Promise> AtomBindings::GetProcessMemoryInfo(
|
|||
memory_instrumentation::MemoryInstrumentation::GetInstance()
|
||||
->RequestGlobalDumpForPid(
|
||||
base::GetCurrentProcId(), std::vector<std::string>(),
|
||||
base::BindOnce(&AtomBindings::DidReceiveMemoryDump,
|
||||
base::BindOnce(&ElectronBindings::DidReceiveMemoryDump,
|
||||
std::move(context), std::move(promise)));
|
||||
return handle;
|
||||
}
|
||||
|
||||
// static
|
||||
void AtomBindings::DidReceiveMemoryDump(
|
||||
void ElectronBindings::DidReceiveMemoryDump(
|
||||
v8::Global<v8::Context> context,
|
||||
util::Promise promise,
|
||||
bool success,
|
||||
|
@ -290,7 +292,8 @@ void AtomBindings::DidReceiveMemoryDump(
|
|||
}
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> AtomBindings::GetCPUUsage(base::ProcessMetrics* metrics,
|
||||
v8::Local<v8::Value> ElectronBindings::GetCPUUsage(
|
||||
base::ProcessMetrics* metrics,
|
||||
v8::Isolate* isolate) {
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
dict.SetHidden("simple", true);
|
||||
|
@ -310,7 +313,7 @@ v8::Local<v8::Value> AtomBindings::GetCPUUsage(base::ProcessMetrics* metrics,
|
|||
}
|
||||
|
||||
// static
|
||||
v8::Local<v8::Value> AtomBindings::GetIOCounters(v8::Isolate* isolate) {
|
||||
v8::Local<v8::Value> ElectronBindings::GetIOCounters(v8::Isolate* isolate) {
|
||||
auto metrics = base::ProcessMetrics::CreateCurrentProcessMetrics();
|
||||
base::IoCounters io_counters;
|
||||
mate::Dictionary dict = mate::Dictionary::CreateEmpty(isolate);
|
||||
|
@ -329,7 +332,7 @@ v8::Local<v8::Value> AtomBindings::GetIOCounters(v8::Isolate* isolate) {
|
|||
}
|
||||
|
||||
// static
|
||||
bool AtomBindings::TakeHeapSnapshot(v8::Isolate* isolate,
|
||||
bool ElectronBindings::TakeHeapSnapshot(v8::Isolate* isolate,
|
||||
const base::FilePath& file_path) {
|
||||
base::ThreadRestrictions::ScopedAllowIO allow_io;
|
||||
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef ATOM_COMMON_API_ATOM_BINDINGS_H_
|
||||
#define ATOM_COMMON_API_ATOM_BINDINGS_H_
|
||||
#ifndef ATOM_COMMON_API_ELECTRON_BINDINGS_H_
|
||||
#define ATOM_COMMON_API_ELECTRON_BINDINGS_H_
|
||||
|
||||
#include <list>
|
||||
#include <memory>
|
||||
|
@ -32,13 +32,13 @@ class Environment;
|
|||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings {
|
||||
class ElectronBindings {
|
||||
public:
|
||||
explicit AtomBindings(uv_loop_t* loop);
|
||||
virtual ~AtomBindings();
|
||||
explicit ElectronBindings(uv_loop_t* loop);
|
||||
virtual ~ElectronBindings();
|
||||
|
||||
// Add process.atomBinding function, which behaves like process.binding but
|
||||
// load native code from Electron instead.
|
||||
// Add process.electronBinding function, which behaves like process.binding
|
||||
// but load native code from Electron instead.
|
||||
void BindTo(v8::Isolate* isolate, v8::Local<v8::Object> process);
|
||||
|
||||
// Should be called when a node::Environment has been destroyed.
|
||||
|
@ -78,9 +78,9 @@ class AtomBindings {
|
|||
std::list<node::Environment*> pending_next_ticks_;
|
||||
std::unique_ptr<base::ProcessMetrics> metrics_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(AtomBindings);
|
||||
DISALLOW_COPY_AND_ASSIGN(ElectronBindings);
|
||||
};
|
||||
|
||||
} // namespace atom
|
||||
|
||||
#endif // ATOM_COMMON_API_ATOM_BINDINGS_H_
|
||||
#endif // ATOM_COMMON_API_ELECTRON_BINDINGS_H_
|
|
@ -7,7 +7,7 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
#include "atom/common/api/event_emitter_caller.h"
|
||||
#include "atom/common/asar/asar_util.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
|
@ -35,7 +35,7 @@ bool IsDevToolsExtension(content::RenderFrame* render_frame) {
|
|||
|
||||
AtomRendererClient::AtomRendererClient()
|
||||
: node_bindings_(NodeBindings::Create(NodeBindings::RENDERER)),
|
||||
atom_bindings_(new AtomBindings(uv_default_loop())) {}
|
||||
electron_bindings_(new ElectronBindings(uv_default_loop())) {}
|
||||
|
||||
AtomRendererClient::~AtomRendererClient() {
|
||||
asar::ClearArchives();
|
||||
|
@ -114,7 +114,7 @@ void AtomRendererClient::DidCreateScriptContext(
|
|||
environments_.insert(env);
|
||||
|
||||
// Add Electron extended APIs.
|
||||
atom_bindings_->BindTo(env->isolate(), env->process_object());
|
||||
electron_bindings_->BindTo(env->isolate(), env->process_object());
|
||||
AddRenderBindings(env->isolate(), env->process_object());
|
||||
mate::Dictionary process_dict(env->isolate(), env->process_object());
|
||||
process_dict.SetReadOnly("isMainFrame", render_frame->IsMainFrame());
|
||||
|
@ -157,8 +157,8 @@ void AtomRendererClient::WillReleaseScriptContext(
|
|||
switches::kNodeIntegrationInSubFrames))
|
||||
node::FreeEnvironment(env);
|
||||
|
||||
// AtomBindings is tracking node environments.
|
||||
atom_bindings_->EnvironmentDestroyed(env);
|
||||
// ElectronBindings is tracking node environments.
|
||||
electron_bindings_->EnvironmentDestroyed(env);
|
||||
}
|
||||
|
||||
bool AtomRendererClient::ShouldFork(blink::WebLocalFrame* frame,
|
||||
|
|
|
@ -18,7 +18,7 @@ class Environment;
|
|||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings;
|
||||
class ElectronBindings;
|
||||
class NodeBindings;
|
||||
|
||||
class AtomRendererClient : public RendererClientBase {
|
||||
|
@ -60,7 +60,7 @@ class AtomRendererClient : public RendererClientBase {
|
|||
bool node_integration_initialized_ = false;
|
||||
|
||||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
std::unique_ptr<AtomBindings> atom_bindings_;
|
||||
std::unique_ptr<ElectronBindings> electron_bindings_;
|
||||
|
||||
// The node::Environment::GetCurrent API does not return nullptr when it
|
||||
// is called for a context without node::Environment, so we have to keep
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "atom/renderer/atom_sandboxed_renderer_client.h"
|
||||
|
||||
#include "atom/common/api/api_messages.h"
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
#include "atom/common/application_info.h"
|
||||
#include "atom/common/native_mate_converters/string16_converter.h"
|
||||
#include "atom/common/native_mate_converters/value_converter.h"
|
||||
|
@ -149,7 +149,7 @@ void AtomSandboxedRendererClient::InitializeBindings(
|
|||
mate::Dictionary process = mate::Dictionary::CreateEmpty(isolate);
|
||||
b.Set("process", process);
|
||||
|
||||
AtomBindings::BindProcess(isolate, &process, metrics_.get());
|
||||
ElectronBindings::BindProcess(isolate, &process, metrics_.get());
|
||||
|
||||
process.Set("argv", base::CommandLine::ForCurrentProcess()->argv());
|
||||
process.SetReadOnly("pid", base::GetCurrentProcId());
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
#include "atom/renderer/web_worker_observer.h"
|
||||
|
||||
#include "atom/common/api/atom_bindings.h"
|
||||
#include "atom/common/api/electron_bindings.h"
|
||||
#include "atom/common/api/event_emitter_caller.h"
|
||||
#include "atom/common/asar/asar_util.h"
|
||||
#include "atom/common/node_bindings.h"
|
||||
|
@ -30,7 +30,7 @@ WebWorkerObserver* WebWorkerObserver::GetCurrent() {
|
|||
|
||||
WebWorkerObserver::WebWorkerObserver()
|
||||
: node_bindings_(NodeBindings::Create(NodeBindings::WORKER)),
|
||||
atom_bindings_(new AtomBindings(node_bindings_->uv_loop())) {
|
||||
electron_bindings_(new ElectronBindings(node_bindings_->uv_loop())) {
|
||||
lazy_tls.Pointer()->Set(this);
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ void WebWorkerObserver::ContextCreated(v8::Local<v8::Context> context) {
|
|||
node::Environment* env = node_bindings_->CreateEnvironment(context);
|
||||
|
||||
// Add Electron extended APIs.
|
||||
atom_bindings_->BindTo(env->isolate(), env->process_object());
|
||||
electron_bindings_->BindTo(env->isolate(), env->process_object());
|
||||
|
||||
// Load everything.
|
||||
node_bindings_->LoadEnvironment(env);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
namespace atom {
|
||||
|
||||
class AtomBindings;
|
||||
class ElectronBindings;
|
||||
class NodeBindings;
|
||||
|
||||
// Watches for WebWorker and insert node integration to it.
|
||||
|
@ -29,7 +29,7 @@ class WebWorkerObserver {
|
|||
~WebWorkerObserver();
|
||||
|
||||
std::unique_ptr<NodeBindings> node_bindings_;
|
||||
std::unique_ptr<AtomBindings> atom_bindings_;
|
||||
std::unique_ptr<ElectronBindings> electron_bindings_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(WebWorkerObserver);
|
||||
};
|
||||
|
|
|
@ -541,8 +541,8 @@ filenames = {
|
|||
"atom/common/api/atom_api_native_image_mac.mm",
|
||||
"atom/common/api/atom_api_shell.cc",
|
||||
"atom/common/api/atom_api_v8_util.cc",
|
||||
"atom/common/api/atom_bindings.cc",
|
||||
"atom/common/api/atom_bindings.h",
|
||||
"atom/common/api/electron_bindings.cc",
|
||||
"atom/common/api/electron_bindings.h",
|
||||
"atom/common/api/constructor.h",
|
||||
"atom/common/api/event_emitter_caller.cc",
|
||||
"atom/common/api/event_emitter_caller.h",
|
||||
|
|
|
@ -3,8 +3,8 @@ import * as path from 'path'
|
|||
import * as electron from 'electron'
|
||||
import { EventEmitter } from 'events'
|
||||
|
||||
const bindings = process.atomBinding('app')
|
||||
const commandLine = process.atomBinding('command_line')
|
||||
const bindings = process.electronBinding('app')
|
||||
const commandLine = process.electronBinding('command_line')
|
||||
const { app, App } = bindings
|
||||
|
||||
// Only one app object permitted.
|
||||
|
@ -64,5 +64,5 @@ for (const name of events) {
|
|||
}
|
||||
|
||||
// Wrappers for native classes.
|
||||
const { DownloadItem } = process.atomBinding('download_item')
|
||||
const { DownloadItem } = process.electronBinding('download_item')
|
||||
Object.setPrototypeOf(DownloadItem.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const { autoUpdater, AutoUpdater } = process.atomBinding('auto_updater')
|
||||
const { autoUpdater, AutoUpdater } = process.electronBinding('auto_updater')
|
||||
|
||||
// AutoUpdater is an EventEmitter.
|
||||
Object.setPrototypeOf(AutoUpdater.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { BrowserView } = process.atomBinding('browser_view')
|
||||
const { BrowserView } = process.electronBinding('browser_view')
|
||||
|
||||
Object.setPrototypeOf(BrowserView.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const electron = require('electron')
|
||||
const { WebContentsView, TopLevelWindow } = electron
|
||||
const { BrowserWindow } = process.atomBinding('window')
|
||||
const { BrowserWindow } = process.electronBinding('window')
|
||||
|
||||
Object.setPrototypeOf(BrowserWindow.prototype, TopLevelWindow.prototype)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
const { deprecate } = require('electron')
|
||||
const contentTracing = process.atomBinding('content_tracing')
|
||||
const contentTracing = process.electronBinding('content_tracing')
|
||||
|
||||
contentTracing.getCategories = deprecate.promisify(contentTracing.getCategories)
|
||||
contentTracing.startRecording = deprecate.promisify(contentTracing.startRecording)
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
const { app, BrowserWindow, deprecate } = require('electron')
|
||||
const binding = process.atomBinding('dialog')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const binding = process.electronBinding('dialog')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
const fileDialogProperties = {
|
||||
openFile: 1 << 0,
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = process.atomBinding('global_shortcut').globalShortcut
|
||||
module.exports = process.electronBinding('global_shortcut').globalShortcut
|
||||
|
|
|
@ -4,7 +4,7 @@ const { deprecate } = require('electron')
|
|||
|
||||
if (process.platform === 'darwin') {
|
||||
const { EventEmitter } = require('events')
|
||||
const { inAppPurchase, InAppPurchase } = process.atomBinding('in_app_purchase')
|
||||
const { inAppPurchase, InAppPurchase } = process.electronBinding('in_app_purchase')
|
||||
|
||||
// inAppPurchase is an EventEmitter.
|
||||
Object.setPrototypeOf(InAppPurchase.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -3,8 +3,8 @@
|
|||
const { TopLevelWindow, MenuItem, webContents } = require('electron')
|
||||
const { sortMenuItems } = require('@electron/internal/browser/api/menu-utils')
|
||||
const EventEmitter = require('events').EventEmitter
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const bindings = process.atomBinding('menu')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
const bindings = process.electronBinding('menu')
|
||||
|
||||
const { Menu } = bindings
|
||||
let applicationMenu = null
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
// Browser side modules, please sort alphabetically.
|
||||
module.exports = [
|
||||
|
|
|
@ -4,8 +4,8 @@ const url = require('url')
|
|||
const { EventEmitter } = require('events')
|
||||
const { Readable } = require('stream')
|
||||
const { app } = require('electron')
|
||||
const { Session } = process.atomBinding('session')
|
||||
const { net, Net } = process.atomBinding('net')
|
||||
const { Session } = process.electronBinding('session')
|
||||
const { net, Net } = process.electronBinding('net')
|
||||
const { URLRequest } = net
|
||||
|
||||
// Net is an EventEmitter.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { Notification, isSupported } = process.atomBinding('notification')
|
||||
const { Notification, isSupported } = process.electronBinding('notification')
|
||||
|
||||
Object.setPrototypeOf(Notification.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { powerMonitor, PowerMonitor } = process.atomBinding('power_monitor')
|
||||
const { powerMonitor, PowerMonitor } = process.electronBinding('power_monitor')
|
||||
const { deprecate } = require('electron')
|
||||
|
||||
// PowerMonitor is an EventEmitter.
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = process.atomBinding('power_save_blocker').powerSaveBlocker
|
||||
module.exports = process.electronBinding('power_save_blocker').powerSaveBlocker
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { app, session } from 'electron'
|
||||
|
||||
// Global protocol APIs.
|
||||
const protocol = process.atomBinding('protocol')
|
||||
const protocol = process.electronBinding('protocol')
|
||||
|
||||
// Fallback protocol APIs of default session.
|
||||
Object.setPrototypeOf(protocol, new Proxy({}, {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { screen, Screen } = process.atomBinding('screen')
|
||||
const { screen, Screen } = process.electronBinding('screen')
|
||||
|
||||
// Screen is an EventEmitter.
|
||||
Object.setPrototypeOf(Screen.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const { EventEmitter } = require('events')
|
||||
const { app, deprecate } = require('electron')
|
||||
const { fromPartition, Session, Cookies, NetLog, Protocol } = process.atomBinding('session')
|
||||
const { fromPartition, Session, Cookies, NetLog, Protocol } = process.electronBinding('session')
|
||||
|
||||
// Public API.
|
||||
Object.defineProperties(exports, {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { systemPreferences, SystemPreferences } = process.atomBinding('system_preferences')
|
||||
const { systemPreferences, SystemPreferences } = process.electronBinding('system_preferences')
|
||||
|
||||
// SystemPreferences is an EventEmitter.
|
||||
Object.setPrototypeOf(SystemPreferences.prototype, EventEmitter.prototype)
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
const electron = require('electron')
|
||||
const { EventEmitter } = require('events')
|
||||
const { TopLevelWindow } = process.atomBinding('top_level_window')
|
||||
const { TopLevelWindow } = process.electronBinding('top_level_window')
|
||||
|
||||
Object.setPrototypeOf(TopLevelWindow.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { Tray } = process.atomBinding('tray')
|
||||
const { Tray } = process.electronBinding('tray')
|
||||
|
||||
Object.setPrototypeOf(Tray.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { EventEmitter } = require('events')
|
||||
const { View } = process.atomBinding('view')
|
||||
const { View } = process.electronBinding('view')
|
||||
|
||||
Object.setPrototypeOf(View.prototype, EventEmitter.prototype)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { LayoutManager } = electron
|
||||
const { BoxLayout } = process.atomBinding('box_layout')
|
||||
const { BoxLayout } = process.electronBinding('box_layout')
|
||||
|
||||
Object.setPrototypeOf(BoxLayout.prototype, LayoutManager.prototype)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { View } = electron
|
||||
const { Button } = process.atomBinding('button')
|
||||
const { Button } = process.electronBinding('button')
|
||||
|
||||
Object.setPrototypeOf(Button.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { Button } = electron
|
||||
const { LabelButton } = process.atomBinding('label_button')
|
||||
const { LabelButton } = process.electronBinding('label_button')
|
||||
|
||||
Object.setPrototypeOf(LabelButton.prototype, Button.prototype)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const { LayoutManager } = process.atomBinding('layout_manager')
|
||||
const { LayoutManager } = process.electronBinding('layout_manager')
|
||||
|
||||
LayoutManager.prototype._init = function () {
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { LabelButton } = electron
|
||||
const { MdTextButton } = process.atomBinding('md_text_button')
|
||||
const { MdTextButton } = process.electronBinding('md_text_button')
|
||||
|
||||
Object.setPrototypeOf(MdTextButton.prototype, LabelButton.prototype)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { View } = electron
|
||||
const { ResizeArea } = process.atomBinding('resize_area')
|
||||
const { ResizeArea } = process.electronBinding('resize_area')
|
||||
|
||||
Object.setPrototypeOf(ResizeArea.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { View } = electron
|
||||
const { TextField } = process.atomBinding('text_field')
|
||||
const { TextField } = process.electronBinding('text_field')
|
||||
|
||||
Object.setPrototypeOf(TextField.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
const electron = require('electron')
|
||||
|
||||
const { View } = electron
|
||||
const { WebContentsView } = process.atomBinding('web_contents_view')
|
||||
const { WebContentsView } = process.electronBinding('web_contents_view')
|
||||
|
||||
Object.setPrototypeOf(WebContentsView.prototype, View.prototype)
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
const { EventEmitter } = require('events')
|
||||
const electron = require('electron')
|
||||
const path = require('path')
|
||||
|
@ -95,7 +95,7 @@ const defaultPrintingSetting = {
|
|||
}
|
||||
|
||||
// JavaScript implementations of WebContents.
|
||||
const binding = process.atomBinding('web_contents')
|
||||
const binding = process.electronBinding('web_contents')
|
||||
const { WebContents } = binding
|
||||
|
||||
Object.setPrototypeOf(NavigationController.prototype, EventEmitter.prototype)
|
||||
|
@ -467,7 +467,7 @@ WebContents.prototype._init = function () {
|
|||
}
|
||||
|
||||
// JavaScript wrapper of Debugger.
|
||||
const { Debugger } = process.atomBinding('debugger')
|
||||
const { Debugger } = process.electronBinding('debugger')
|
||||
|
||||
Debugger.prototype.sendCommand = deprecate.promisify(Debugger.prototype.sendCommand)
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
'use strict'
|
||||
|
||||
const { app, webContents, BrowserWindow } = require('electron')
|
||||
const { getAllWebContents } = process.atomBinding('web_contents')
|
||||
const renderProcessPreferences = process.atomBinding('render_process_preferences').forAllWebContents()
|
||||
const { getAllWebContents } = process.electronBinding('web_contents')
|
||||
const renderProcessPreferences = process.electronBinding('render_process_preferences').forAllWebContents()
|
||||
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal')
|
||||
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils')
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { shell, Menu } from 'electron'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
const isMac = process.platform === 'darwin'
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
const ipcMainUtils = require('@electron/internal/browser/ipc-main-internal-utils')
|
||||
|
||||
const { desktopCapturer } = process.atomBinding('desktop_capturer')
|
||||
const eventBinding = process.atomBinding('event')
|
||||
const { desktopCapturer } = process.electronBinding('desktop_capturer')
|
||||
const eventBinding = process.electronBinding('event')
|
||||
|
||||
const deepEqual = (a, b) => JSON.stringify(a) === JSON.stringify(b)
|
||||
|
||||
|
|
|
@ -61,7 +61,7 @@ const getNextGuestInstanceId = function () {
|
|||
// Create a new guest instance.
|
||||
const createGuest = function (embedder, params) {
|
||||
if (webViewManager == null) {
|
||||
webViewManager = process.atomBinding('web_view_manager')
|
||||
webViewManager = process.electronBinding('web_view_manager')
|
||||
}
|
||||
|
||||
const guestInstanceId = getNextGuestInstanceId(embedder)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const { BrowserWindow, webContents } = require('electron')
|
||||
const { isSameOrigin } = process.atomBinding('v8_util')
|
||||
const { isSameOrigin } = process.electronBinding('v8_util')
|
||||
const { ipcMainInternal } = require('@electron/internal/browser/ipc-main-internal')
|
||||
const parseFeaturesString = require('@electron/internal/common/parse-features-string')
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ require('@electron/internal/browser/chrome-devtools')
|
|||
// Load the chrome extension support.
|
||||
require('@electron/internal/browser/chrome-extension')
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
if (features.isDesktopCapturerEnabled()) {
|
||||
// Load internal desktop-capturer module.
|
||||
require('@electron/internal/browser/desktop-capturer')
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
const getOwnerKey = (webContents, contextId) => {
|
||||
return `${webContents.id}-${contextId}`
|
||||
|
|
|
@ -5,9 +5,9 @@ const { EventEmitter } = require('events')
|
|||
const fs = require('fs')
|
||||
const util = require('util')
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const eventBinding = process.atomBinding('event')
|
||||
const clipboard = process.atomBinding('clipboard')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
const eventBinding = process.electronBinding('event')
|
||||
const clipboard = process.electronBinding('clipboard')
|
||||
|
||||
const { isPromise } = electron
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const clipboard = process.atomBinding('clipboard')
|
||||
const clipboard = process.electronBinding('clipboard')
|
||||
|
||||
if (process.type === 'renderer') {
|
||||
const ipcRendererUtils = require('@electron/internal/renderer/ipc-renderer-internal-utils')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
'use strict'
|
||||
|
||||
const { nativeImage } = process.atomBinding('native_image')
|
||||
const { nativeImage } = process.electronBinding('native_image')
|
||||
|
||||
module.exports = nativeImage
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
'use strict'
|
||||
|
||||
module.exports = process.atomBinding('shell')
|
||||
module.exports = process.electronBinding('shell')
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
export function atomBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['atomBinding'] {
|
||||
return function atomBinding (name: string) {
|
||||
export function electronBindingSetup (binding: typeof process['_linkedBinding'], processType: typeof process['type']): typeof process['electronBinding'] {
|
||||
return function electronBinding (name: string) {
|
||||
try {
|
||||
return binding(`atom_${processType}_${name}`)
|
||||
} catch (error) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const { nativeImage, NativeImage } = process.atomBinding('native_image')
|
||||
const { nativeImage, NativeImage } = process.electronBinding('native_image')
|
||||
|
||||
const objectMap = function (source, mapper) {
|
||||
const sourceEntries = Object.entries(source)
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const binding = process.atomBinding('crash_reporter')
|
||||
const binding = process.electronBinding('crash_reporter')
|
||||
|
||||
class CrashReporter {
|
||||
contructor () {
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import * as timers from 'timers'
|
||||
import * as util from 'util'
|
||||
|
||||
import { atomBindingSetup } from '@electron/internal/common/atom-binding-setup'
|
||||
import { electronBindingSetup } from '@electron/internal/common/atom-binding-setup'
|
||||
|
||||
process.atomBinding = atomBindingSetup(process._linkedBinding, process.type)
|
||||
process.electronBinding = electronBindingSetup(process._linkedBinding, process.type)
|
||||
|
||||
type AnyFn = (...args: any[]) => any
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
|
||||
const { EventEmitter } = require('events')
|
||||
|
||||
process.atomBinding = require('@electron/internal/common/atom-binding-setup').atomBindingSetup(nodeProcess.binding, 'renderer')
|
||||
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer')
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
// The `lib/renderer/ipc-renderer-internal.js` module looks for the ipc object in the
|
||||
// "ipc-internal" hidden value
|
||||
v8Util.setHiddenValue(global, 'ipc-internal', new EventEmitter())
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
|
||||
/* global nodeProcess, isolatedWorld */
|
||||
|
||||
const atomBinding = require('@electron/internal/common/atom-binding-setup').atomBindingSetup(nodeProcess.binding, 'renderer')
|
||||
const electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(nodeProcess.binding, 'renderer')
|
||||
|
||||
const v8Util = atomBinding('v8_util')
|
||||
const v8Util = electronBinding('v8_util')
|
||||
|
||||
const webViewImpl = v8Util.getHiddenValue(isolatedWorld, 'web-view-impl')
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const binding = process.atomBinding('ipc')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const binding = process.electronBinding('ipc')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
// Created by init.js.
|
||||
const ipcRenderer = v8Util.getHiddenValue(global, 'ipc')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
'use strict'
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const features = process.electronBinding('features')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
const enableRemoteModule = v8Util.getHiddenValue(global, 'enableRemoteModule')
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
const { isPromise } = require('electron')
|
||||
const resolvePromise = Promise.resolve.bind(Promise)
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { EventEmitter } from 'events'
|
||||
import { deprecate } from 'electron'
|
||||
|
||||
const binding = process.atomBinding('web_frame')
|
||||
const binding = process.electronBinding('web_frame')
|
||||
|
||||
class WebFrame extends EventEmitter {
|
||||
constructor (public context: Window) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
class CallbacksRegistry {
|
||||
constructor () {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'
|
||||
import { webFrame } from 'electron'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
const IsolatedWorldIDs = {
|
||||
/**
|
||||
|
|
|
@ -20,7 +20,7 @@ const globalPaths = Module.globalPaths
|
|||
globalPaths.push(path.join(__dirname, 'api', 'exports'))
|
||||
|
||||
// The global variable will be used by ipc for event dispatching
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
v8Util.setHiddenValue(global, 'ipc', new EventEmitter())
|
||||
v8Util.setHiddenValue(global, 'ipc-internal', new EventEmitter())
|
||||
|
@ -31,7 +31,7 @@ const { webFrameInit } = require('@electron/internal/renderer/web-frame-init')
|
|||
webFrameInit()
|
||||
|
||||
// Process command line arguments.
|
||||
const { hasSwitch, getSwitchValue } = process.atomBinding('command_line')
|
||||
const { hasSwitch, getSwitchValue } = process.electronBinding('command_line')
|
||||
|
||||
const parseOption = function<T> (
|
||||
name: string, defaultValue: T, converter?: (value: string) => T
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
const binding = process.atomBinding('ipc')
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const binding = process.electronBinding('ipc')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
// Created by init.js.
|
||||
export const ipcRendererInternal: Electron.IpcRendererInternal = v8Util.getHiddenValue(global, 'ipc-internal')
|
||||
|
|
|
@ -9,7 +9,7 @@ import {
|
|||
asyncPromiseMethods
|
||||
} from '@electron/internal/common/web-view-methods'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
// ID generator.
|
||||
let nextId = 0
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { ipcRendererInternal } from '@electron/internal/renderer/ipc-renderer-internal'
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
|
||||
function handleFocusBlur (guestInstanceId: number) {
|
||||
// Note that while Chromium content APIs have observer for focus/blur, they
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
'use strict'
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
module.exports = [
|
||||
{
|
||||
|
|
|
@ -5,9 +5,9 @@
|
|||
const events = require('events')
|
||||
const { EventEmitter } = events
|
||||
|
||||
process.atomBinding = require('@electron/internal/common/atom-binding-setup').atomBindingSetup(binding.get, 'renderer')
|
||||
process.electronBinding = require('@electron/internal/common/atom-binding-setup').electronBindingSetup(binding.get, 'renderer')
|
||||
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
// Expose browserify Buffer as a hidden value. This is used by C++ code to
|
||||
// deserialize Buffer instances sent from browser process.
|
||||
v8Util.setHiddenValue(global, 'Buffer', Buffer)
|
||||
|
@ -35,7 +35,7 @@ const {
|
|||
|
||||
process.isRemoteModuleEnabled = isRemoteModuleEnabled
|
||||
|
||||
// The electron module depends on process.atomBinding
|
||||
// The electron module depends on process.electronBinding
|
||||
const electron = require('electron')
|
||||
|
||||
const loadedModules = new Map([
|
||||
|
@ -47,7 +47,7 @@ const loadedModules = new Map([
|
|||
|
||||
// AtomSandboxedRendererClient will look for the "ipcNative" hidden object when
|
||||
// invoking the `onMessage`/`onExit` callbacks.
|
||||
const ipcNative = process.atomBinding('ipc')
|
||||
const ipcNative = process.electronBinding('ipc')
|
||||
v8Util.setHiddenValue(global, 'ipcNative', ipcNative)
|
||||
|
||||
ipcNative.onMessage = function (internal, channel, args, senderId) {
|
||||
|
@ -74,7 +74,7 @@ const { webFrameInit } = require('@electron/internal/renderer/web-frame-init')
|
|||
webFrameInit()
|
||||
|
||||
// Pass different process object to the preload script(which should not have
|
||||
// access to things like `process.atomBinding`).
|
||||
// access to things like `process.electronBinding`).
|
||||
const preloadProcess = new EventEmitter()
|
||||
|
||||
Object.assign(preloadProcess, binding.process)
|
||||
|
@ -103,7 +103,7 @@ function preloadRequire (module) {
|
|||
}
|
||||
|
||||
// Process command line arguments.
|
||||
const { hasSwitch } = process.atomBinding('command_line')
|
||||
const { hasSwitch } = process.electronBinding('command_line')
|
||||
|
||||
const isBackgroundPage = hasSwitch('background-page')
|
||||
const contextIsolation = hasSwitch('context-isolation')
|
||||
|
|
|
@ -1151,7 +1151,7 @@ describe('app module', () => {
|
|||
|
||||
it('keeps references to the menu', () => {
|
||||
app.dock.setMenu(new Menu())
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
v8Util.requestGarbageCollectionForTesting()
|
||||
})
|
||||
})
|
||||
|
|
|
@ -13,7 +13,7 @@ const { emittedOnce } = require('./events-helpers')
|
|||
const { ipcRenderer, remote } = require('electron')
|
||||
const { app, ipcMain, BrowserWindow, BrowserView, protocol, session, screen, webContents } = remote
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
const { expect } = chai
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled')
|
||||
|
|
|
@ -3,7 +3,7 @@ const dirtyChai = require('dirty-chai')
|
|||
const chaiAsPromised = require('chai-as-promised')
|
||||
const { desktopCapturer, ipcRenderer, remote } = require('electron')
|
||||
const { screen } = remote
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
const { emittedOnce } = require('./events-helpers')
|
||||
|
||||
const { expect } = chai
|
||||
|
|
|
@ -1537,7 +1537,7 @@ describe('net module', () => {
|
|||
const {net} = require('electron')
|
||||
const urlRequest = net.request('${server.url}${requestUrl}')
|
||||
process.nextTick(() => {
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
v8Util.requestGarbageCollectionForTesting()
|
||||
event.sender.send('api-net-spec-done')
|
||||
})
|
||||
|
@ -1577,7 +1577,7 @@ describe('net module', () => {
|
|||
})
|
||||
process.nextTick(() => {
|
||||
// Trigger a garbage collection.
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
v8Util.requestGarbageCollectionForTesting()
|
||||
event.sender.send('api-net-spec-resume')
|
||||
})
|
||||
|
@ -1613,7 +1613,7 @@ describe('net module', () => {
|
|||
})
|
||||
urlRequest.on('close', () => {
|
||||
process.nextTick(() => {
|
||||
const v8Util = process.atomBinding('v8_util')
|
||||
const v8Util = process.electronBinding('v8_util')
|
||||
v8Util.requestGarbageCollectionForTesting()
|
||||
event.sender.send('api-net-spec-done')
|
||||
})
|
||||
|
|
|
@ -10,7 +10,7 @@ const { emittedOnce } = require('./events-helpers')
|
|||
const chai = require('chai')
|
||||
const dirtyChai = require('dirty-chai')
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
const { ipcRenderer, remote, clipboard } = require('electron')
|
||||
const { BrowserWindow, webContents, ipcMain, session } = remote
|
||||
const { expect } = chai
|
||||
|
|
|
@ -12,7 +12,7 @@ const remote = require('electron').remote
|
|||
|
||||
const { ipcMain, BrowserWindow } = remote
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
describe('asar package', function () {
|
||||
const fixtures = path.join(__dirname, 'fixtures')
|
||||
|
|
|
@ -13,7 +13,7 @@ const { closeWindow, waitForWebContentsToLoad } = require('./window-helpers')
|
|||
const { resolveGetters } = require('./assert-helpers')
|
||||
const { app, BrowserWindow, ipcMain, protocol, session, webContents } = remote
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
const { expect } = chai
|
||||
chai.use(dirtyChai)
|
||||
|
@ -83,7 +83,7 @@ describe('chromium feature', () => {
|
|||
|
||||
describe('heap snapshot', () => {
|
||||
it('does not crash', function () {
|
||||
process.atomBinding('v8_util').takeHeapSnapshot()
|
||||
process.electronBinding('v8_util').takeHeapSnapshot()
|
||||
})
|
||||
})
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ const fs = require('fs')
|
|||
const { remote } = require('electron')
|
||||
const { BrowserWindow } = remote
|
||||
const { closeWindow } = require('./window-helpers')
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled')
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ const fs = require('fs')
|
|||
const path = require('path')
|
||||
const os = require('os')
|
||||
const { ipcRenderer, remote } = require('electron')
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
chai.use(dirtyChai)
|
||||
|
|
|
@ -12,7 +12,7 @@ const { emittedOnce, waitForEvent } = require('./events-helpers')
|
|||
const { expect } = chai
|
||||
chai.use(dirtyChai)
|
||||
|
||||
const features = process.atomBinding('features')
|
||||
const features = process.electronBinding('features')
|
||||
const isCI = remote.getGlobal('isCi')
|
||||
const nativeModulesEnabled = remote.getGlobal('nativeModulesEnabled')
|
||||
|
||||
|
|
12
typings/internal-ambient.d.ts
vendored
12
typings/internal-ambient.d.ts
vendored
|
@ -17,14 +17,14 @@ declare namespace NodeJS {
|
|||
}
|
||||
interface Process {
|
||||
/**
|
||||
* DO NOT USE DIRECTLY, USE process.atomBinding
|
||||
* DO NOT USE DIRECTLY, USE process.electronBinding
|
||||
*/
|
||||
_linkedBinding(name: string): any;
|
||||
atomBinding(name: string): any;
|
||||
atomBinding(name: 'features'): FeaturesBinding;
|
||||
atomBinding(name: 'v8_util'): V8UtilBinding;
|
||||
atomBinding(name: 'app'): { app: Electron.App, App: Function };
|
||||
atomBinding(name: 'command_line'): Electron.CommandLine;
|
||||
electronBinding(name: string): any;
|
||||
electronBinding(name: 'features'): FeaturesBinding;
|
||||
electronBinding(name: 'v8_util'): V8UtilBinding;
|
||||
electronBinding(name: 'app'): { app: Electron.App, App: Function };
|
||||
electronBinding(name: 'command_line'): Electron.CommandLine;
|
||||
log: NodeJS.WriteStream['write'];
|
||||
activateUvLoop(): void;
|
||||
|
||||
|
|
Loading…
Reference in a new issue