chore: move gin::DeprecatedWrappable to gin_helper (#47958)

* chore: move gin::DeprecatedWrappable to gin_helper

This is in preparation for migrating to gin::Wrappable
based on cppgc #47922
The upstream class will be deleted soon via roller PR but
the cppgc migration should happen outside the roll, this
change retains the current functionality by copying the
implementation into //electron/shell/common/gin_helper.
The class can be deleted once the cppgc migration is complete.

* chore: fix lint:cpp
This commit is contained in:
Robo
2025-08-04 23:28:01 +09:00
committed by GitHub
parent 0e862bba61
commit 9d05454dc7
53 changed files with 344 additions and 224 deletions

View File

@@ -12,7 +12,7 @@
#include "base/containers/span.h"
#include "base/memory/raw_ptr.h"
#include "base/values.h"
#include "gin/wrappable.h"
#include "shell/common/gin_helper/wrappable.h"
#include "ui/gfx/image/image.h"
#include "ui/gfx/image/image_skia_rep.h"
@@ -46,7 +46,7 @@ class ErrorThrower;
namespace electron::api {
class NativeImage final : public gin::DeprecatedWrappable<NativeImage> {
class NativeImage final : public gin_helper::DeprecatedWrappable<NativeImage> {
public:
NativeImage(v8::Isolate* isolate, const gfx::Image& image);
#if BUILDFLAG(IS_WIN)
@@ -95,7 +95,7 @@ class NativeImage final : public gin::DeprecatedWrappable<NativeImage> {
NativeImage** native_image,
OnConvertError on_error = OnConvertError::kThrow);
// gin::Wrappable
// gin_helper::Wrappable
static gin::DeprecatedWrapperInfo kWrapperInfo;
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;

View File

@@ -19,7 +19,6 @@
#include "base/sequence_checker.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/system/data_pipe_producer.h"
#include "net/base/auth.h"
@@ -165,7 +164,7 @@ class BufferDataSource : public mojo::DataPipeProducer::DataSource {
};
class JSChunkedDataPipeGetter final
: public gin::DeprecatedWrappable<JSChunkedDataPipeGetter>,
: public gin_helper::DeprecatedWrappable<JSChunkedDataPipeGetter>,
public network::mojom::ChunkedDataPipeGetter {
public:
static gin::Handle<JSChunkedDataPipeGetter> Create(
@@ -178,10 +177,10 @@ class JSChunkedDataPipeGetter final
isolate, body_func, std::move(chunked_data_pipe_getter)));
}
// gin::Wrappable
// gin_helper::Wrappable
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override {
return gin::DeprecatedWrappable<
return gin_helper::DeprecatedWrappable<
JSChunkedDataPipeGetter>::GetObjectTemplateBuilder(isolate)
.SetMethod("write", &JSChunkedDataPipeGetter::WriteChunk)
.SetMethod("done", &JSChunkedDataPipeGetter::Done);

View File

@@ -13,7 +13,6 @@
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/sequence_checker.h"
#include "gin/wrappable.h"
#include "mojo/public/cpp/bindings/receiver_set.h"
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
#include "services/network/public/mojom/network_context.mojom.h"
@@ -22,6 +21,7 @@
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "shell/browser/event_emitter_mixin.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/gin_helper/wrappable.h"
#include "url/gurl.h"
#include "v8/include/v8-forward.h"
@@ -49,7 +49,7 @@ namespace electron::api {
/** Wraps a SimpleURLLoader to make it usable from JavaScript */
class SimpleURLLoaderWrapper final
: public gin::DeprecatedWrappable<SimpleURLLoaderWrapper>,
: public gin_helper::DeprecatedWrappable<SimpleURLLoaderWrapper>,
public gin_helper::EventEmitterMixin<SimpleURLLoaderWrapper>,
public gin_helper::CleanedUpAtExit,
private network::SimpleURLLoaderStreamConsumer,
@@ -60,7 +60,7 @@ class SimpleURLLoaderWrapper final
void Cancel();
// gin::Wrappable
// gin_helper::Wrappable
static gin::DeprecatedWrapperInfo kWrapperInfo;
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;