Skip to content

refactor: remove electron::WebRequestAPI interface - #48792

Merged
deepak1556 merged 4 commits into
mainfrom
refactor/remove-electron-WebRequestAPI-interface
Nov 6, 2025
Merged

deepak1556 merged 4 commits into
mainfrom
refactor/remove-electron-WebRequestAPI-interface

Conversation

@ckerr

@ckerr ckerr commented Nov 5, 2025 •

Copy link
Copy Markdown
Member

Description of Change

What:

Remove the electron::WebRequestAPI interface class. Use handles to the concrete class electron::api::WebRequest instead.

Why:

Prerequisite for #48762.

Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket) hold a handle to a WebRequest via raw_ptr<electron::WebRequestAPI>. electron::WebRequestAPI is a pure virtual interface whose concrete impl is electron::api::WebRequest.

This is a problem when migrating electron::api::WebRequest to cppgc: we need to change those raw_ptr<>s to cppgc::WeakPersistent<> but can't instantiate cppgc::WeakPersistent<electron::WebRequestAPI> as-is. We also can't change it to inherit from cppgc::GarbageCollectedMixin, since that causes problems when electron::api::WebRequest inherits from both electron::WebRequestAPI and cppgc::GarbageCollected.

CC @deepak1556

Checklist

Release Notes

Notes: none.

Remove the |electron::WebRequestAPI| interface class.
Use handles to the concrete class |electron::api::WebRequest| instead.

Prerequisite for #48762.

Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket)
hold a handle to a WebRequest via |raw_ptr<electron::WebRequestAPI>|.
|electron::WebRequestAPI| is a pure virtual interface whose concrete impl is
|electron::api::WebRequest|.

This is a problem when migrating |electron::api::WebRequest| to cppgc:
we need to change those |raw_ptr<>|s to |cppgc::WeakPersistent<>| but
can't instantiate |cppgc::WeakPersistent<electron::WebRequestAPI>| as-is.
We also can't change it to inherit from |cppgc::GarbageCollectedMixin|,
since that causes problems when |electron::api::WebRequest| inherits from
both |electron::WebRequestAPI| and |cppgc::GarbageCollected|.
@ckerr
ckerr requested a review from deepak1556 November 5, 2025 20:02
@electron-cation electron-cation Bot added the new-pr 🌱 PR opened recently label Nov 5, 2025
@ckerr
ckerr marked this pull request as draft November 5, 2025 20:05
@ckerr
ckerr marked this pull request as ready for review November 5, 2025 20:51

@deepak1556 deepak1556 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@deepak1556
deepak1556 merged commit f6ffb55 into main Nov 6, 2025
@deepak1556
deepak1556 deleted the refactor/remove-electron-WebRequestAPI-interface branch November 6, 2025 08:05
@release-clerk

release-clerk Bot commented Nov 6, 2025

Copy link
Copy Markdown

No Release Notes

nilayarya pushed a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
* refactor: remove electron::WebRequestAPI interface

Remove the |electron::WebRequestAPI| interface class.
Use handles to the concrete class |electron::api::WebRequest| instead.

Prerequisite for electron#48762.

Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket)
hold a handle to a WebRequest via |raw_ptr<electron::WebRequestAPI>|.
|electron::WebRequestAPI| is a pure virtual interface whose concrete impl is
|electron::api::WebRequest|.

This is a problem when migrating |electron::api::WebRequest| to cppgc:
we need to change those |raw_ptr<>|s to |cppgc::WeakPersistent<>| but
can't instantiate |cppgc::WeakPersistent<electron::WebRequestAPI>| as-is.
We also can't change it to inherit from |cppgc::GarbageCollectedMixin|,
since that causes problems when |electron::api::WebRequest| inherits from
both |electron::WebRequestAPI| and |cppgc::GarbageCollected|.

* refactor: use name web_request, not web_request_api

* refactor: make ProxyingURLLoaderFactory::web_request() private

* chore: make linter happy by fixing whitespace
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
* refactor: remove electron::WebRequestAPI interface

Remove the |electron::WebRequestAPI| interface class.
Use handles to the concrete class |electron::api::WebRequest| instead.

Prerequisite for electron#48762.

Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket)
hold a handle to a WebRequest via |raw_ptr<electron::WebRequestAPI>|.
|electron::WebRequestAPI| is a pure virtual interface whose concrete impl is
|electron::api::WebRequest|.

This is a problem when migrating |electron::api::WebRequest| to cppgc:
we need to change those |raw_ptr<>|s to |cppgc::WeakPersistent<>| but
can't instantiate |cppgc::WeakPersistent<electron::WebRequestAPI>| as-is.
We also can't change it to inherit from |cppgc::GarbageCollectedMixin|,
since that causes problems when |electron::api::WebRequest| inherits from
both |electron::WebRequestAPI| and |cppgc::GarbageCollected|.

* refactor: use name web_request, not web_request_api

* refactor: make ProxyingURLLoaderFactory::web_request() private

* chore: make linter happy by fixing whitespace
nilayarya added a commit to nilayarya/electron that referenced this pull request Nov 21, 2025
* refactor: remove electron::WebRequestAPI interface

Remove the |electron::WebRequestAPI| interface class.
Use handles to the concrete class |electron::api::WebRequest| instead.

Prerequisite for electron#48762.

Two classes (electron::ProxyingURLLoaderFactory and electron::ProxyingWebSocket)
hold a handle to a WebRequest via |raw_ptr<electron::WebRequestAPI>|.
|electron::WebRequestAPI| is a pure virtual interface whose concrete impl is
|electron::api::WebRequest|.

This is a problem when migrating |electron::api::WebRequest| to cppgc:
we need to change those |raw_ptr<>|s to |cppgc::WeakPersistent<>| but
can't instantiate |cppgc::WeakPersistent<electron::WebRequestAPI>| as-is.
We also can't change it to inherit from |cppgc::GarbageCollectedMixin|,
since that causes problems when |electron::api::WebRequest| inherits from
both |electron::WebRequestAPI| and |cppgc::GarbageCollected|.

* refactor: use name web_request, not web_request_api

* refactor: make ProxyingURLLoaderFactory::web_request() private

* chore: make linter happy by fixing whitespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants