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

@@ -10,7 +10,6 @@
#include "gin/dictionary.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "shell/common/api/api.mojom.h"
#include "shell/common/gin_converters/blink_converter.h"
@@ -19,6 +18,7 @@
#include "shell/common/gin_helper/error_thrower.h"
#include "shell/common/gin_helper/function_template_extensions.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/gin_helper/wrappable.h"
#include "shell/common/node_bindings.h"
#include "shell/common/node_includes.h"
#include "shell/common/v8_util.h"
@@ -55,7 +55,7 @@ bool IsWorkerThread() {
}
template <typename T>
class IPCBase : public gin::DeprecatedWrappable<T> {
class IPCBase : public gin_helper::DeprecatedWrappable<T> {
public:
static gin::DeprecatedWrapperInfo kWrapperInfo;
@@ -181,10 +181,10 @@ class IPCBase : public gin::DeprecatedWrappable<T> {
return electron::DeserializeV8Value(isolate, result);
}
// gin::Wrappable:
// gin_helper::Wrappable:
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override {
return gin::DeprecatedWrappable<T>::GetObjectTemplateBuilder(isolate)
return gin_helper::DeprecatedWrappable<T>::GetObjectTemplateBuilder(isolate)
.SetMethod("send", &T::SendMessage)
.SetMethod("sendSync", &T::SendSync)
.SetMethod("sendToHost", &T::SendToHost)

View File

@@ -19,7 +19,6 @@
#include "content/public/renderer/render_frame_visitor.h"
#include "gin/handle.h"
#include "gin/object_template_builder.h"
#include "gin/wrappable.h"
#include "services/service_manager/public/cpp/interface_provider.h"
#include "shell/common/api/api.mojom.h"
#include "shell/common/gin_converters/blink_converter.h"
@@ -32,6 +31,7 @@
#include "shell/common/gin_helper/function_template_extensions.h"
#include "shell/common/gin_helper/object_template_builder.h"
#include "shell/common/gin_helper/promise.h"
#include "shell/common/gin_helper/wrappable.h"
#include "shell/common/node_includes.h"
#include "shell/common/node_util.h"
#include "shell/common/options_switches.h"
@@ -333,7 +333,7 @@ class SpellCheckerHolder final : private content::RenderFrameObserver {
};
class WebFrameRenderer final
: public gin::DeprecatedWrappable<WebFrameRenderer>,
: public gin_helper::DeprecatedWrappable<WebFrameRenderer>,
public gin_helper::Constructible<WebFrameRenderer>,
private content::RenderFrameObserver {
public: