refactor: allocate api::Session on cpp heap (#48141)

This commit is contained in:
Robo 2025-08-25 18:52:06 +09:00 committed by GitHub
commit 3ccb1bc0a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
32 changed files with 632 additions and 293 deletions

View file

@ -31,6 +31,7 @@
#include "content/public/common/stop_find_action.h"
#include "electron/buildflags/buildflags.h"
#include "printing/buildflags/buildflags.h"
#include "shell/browser/api/electron_api_session.h"
#include "shell/browser/api/save_page_handler.h"
#include "shell/browser/background_throttling_source.h"
#include "shell/browser/event_emitter_mixin.h"
@ -47,6 +48,7 @@
#include "shell/common/gin_helper/wrappable.h"
#include "shell/common/web_contents_utility.mojom.h"
#include "ui/base/models/image_model.h"
#include "v8/include/cppgc/persistent.h"
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
#include "extensions/common/mojom/view_type.mojom-forward.h"
@ -479,7 +481,7 @@ class WebContents final : public ExclusiveAccessContext,
void InitWithSessionAndOptions(
v8::Isolate* isolate,
std::unique_ptr<content::WebContents> web_contents,
gin_helper::Handle<class Session> session,
ElectronBrowserContext* browser_context,
const gin_helper::Dictionary& options);
#if BUILDFLAG(ENABLE_ELECTRON_EXTENSIONS)
@ -768,7 +770,7 @@ class WebContents final : public ExclusiveAccessContext,
// Update the html fullscreen flag in both browser and renderer.
void UpdateHtmlApiFullscreen(bool fullscreen);
v8::Global<v8::Value> session_;
cppgc::Persistent<api::Session> session_;
v8::Global<v8::Value> devtools_web_contents_;
v8::Global<v8::Value> debugger_;