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

@@ -114,7 +114,8 @@ gin::Handle<ParentPort> ParentPort::Create(v8::Isolate* isolate) {
// static
gin::ObjectTemplateBuilder ParentPort::GetObjectTemplateBuilder(
v8::Isolate* isolate) {
return gin::DeprecatedWrappable<ParentPort>::GetObjectTemplateBuilder(isolate)
return gin_helper::DeprecatedWrappable<ParentPort>::GetObjectTemplateBuilder(
isolate)
.SetMethod("postMessage", &ParentPort::PostMessage)
.SetMethod("start", &ParentPort::Start)
.SetMethod("pause", &ParentPort::Pause);

View File

@@ -7,10 +7,10 @@
#include <memory>
#include "gin/wrappable.h"
#include "mojo/public/cpp/bindings/connector.h"
#include "mojo/public/cpp/bindings/message.h"
#include "shell/common/gin_helper/cleaned_up_at_exit.h"
#include "shell/common/gin_helper/wrappable.h"
#include "third_party/blink/public/common/messaging/message_port_descriptor.h"
namespace v8 {
@@ -31,7 +31,7 @@ namespace electron {
// There is only a single instance of this class
// for the lifetime of a Utility Process which
// also means that GC lifecycle is ignored by this class.
class ParentPort final : public gin::DeprecatedWrappable<ParentPort>,
class ParentPort final : public gin_helper::DeprecatedWrappable<ParentPort>,
public gin_helper::CleanedUpAtExit,
private mojo::MessageReceiver {
public:
@@ -45,7 +45,7 @@ class ParentPort final : public gin::DeprecatedWrappable<ParentPort>,
~ParentPort() override;
void Initialize(blink::MessagePortDescriptor port);
// gin::Wrappable
// gin_helper::Wrappable
static gin::DeprecatedWrapperInfo kWrapperInfo;
gin::ObjectTemplateBuilder GetObjectTemplateBuilder(
v8::Isolate* isolate) override;