Backed out changeset 39ffa8a7801a (bug 1361900)

This commit is contained in:
Sebastian Hengst
2017-05-13 18:53:50 +02:00
parent 0b25c5d332
commit e04a511297
4 changed files with 2 additions and 88 deletions

View File

@@ -13,8 +13,6 @@
#include "mozilla/Logging.h"
#include "mozilla/Services.h"
#include "mozilla/Unused.h"
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/ScriptSettings.h"
#include "MainThreadUtils.h"
@@ -43,9 +41,6 @@ static LazyLogModule gLog("ScriptPreloader");
using mozilla::dom::AutoJSAPI;
using namespace mozilla::loader;
ProcessType ScriptPreloader::sProcessType;
nsresult
ScriptPreloader::CollectReports(nsIHandleReportCallback* aHandleReport,
nsISupports* aData, bool aAnonymize)
@@ -90,15 +85,6 @@ ScriptPreloader::GetSingleton()
}
ProcessType
ScriptPreloader::GetChildProcessType(const nsAString& remoteType)
{
if (remoteType.EqualsLiteral(EXTENSION_REMOTE_TYPE)) {
return ProcessType::Extension;
}
return ProcessType::Web;
}
namespace {
struct MOZ_RAII AutoSafeJSAPI : public AutoJSAPI
@@ -134,12 +120,6 @@ ScriptPreloader::ScriptPreloader()
: mMonitor("[ScriptPreloader.mMonitor]")
, mSaveMonitor("[ScriptPreloader.mSaveMonitor]")
{
if (XRE_IsParentProcess()) {
sProcessType = ProcessType::Parent;
} else {
sProcessType = GetChildProcessType(dom::ContentChild::GetSingleton()->GetRemoteType());
}
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
MOZ_RELEASE_ASSERT(obs);
obs->AddObserver(this, DELAYED_STARTUP_TOPIC, false);
@@ -261,7 +241,7 @@ ScriptPreloader::GetCacheFile(const char* leafName)
return Move(cacheFile);
}
static const uint8_t MAGIC[] = "mozXDRcachev001";
static const uint8_t MAGIC[] = "mozXDRcache";
Result<Ok, nsresult>
ScriptPreloader::OpenCache()
@@ -373,8 +353,7 @@ ScriptPreloader::InitCache()
JS::CompileOptions options(cx, JSVERSION_LATEST);
for (auto script : mRestoredScripts) {
if (script->mProcessTypes.contains(CurrentProcessType()) &&
script->mSize > MIN_OFFTHREAD_SIZE &&
if (script->mSize > MIN_OFFTHREAD_SIZE &&
JS::CanCompileOffThread(cx, options, script->mSize)) {
DecodeScriptOffThread(cx, script);
} else {
@@ -464,7 +443,6 @@ ScriptPreloader::PrepareCacheWrite()
// - Its cache key.
// - The offset of its XDR data within the XDR data block.
// - The size of its XDR data in the XDR data block.
// - A bit field describing which process types the script is used in.
//
// - A block of XDR data for the encoded scripts, with each script's data at
// an offset from the start of the block, as specified above.
@@ -586,13 +564,10 @@ ScriptPreloader::NoteScript(const nsCString& url, const nsCString& cachePath,
mSavedScripts.insertBack(restored);
MOZ_ASSERT(script);
restored->mProcesses += CurrentProcessType();
restored->mScript = script;
restored->mReadyToExecute = true;
} else if (!exists) {
auto cachedScript = new CachedScript(url, cachePath, script);
cachedScript->mProcesses += CurrentProcessType();
mSavedScripts.insertBack(cachedScript);
mScripts.Put(cachePath, cachedScript);
}