chore: bump chromium to 146.0.7666.0 (main) (#49528)

* chore: bump chromium in DEPS to 146.0.7652.0

* fix(patch-conflict): update mas_avoid_private_macos_api_usage context for constrainFrameRect method

The upstream CL added a new constrainFrameRect:toScreen: method override to
NativeWidgetMacNSWindow as part of headless mode window zoom implementation.
The MAS patch's #endif for frameViewClassForStyleMask now correctly appears
after that method, since constrainFrameRect is a public API override that
doesn't need to be guarded.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7487666

* fix(patch-conflict): update printing.patch for base::DictValue rename

Updated printing.patch to use the new base::DictValue type name instead of
base::Value::Dict following Chromium's type renaming change. This affects
CompleteUpdatePrintSettings() signature and related code.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7509820

* fix(patch-conflict): update accessibility_ui patch for base::DictValue/ListValue rename

Updated adjust_accessibility_ui_for_electron.patch to use the new
base::DictValue and base::ListValue type names instead of base::Value::Dict
and base::Value::List following Chromium's type renaming change.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7509820

* chore: update patches

* 6625736: Rename DURABLE_STORAGE to PERSISTENT_STORAGE for consistency | https://chromium-review.googlesource.com/c/chromium/src/+/6625736

* chore: bump chromium in DEPS to 146.0.7653.0

* chore: update patches

* 7000847: add type tag to v8::External for gin_helper function templates

The upstream gin function templates now use v8::ExternalPointerTypeTag
for type safety when using v8::External. Updated Electron's forked
gin_helper function template to use the same kGinInternalCallbackHolderBaseTag
that Chromium's gin uses.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7000847

* fix(patch-update): extend V8 Object API deprecation patch for Node.js

Extended the existing patch to cover additional files that use
GetAlignedPointerFromInternalField and SetAlignedPointerInInternalField:
- src/stream_base-inl.h
- src/udp_wrap.cc
- src/js_udp_wrap.cc
- src/node_process_methods.cc
- src/node_snapshotable.cc
- src/base_object.cc

These APIs now require an EmbedderDataTypeTag parameter.

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7087956

* 7000847: add type tag to v8::External calls in shared_texture

Updated v8::External::New and v8::External::Value calls to use the
kExternalPointerTypeTagDefault tag as required by the V8 API change
that deprecates the tagless versions.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7000847

* 7508687: use ChildProcessId for file permission APIs

The ChildProcessSecurityPolicy::CanReadFile and GrantReadFile APIs
now require ChildProcessId instead of int. Updated to use GetID()
instead of GetDeprecatedID() for these specific calls.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7508687

* 7000847: add type tag to v8::External calls in callback and osr_converter

The v8::External API now requires an EmbedderPointerTypeTag parameter
for both New() and Value() methods to improve V8 sandbox type safety.

Updated calls in:
- callback.cc: TranslatorHolder constructor and CallTranslator
- osr_converter.cc: OffscreenSharedTextureValue converter

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7000847

* fixup! 7087956: [api] Promote deprecation of v8::Context and v8::Object API methods

Extended the Node.js patch to cover histogram.cc which also uses
SetAlignedPointerInInternalField and GetAlignedPointerFromInternalField
APIs that now require the EmbedderDataTypeTag parameter.

Ref: https://chromium-review.googlesource.com/c/v8/v8/+/7087956

* chore: bump chromium in DEPS to 146.0.7655.0

* chore: update patches

* 7509043: update WebSpellingMarker type for API change

The upstream Chromium API changed - WebSpellingMarker was moved from a
nested type within WebTextCheckClient to a standalone type in the blink
namespace.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7509043

* 7498491: update process_id to use OriginatingProcess type

The upstream Chromium API changed - URLLoaderFactoryParams::process_id
was changed from an integer to a union type network::OriginatingProcess
that distinguishes between browser and renderer processes.

- For browser process requests, use OriginatingProcess::browser()
- For renderer process lookups, check !is_browser() and use
  renderer_process().value() to get the child_id

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7498491

* 5710330: Add crash keys to debug NativeWidgetMacNSWindowBorderlessFrame exception | https://chromium-review.googlesource.com/c/chromium/src/+/5710330

5710330 added a new NSNextStepFrame interface extension and
implementations for NativeWidgetMacNSWindowTitledFrame and
NativeWidgetMacNSWindowBorderlessFrame. These use private macOS APIs
that are not available in Mac App Store builds.

* chore: update patches

* chore: bump chromium in DEPS to 146.0.7661.0

* chore: bump chromium in DEPS to 146.0.7663.0

* fix(patch-conflict): update accessibility_ui for string_view API change

Upstream removed redundant std::string(default_api_type) conversion as part
of a string_view optimization cleanup. Updated patch context to match.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7514107

* fix(patch-conflict): update service process launch options for sandbox API refactor

Upstream removed content/common/sandbox_init_win.cc and
content/public/common/sandbox_init_win.h, moving the functionality directly
into ChildProcessLauncherHelper. Updated patch to call
sandbox::policy::SandboxWin::StartSandboxedProcess directly with the
LaunchOptions pointer instead of going through the removed helper.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7528253

* fix(patch-conflict): update MAS safestorage for keychain API refactor

Upstream refactored KeychainPassword::GetPassword() to use a new
GetPasswordImpl() helper function with improved error tracking via
base::expected<std::string, OSStatus>. Adapted patch to use the new
GetPasswordImpl with the suffixed account name and handle migration
from legacy accounts through the new API.

Ref: https://chromium-review.googlesource.com/c/chromium/src/+/7516438

* chore: update patches

* chore: bump chromium in DEPS to 146.0.7663.0

* fix: base::Value::Dict -> base::DictValue
https://chromium-review.googlesource.com/c/chromium/src/+/7513889

* fix: include new cookie exclusion reason
https://chromium-review.googlesource.com/c/chromium/src/+/7486527

* fix: enable libc++ ABI flag for trivially copyable std::vector<bool>

Required for changes introduced in the following CL
https://chromium-review.googlesource.com/c/chromium/src/+/7513653

* fixup! fix: base::Value::Dict -> base::DictValue https://chromium-review.googlesource.com/c/chromium/src/+/7513889

* fix: spellcheck not working in tests
https://chromium-review.googlesource.com/c/chromium/src/+/7452579

* fix: cookie test failing due to multiple rejection reasons
https://chromium-review.googlesource.com/c/chromium/src/+/7506629

* fix: macos sizing unmaximized window incorrectly
https://chromium-review.googlesource.com/c/chromium/src/+/7487666

Changes to headless mode caused the unmaximized window to subtract
the height of the menubar.

* fix: skip tests for incompatible BoringSSL ML-DSA crypto
https://boringssl-review.googlesource.com/c/boringssl/+/84929

* test: fix pseudonymization registration in utility process on Linux

Ref: 7486913: Pass pseudonymization salt via shared memory at process launch | https://chromium-review.googlesource.com/c/chromium/src/+/7486913

* fix: restore MAS patch-outs

Restores some `#if !IS_MAS_BUILD()` gates dropped in 773054ad59

* fixup! 7508687: use ChildProcessId for file permission APIs

* fixup! fix(patch-conflict): update MAS safestorage for keychain API refactor

* chore: add note about parallel upstream change

* fixup! Merge remote-tracking branch 'origin/main' into roller/chromium/main

* Revert "fixup! 7508687: use ChildProcessId for file permission APIs"

This reverts commit 05c43e4e5d.

The _impl version has the signature, but not the public interface. :oof:

* fixup! fix(patch-conflict): update MAS safestorage for keychain API refactor

---------

Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com>
Co-authored-by: Keeley Hammond <khammond@slack-corp.com>
Co-authored-by: Samuel Maddock <samuelmaddock@electronjs.org>
Co-authored-by: clavin <clavin@electronjs.org>
This commit is contained in:
electron-roller[bot]
2026-02-12 12:37:56 -05:00
committed by GitHub
parent e9faa14cc0
commit a65cfed500
180 changed files with 1195 additions and 1267 deletions

View File

@@ -339,7 +339,7 @@ float NativeImage::GetAspectRatio(const std::optional<float> scale_factor) {
}
gin_helper::Handle<NativeImage> NativeImage::Resize(gin::Arguments* args,
base::Value::Dict options) {
base::DictValue options) {
float scale_factor = GetScaleFactorFromOptions(args);
gfx::Size size = GetSize(scale_factor);

View File

@@ -117,7 +117,7 @@ class NativeImage final : public gin_helper::DeprecatedWrappable<NativeImage> {
v8::Local<v8::Value> GetBitmap(gin::Arguments* args);
v8::Local<v8::Value> GetNativeHandle(gin_helper::ErrorThrower thrower);
gin_helper::Handle<NativeImage> Resize(gin::Arguments* args,
base::Value::Dict options);
base::DictValue options);
gin_helper::Handle<NativeImage> Crop(v8::Isolate* isolate,
const gfx::Rect& rect);
std::string ToDataURL(gin::Arguments* args);

View File

@@ -360,7 +360,8 @@ void ImportedTextureGetVideoFrame(
const v8::FunctionCallbackInfo<v8::Value>& info) {
auto* isolate = info.GetIsolate();
auto* wrapper = static_cast<ImportedSharedTextureWrapper*>(
info.Data().As<v8::External>()->Value());
info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
if (wrapper->IsReferenceReleased()) {
gin_helper::ErrorThrower(isolate).ThrowTypeError(
@@ -382,7 +383,8 @@ void ImportedTextureStartTransferSharedTexture(
const v8::FunctionCallbackInfo<v8::Value>& info) {
auto* isolate = info.GetIsolate();
auto* wrapper = static_cast<ImportedSharedTextureWrapper*>(
info.Data().As<v8::External>()->Value());
info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
if (wrapper->IsReferenceReleased()) {
gin_helper::ErrorThrower(isolate).ThrowTypeError(
@@ -396,7 +398,8 @@ void ImportedTextureStartTransferSharedTexture(
void ImportedTextureRelease(const v8::FunctionCallbackInfo<v8::Value>& info) {
auto* wrapper = static_cast<ImportedSharedTextureWrapper*>(
info.Data().As<v8::External>()->Value());
info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
auto cb = info[0];
if (cb->IsFunction()) {
@@ -415,7 +418,8 @@ void ImportedTextureGetFrameCreationSyncToken(
const v8::FunctionCallbackInfo<v8::Value>& info) {
auto* isolate = info.GetIsolate();
auto* wrapper = static_cast<ImportedSharedTextureWrapper*>(
info.Data().As<v8::External>()->Value());
info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
if (wrapper->IsReferenceReleased()) {
gin_helper::ErrorThrower(isolate).ThrowTypeError(
@@ -431,7 +435,8 @@ void ImportedTextureSetReleaseSyncToken(
const v8::FunctionCallbackInfo<v8::Value>& info) {
auto* isolate = info.GetIsolate();
auto* wrapper = static_cast<ImportedSharedTextureWrapper*>(
info.Data().As<v8::External>()->Value());
info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
if (wrapper->IsReferenceReleased()) {
gin_helper::ErrorThrower(isolate).ThrowTypeError(
@@ -454,7 +459,8 @@ v8::Local<v8::Value> CreateImportedSharedTextureFromSharedImage(
auto* wrapper = new ImportedSharedTextureWrapper();
wrapper->ist = base::WrapRefCounted(imported);
auto imported_wrapped = v8::External::New(isolate, wrapper);
auto imported_wrapped =
v8::External::New(isolate, wrapper, v8::kExternalPointerTypeTagDefault);
gin::Dictionary root(isolate, v8::Object::New(isolate));
auto releaser = v8::Function::New(isolate->GetCurrentContext(),

View File

@@ -37,16 +37,16 @@ const char kSeparators[] = "\\/";
const char kSeparators[] = "/";
#endif
const base::Value::Dict* GetNodeFromPath(std::string path,
const base::Value::Dict& root);
const base::DictValue* GetNodeFromPath(std::string path,
const base::DictValue& root);
// Gets the "files" from "dir".
const base::Value::Dict* GetFilesNode(const base::Value::Dict& root,
const base::Value::Dict& dir) {
const base::DictValue* GetFilesNode(const base::DictValue& root,
const base::DictValue& dir) {
// Test for symbol linked directory.
const std::string* link = dir.FindString("link");
if (link != nullptr) {
const base::Value::Dict* linked_node = GetNodeFromPath(*link, root);
const base::DictValue* linked_node = GetNodeFromPath(*link, root);
if (!linked_node)
return nullptr;
return linked_node->FindDict("files");
@@ -56,27 +56,27 @@ const base::Value::Dict* GetFilesNode(const base::Value::Dict& root,
}
// Gets sub-file "name" from "dir".
const base::Value::Dict* GetChildNode(const base::Value::Dict& root,
const std::string& name,
const base::Value::Dict& dir) {
const base::DictValue* GetChildNode(const base::DictValue& root,
const std::string& name,
const base::DictValue& dir) {
if (name.empty())
return &root;
const base::Value::Dict* files = GetFilesNode(root, dir);
const base::DictValue* files = GetFilesNode(root, dir);
return files ? files->FindDict(name) : nullptr;
}
// Gets the node of "path" from "root".
const base::Value::Dict* GetNodeFromPath(std::string path,
const base::Value::Dict& root) {
const base::DictValue* GetNodeFromPath(std::string path,
const base::DictValue& root) {
if (path.empty())
return &root;
const base::Value::Dict* dir = &root;
const base::DictValue* dir = &root;
for (size_t delimiter_position = path.find_first_of(kSeparators);
delimiter_position != std::string::npos;
delimiter_position = path.find_first_of(kSeparators)) {
const base::Value::Dict* child =
const base::DictValue* child =
GetChildNode(root, path.substr(0, delimiter_position), *dir);
if (!child)
return nullptr;
@@ -91,7 +91,7 @@ const base::Value::Dict* GetNodeFromPath(std::string path,
bool FillFileInfoWithNode(Archive::FileInfo* info,
uint32_t header_size,
bool load_integrity,
const base::Value::Dict* node) {
const base::DictValue* node) {
if (std::optional<int> size = node->FindInt("size")) {
info->size = static_cast<uint32_t>(*size);
} else {
@@ -120,11 +120,11 @@ bool FillFileInfoWithNode(Archive::FileInfo* info,
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_WIN)
if (load_integrity &&
electron::fuses::IsEmbeddedAsarIntegrityValidationEnabled()) {
if (const base::Value::Dict* integrity = node->FindDict("integrity")) {
if (const base::DictValue* integrity = node->FindDict("integrity")) {
const std::string* algorithm = integrity->FindString("algorithm");
const std::string* hash = integrity->FindString("hash");
std::optional<int> block_size = integrity->FindInt("blockSize");
const base::Value::List* blocks = integrity->FindList("blocks");
const base::ListValue* blocks = integrity->FindList("blocks");
if (algorithm && hash && block_size && block_size > 0 && blocks) {
IntegrityPayload integrity_payload;
@@ -281,8 +281,7 @@ bool Archive::GetFileInfo(const base::FilePath& path, FileInfo* info) const {
if (!header_)
return false;
const base::Value::Dict* node =
GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
const base::DictValue* node = GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
if (!node)
return false;
@@ -297,8 +296,7 @@ bool Archive::Stat(const base::FilePath& path, Stats* stats) const {
if (!header_)
return false;
const base::Value::Dict* node =
GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
const base::DictValue* node = GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
if (!node)
return false;
@@ -320,12 +318,11 @@ bool Archive::Readdir(const base::FilePath& path,
if (!header_)
return false;
const base::Value::Dict* node =
GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
const base::DictValue* node = GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
if (!node)
return false;
const base::Value::Dict* files_node = GetFilesNode(*header_, *node);
const base::DictValue* files_node = GetFilesNode(*header_, *node);
if (!files_node)
return false;
@@ -339,8 +336,7 @@ bool Archive::Realpath(const base::FilePath& path,
if (!header_)
return false;
const base::Value::Dict* node =
GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
const base::DictValue* node = GetNodeFromPath(path.AsUTF8Unsafe(), *header_);
if (!node)
return false;

View File

@@ -106,7 +106,7 @@ class Archive {
base::File file_{base::File::FILE_OK};
int fd_ = -1;
uint32_t header_size_ = 0;
std::optional<base::Value::Dict> header_;
std::optional<base::DictValue> header_;
// Cached external temporary files.
base::Lock external_files_lock_;

View File

@@ -78,7 +78,7 @@ auto LoadIntegrityConfig() {
LOG(FATAL) << "Invalid integrity config: NOT a valid JSON.";
}
const base::Value::List* file_configs = root.value().GetIfList();
const base::ListValue* file_configs = root.value().GetIfList();
if (!file_configs) {
LOG(FATAL) << "Invalid integrity config: NOT a list.";
}
@@ -87,7 +87,7 @@ auto LoadIntegrityConfig() {
cache.reserve(file_configs->size());
for (size_t i = 0; i < file_configs->size(); i++) {
// Skip invalid file configs
const base::Value::Dict* ele_dict = (*file_configs)[i].GetIfDict();
const base::DictValue* ele_dict = (*file_configs)[i].GetIfDict();
if (!ele_dict) {
LOG(WARNING) << "Skip config " << i << ": NOT a valid dict";
continue;

View File

@@ -187,7 +187,7 @@ v8::Local<v8::Value> Converter<blink::PermissionType>::ToV8(
return StringToV8(isolate, "payment-handler");
case blink::PermissionType::PERIODIC_BACKGROUND_SYNC:
return StringToV8(isolate, "periodic-background-sync");
case blink::PermissionType::DURABLE_STORAGE:
case blink::PermissionType::PERSISTENT_STORAGE:
return StringToV8(isolate, "persistent-storage");
case blink::PermissionType::GEOLOCATION:
return StringToV8(isolate, "geolocation");

View File

@@ -19,11 +19,11 @@ struct Converter<device::mojom::HidDeviceInfoPtr> {
v8::Isolate* isolate,
const device::mojom::HidDeviceInfoPtr& device) {
base::Value value = electron::HidChooserContext::DeviceInfoToValue(*device);
base::Value::Dict& dict = value.GetDict();
base::DictValue& dict = value.GetDict();
dict.Set("deviceId",
electron::HidChooserController::PhysicalDeviceIdFromDeviceInfo(
*device));
return gin::Converter<base::Value::Dict>::ToV8(isolate, dict);
return gin::Converter<base::DictValue>::ToV8(isolate, dict);
}
};

View File

@@ -164,16 +164,16 @@ v8::Local<v8::Value> Converter<net::CertPrincipal>::ToV8(
v8::Local<v8::Value> Converter<net::HttpResponseHeaders*>::ToV8(
v8::Isolate* isolate,
net::HttpResponseHeaders* headers) {
base::Value::Dict response_headers;
base::DictValue response_headers;
if (headers) {
size_t iter = 0;
std::string key;
std::string value;
while (headers->EnumerateHeaderLines(&iter, &key, &value)) {
key = base::ToLowerASCII(key);
base::Value::List* values = response_headers.FindList(key);
base::ListValue* values = response_headers.FindList(key);
if (!values)
values = &response_headers.Set(key, base::Value::List())->GetList();
values = &response_headers.Set(key, base::ListValue())->GetList();
values->Append(value);
}
}
@@ -245,7 +245,7 @@ v8::Local<v8::Value> Converter<net::HttpRequestHeaders>::ToV8(
bool Converter<net::HttpRequestHeaders>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
net::HttpRequestHeaders* out) {
base::Value::Dict dict;
base::DictValue dict;
if (!ConvertFromV8(isolate, val, &dict))
return false;
for (const auto it : dict) {
@@ -588,12 +588,12 @@ bool Converter<scoped_refptr<network::ResourceRequestBody>>::FromV8(
base::Value list_value;
if (!ConvertFromV8(isolate, val, &list_value) || !list_value.is_list())
return false;
base::Value::List& list = list_value.GetList();
base::ListValue& list = list_value.GetList();
*out = base::MakeRefCounted<network::ResourceRequestBody>();
for (base::Value& dict_value : list) {
if (!dict_value.is_dict())
return false;
base::Value::Dict& dict = dict_value.GetDict();
base::DictValue& dict = dict_value.GetDict();
std::string* type = dict.FindString("type");
if (!type)
return false;

View File

@@ -87,10 +87,12 @@ v8::Local<v8::Value> Converter<electron::OffscreenSharedTextureValue>::ToV8(
// GC collects the object.
auto* monitor = new OffscreenReleaseHolderMonitor(val.releaser_holder);
auto releaserHolder = v8::External::New(isolate, monitor);
auto releaserHolder =
v8::External::New(isolate, monitor, v8::kExternalPointerTypeTagDefault);
auto releaserFunc = [](const v8::FunctionCallbackInfo<v8::Value>& info) {
auto* mon = static_cast<OffscreenReleaseHolderMonitor*>(
info.Data().As<v8::External>()->Value());
info.Data().As<v8::External>()->Value(
v8::kExternalPointerTypeTagDefault));
// Release the shared texture, so that future frames can be generated.
mon->ReleaseTexture();
// Release the monitor happens at GC, don't release here.

View File

@@ -11,9 +11,9 @@
namespace gin {
bool Converter<base::Value::Dict>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::Value::Dict* out) {
bool Converter<base::DictValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::DictValue* out) {
std::unique_ptr<base::Value> value =
content::V8ValueConverter::Create()->FromV8Value(
val, isolate->GetCurrentContext());
@@ -46,9 +46,9 @@ v8::Local<v8::Value> Converter<base::ValueView>::ToV8(
val, isolate->GetCurrentContext());
}
bool Converter<base::Value::List>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::Value::List* out) {
bool Converter<base::ListValue>::FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::ListValue* out) {
std::unique_ptr<base::Value> value =
content::V8ValueConverter::Create()->FromV8Value(
val, isolate->GetCurrentContext());

View File

@@ -17,12 +17,12 @@ struct Converter<base::ValueView> {
};
template <>
struct Converter<base::Value::Dict> {
struct Converter<base::DictValue> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::Value::Dict* out);
base::DictValue* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::Value::Dict& val) {
const base::DictValue& val) {
return gin::ConvertToV8(isolate, base::ValueView{val});
}
};
@@ -39,12 +39,12 @@ struct Converter<base::Value> {
};
template <>
struct Converter<base::Value::List> {
struct Converter<base::ListValue> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
base::Value::List* out);
base::ListValue* out);
static v8::Local<v8::Value> ToV8(v8::Isolate* isolate,
const base::Value::List& val) {
const base::ListValue& val) {
return gin::ConvertToV8(isolate, base::ValueView{val});
}
};

View File

@@ -14,7 +14,10 @@ namespace {
struct TranslatorHolder {
explicit TranslatorHolder(v8::Isolate* isolate)
: handle(isolate, v8::External::New(isolate, this)) {
: handle(isolate,
v8::External::New(isolate,
this,
v8::kExternalPointerTypeTagDefault)) {
handle.SetWeak(this, &GC, v8::WeakCallbackType::kParameter);
}
~TranslatorHolder() {
@@ -57,7 +60,8 @@ void CallTranslator(v8::Local<v8::External> external,
}
}
auto* holder = static_cast<TranslatorHolder*>(external->Value());
auto* holder = static_cast<TranslatorHolder*>(
external->Value(v8::kExternalPointerTypeTagDefault));
holder->translator.Run(args);
// Free immediately for one-time callback.

View File

@@ -5,6 +5,7 @@
#include "shell/common/gin_helper/function_template.h"
#include "base/strings/strcat.h"
#include "gin/public/gin_embedders.h"
namespace gin_helper {
@@ -29,7 +30,10 @@ void CallbackHolderBase::DisposeObserver::OnDisposed() {
}
CallbackHolderBase::CallbackHolderBase(v8::Isolate* isolate)
: v8_ref_(isolate, v8::External::New(isolate, this)),
: v8_ref_(isolate,
v8::External::New(isolate,
this,
gin::kGinInternalCallbackHolderBaseTag)),
dispose_observer_(gin::PerIsolateData::From(isolate), this) {
v8_ref_.SetWeak(this, &CallbackHolderBase::FirstWeakCallback,
v8::WeakCallbackType::kParameter);

View File

@@ -13,6 +13,7 @@
#include "base/memory/raw_ptr.h"
#include "gin/arguments.h"
#include "gin/per_isolate_data.h"
#include "gin/public/gin_embedders.h"
#include "shell/common/gin_helper/destroyable.h"
#include "shell/common/gin_helper/error_thrower.h"
#include "v8/include/v8-context.h"
@@ -289,8 +290,8 @@ struct Dispatcher<ReturnType(ArgTypes...)> {
static void DispatchToCallbackImpl(gin::Arguments* args) {
v8::Local<v8::External> v8_holder;
CHECK(args->GetData(&v8_holder));
CallbackHolderBase* holder_base =
reinterpret_cast<CallbackHolderBase*>(v8_holder->Value());
CallbackHolderBase* holder_base = reinterpret_cast<CallbackHolderBase*>(
v8_holder->Value(gin::kGinInternalCallbackHolderBaseTag));
typedef CallbackHolder<ReturnType(ArgTypes...)> HolderT;
HolderT* holder = static_cast<HolderT*>(holder_base);

View File

@@ -115,7 +115,7 @@ node::Environment* CreateEnvironment(v8::Isolate* isolate,
node::Environment* env = node::CreateEnvironment(isolate_data, context, args,
exec_args, env_flags);
if (auto message = try_catch.Message(); !message.IsEmpty()) {
base::Value::Dict dict;
base::DictValue dict;
if (std::string str; gin::ConvertFromV8(isolate, message->Get(), &str))
dict.Set("message", std::move(str));