mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: allow custom v8 snapshots to be used in the main process and the default snapshot in the renderer process (#35694)
feat: allow custom v8 snapshots to be used in the main process and the default snapshot in the renderer process (#35266) * Updates to allow for using a custom v8 snapshot file name * Allow using a custom v8 snapshot file name * Fix up patch due to merge * Use fuse to set up custom v8 snapshot file in browser process * Refactor to use delegate instead of command line parameter * Refactoring * Update due to merge * PR comments * Rename patch * Rename patch chore: update patches Co-authored-by: Ryan Manuel <ryanm@cypress.io>
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
#include "components/content_settings/core/common/content_settings_pattern.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "electron/buildflags/buildflags.h"
|
||||
#include "electron/fuses.h"
|
||||
#include "extensions/common/constants.h"
|
||||
#include "ipc/ipc_buildflags.h"
|
||||
#include "sandbox/policy/switches.h"
|
||||
@@ -420,6 +421,20 @@ void ElectronMainDelegate::PreBrowserMain() {
|
||||
#endif
|
||||
}
|
||||
|
||||
base::StringPiece ElectronMainDelegate::GetBrowserV8SnapshotFilename() {
|
||||
const base::CommandLine* command_line =
|
||||
base::CommandLine::ForCurrentProcess();
|
||||
std::string process_type =
|
||||
command_line->GetSwitchValueASCII(::switches::kProcessType);
|
||||
bool load_browser_process_specific_v8_snapshot =
|
||||
process_type.empty() &&
|
||||
electron::fuses::IsLoadBrowserProcessSpecificV8SnapshotEnabled();
|
||||
if (load_browser_process_specific_v8_snapshot) {
|
||||
return "browser_v8_context_snapshot.bin";
|
||||
}
|
||||
return ContentMainDelegate::GetBrowserV8SnapshotFilename();
|
||||
}
|
||||
|
||||
content::ContentBrowserClient*
|
||||
ElectronMainDelegate::CreateContentBrowserClient() {
|
||||
browser_client_ = std::make_unique<ElectronBrowserClient>();
|
||||
|
||||
@@ -30,6 +30,8 @@ class ElectronMainDelegate : public content::ContentMainDelegate {
|
||||
ElectronMainDelegate(const ElectronMainDelegate&) = delete;
|
||||
ElectronMainDelegate& operator=(const ElectronMainDelegate&) = delete;
|
||||
|
||||
base::StringPiece GetBrowserV8SnapshotFilename() override;
|
||||
|
||||
protected:
|
||||
// content::ContentMainDelegate:
|
||||
bool BasicStartupComplete(int* exit_code) override;
|
||||
|
||||
Reference in New Issue
Block a user