chore: move gin::Handle to gin_helper (#48016)

chore: move gin::Handle to gin_helper (#47959)

* chore: move gin::Handle to gin_helper

* chore: fix lint

Co-authored-by: Robo <hop2deep@gmail.com>
This commit is contained in:
Calvin 2025-08-10 13:46:37 -06:00 committed by GitHub
commit e3f358a45a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
95 changed files with 555 additions and 419 deletions

View file

@ -44,7 +44,6 @@
#include "content/public/browser/storage_partition.h"
#include "gin/arguments.h"
#include "gin/converter.h"
#include "gin/handle.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "net/base/completion_repeating_callback.h"
@ -89,6 +88,7 @@
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/gin_helper/dictionary.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/handle.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/node_includes.h"
@ -1004,7 +1004,8 @@ bool Session::IsPersistent() {
v8::Local<v8::Promise> Session::GetBlobData(v8::Isolate* isolate,
const std::string& uuid) {
gin::Handle<DataPipeHolder> holder = DataPipeHolder::From(isolate, uuid);
gin_helper::Handle<DataPipeHolder> holder =
DataPipeHolder::From(isolate, uuid);
if (holder.IsEmpty()) {
gin_helper::Promise<v8::Local<v8::Value>> promise(isolate);
promise.RejectWithErrorMessage("Could not get blob data handle");
@ -1662,15 +1663,15 @@ Session* Session::FromBrowserContext(content::BrowserContext* context) {
}
// static
gin::Handle<Session> Session::CreateFrom(
gin_helper::Handle<Session> Session::CreateFrom(
v8::Isolate* isolate,
ElectronBrowserContext* browser_context) {
Session* existing = FromBrowserContext(browser_context);
if (existing)
return gin::CreateHandle(isolate, existing);
return gin_helper::CreateHandle(isolate, existing);
auto handle =
gin::CreateHandle(isolate, new Session(isolate, browser_context));
gin_helper::CreateHandle(isolate, new Session(isolate, browser_context));
// The Sessions should never be garbage collected, since the common pattern is
// to use partition strings, instead of using the Session object directly.
@ -1688,9 +1689,9 @@ gin::Handle<Session> Session::CreateFrom(
}
// static
gin::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
const std::string& partition,
base::Value::Dict options) {
gin_helper::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
const std::string& partition,
base::Value::Dict options) {
ElectronBrowserContext* browser_context;
if (partition.empty()) {
browser_context =
@ -1707,7 +1708,7 @@ gin::Handle<Session> Session::FromPartition(v8::Isolate* isolate,
}
// static
std::optional<gin::Handle<Session>> Session::FromPath(
std::optional<gin_helper::Handle<Session>> Session::FromPath(
v8::Isolate* isolate,
const base::FilePath& path,
base::Value::Dict options) {
@ -1731,7 +1732,7 @@ std::optional<gin::Handle<Session>> Session::FromPath(
}
// static
gin::Handle<Session> Session::New() {
gin_helper::Handle<Session> Session::New() {
gin_helper::ErrorThrower(JavascriptEnvironment::GetIsolate())
.ThrowError("Session objects cannot be created with 'new'");
return {};
@ -1854,7 +1855,7 @@ v8::Local<v8::Value> FromPath(const base::FilePath& path,
}
base::Value::Dict options;
args->GetNext(&options);
std::optional<gin::Handle<Session>> session_handle =
std::optional<gin_helper::Handle<Session>> session_handle =
Session::FromPath(args->isolate(), path, std::move(options));
if (session_handle)