Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use the process cache to reduce the memory for asar file #36600

Merged
merged 2 commits into from Dec 14, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions shell/common/api/electron_api_asar.cc
Expand Up @@ -39,7 +39,7 @@ class Archive : public node::ObjectWrap {
Archive& operator=(const Archive&) = delete;

protected:
explicit Archive(std::unique_ptr<asar::Archive> archive)
explicit Archive(std::shared_ptr<asar::Archive> archive)
: archive_(std::move(archive)) {}

static void New(const v8::FunctionCallbackInfo<v8::Value>& args) {
Expand All @@ -52,8 +52,8 @@ class Archive : public node::ObjectWrap {
return;
}

auto archive = std::make_unique<asar::Archive>(path);
if (!archive->Init()) {
auto archive = asar::GetOrCreateAsarArchive(path);
nornagon marked this conversation as resolved.
Show resolved Hide resolved
if (!archive) {
isolate->ThrowException(v8::Exception::Error(node::FIXED_ONE_BYTE_STRING(
isolate, "failed to initialize archive")));
return;
Expand Down Expand Up @@ -190,7 +190,7 @@ class Archive : public node::ObjectWrap {
isolate, wrap->archive_ ? wrap->archive_->GetUnsafeFD() : -1));
}

std::unique_ptr<asar::Archive> archive_;
std::shared_ptr<asar::Archive> archive_;
};

static void InitAsarSupport(const v8::FunctionCallbackInfo<v8::Value>& args) {
Expand Down