mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-29 07:42:04 +00:00
a538eb7804
Prior to this patch, we were sending a boolean from InitContentChild (which creates our StartupCache IPC actors) indicating whether we wanted to collect new entries from a given process or not. This was so that we wouldn't accept PutBuffer requests in these processes, since collecting them in one process would be enough, and we don't want to waste memory. However, we actually want the cache to be available before we can even get that IPC constructor to the child process, so there's a window where we accept new entries no matter what. This patch changes this by sending a boolean argument via the command line indicating that we want to disable the Startupcache in this process entirely. We send this when we didn't load a StartupCache off disk, as this should be the only circumstance in which we're actually collecting a substantial number of entries in content processes. Differential Revision: https://phabricator.services.mozilla.com/D83400
32 lines
1.1 KiB
C++
32 lines
1.1 KiB
C++
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/scache/StartupCacheParent.h"
|
|
|
|
#include "mozilla/scache/StartupCache.h"
|
|
#include "mozilla/dom/ContentParent.h"
|
|
|
|
namespace mozilla {
|
|
namespace scache {
|
|
|
|
IPCResult StartupCacheParent::Recv__delete__(nsTArray<EntryData>&& entries) {
|
|
if (entries.Length()) {
|
|
auto* cache = StartupCache::GetSingleton();
|
|
for (auto& entry : entries) {
|
|
auto buffer = MakeUnique<char[]>(entry.data().Length());
|
|
memcpy(buffer.get(), entry.data().Elements(), entry.data().Length());
|
|
cache->PutBuffer(entry.key().get(), std::move(buffer),
|
|
entry.data().Length(), /* isFromChildProcess:*/ true);
|
|
}
|
|
}
|
|
|
|
return IPC_OK();
|
|
}
|
|
|
|
void StartupCacheParent::ActorDestroy(ActorDestroyReason aWhy) {}
|
|
|
|
} // namespace scache
|
|
} // namespace mozilla
|