refactor: remove gin_helper::Arguments (#48374)

* refactor: make api::Clipboard::GetClipboardBuffer() private

* refactor: move GetClipboadBuffer() into anonymous namespace

* refactor: use gin::Arguments in StopRecording()

* refactor: use gin::Arguments in ImageView::New()

* refactor: use gin::Arguments in AppendSwitch()

* refactor: use gin::Arguments WebContentsView::New()

* refactor: make gin::Arguments arg const in WrappableBase::InitWithArgs()

This makes explicit that we are using it for wrapper + isolate, not the args values

* refactor: remove gin_helper::Arguments arg from ExposeAPI()

refactor: remove gin_helper::Arguments arg from ExposeAPIInWorld()

* refactor: remove gin_helper::Arguments arg from ElectronBindings::GetSystemMemoryInfo()

* refactor: remove gin_helper::Arguments arg from preload_utils::GetBinding()

* refactor: use gin::Arguments in OpenExternal()

* refactor: use gin::Arguments in ExecuteInWorld()

* refactor: use gin::Arguments in ExecuteJavaScript()

* refactor: use gin::Arguments in InvokeNew()

* refactor: use gin::Arguments in ExecuteJavaScriptInIsolatedWorld()

* refactor: remove unused GetNextArgument() marshaller for gin_helper::Arguments

* refactor: remove unused #include gin_helper/arguments.h

* chore: remove unused gin_helper::Arguments

* fixup! refactor: use gin::Arguments in ExecuteJavaScriptInIsolatedWorld()

Xref: https://github.com/electron/electron/pull/48447
This commit is contained in:
Charles Kerr
2025-10-03 14:10:29 -05:00
committed by GitHub
parent 7cb1552614
commit 01cab978f7
22 changed files with 76 additions and 163 deletions

View File

@@ -6,7 +6,6 @@
#include "base/process/process.h"
#include "base/strings/strcat.h"
#include "shell/common/gin_helper/arguments.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/node_includes.h"
#include "v8/include/v8-context.h"
@@ -34,20 +33,19 @@ v8::Local<v8::Object> GetBindingCache(v8::Isolate* isolate) {
// adapted from node.cc
v8::Local<v8::Value> GetBinding(v8::Isolate* isolate,
v8::Local<v8::String> key,
gin_helper::Arguments* margs) {
v8::Local<v8::String> key) {
v8::Local<v8::Object> exports;
std::string binding_key = gin::V8ToString(isolate, key);
const std::string binding_key = gin::V8ToString(isolate, key);
gin_helper::Dictionary cache(isolate, GetBindingCache(isolate));
if (cache.Get(binding_key, &exports)) {
return exports;
}
auto* mod = node::binding::get_linked_module(binding_key.c_str());
auto* const mod = node::binding::get_linked_module(binding_key.c_str());
if (!mod) {
margs->ThrowError(base::StrCat({"No such binding: ", binding_key}));
gin_helper::ErrorThrower{isolate}.ThrowError(
base::StrCat({"No such binding: ", binding_key}));
return exports;
}