Backed out changeset 39ffa8a7801a (bug 1361900)

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

View File

@ -9,7 +9,6 @@
#include "mozilla/Attributes.h"
#include "mozilla/Assertions.h"
#include "mozilla/CheckedInt.h"
#include "mozilla/EnumSet.h"
#include "mozilla/Range.h"
#include "mozilla/Result.h"
#include "mozilla/Unused.h"
@ -56,22 +55,6 @@ public:
return buf;
}
void
codeUint8(const uint8_t& val)
{
*write(sizeof val) = val;
}
template<typename T>
void
codeUint8(const EnumSet<T>& val)
{
// EnumSets are always represented as uint32_t values, so we need to
// assert that the value actually fits in a uint8 before writing it.
uint32_t value = val.serialize();
codeUint8(CheckedUint8(value).value());
}
void
codeUint16(const uint16_t& val)
{
@ -122,26 +105,6 @@ public:
return buf;
}
bool
codeUint8(uint8_t& val)
{
if (checkCapacity(sizeof val)) {
val = *read(sizeof val);
}
return !error_;
}
template<typename T>
bool
codeUint8(EnumSet<T>& val)
{
uint8_t value;
if (codeUint8(value)) {
val.deserialize(value);
}
return !error_;
}
bool
codeUint16(uint16_t& val)
{

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);
}

View File

@ -6,8 +6,6 @@
#ifndef ScriptPreloader_h
#define ScriptPreloader_h
#include "mozilla/CheckedInt.h"
#include "mozilla/EnumSet.h"
#include "mozilla/LinkedList.h"
#include "mozilla/MemoryReporting.h"
#include "mozilla/Maybe.h"
@ -29,12 +27,6 @@
namespace mozilla {
namespace loader {
class InputBuffer;
enum class ProcessType : uint8_t {
Parent,
Web,
Extension,
};
}
using namespace mozilla::loader;
@ -53,8 +45,6 @@ public:
static ScriptPreloader& GetSingleton();
static ProcessType GetChildProcessType(const nsAString& remoteType);
// Retrieves the script with the given cache key from the script cache.
// Returns null if the script is not cached.
JSScript* GetCachedScript(JSContext* cx, const nsCString& name);
@ -69,11 +59,6 @@ public:
void Trace(JSTracer* trc);
static ProcessType CurrentProcessType()
{
return sProcessType;
}
protected:
virtual ~ScriptPreloader() = default;
@ -141,7 +126,6 @@ private:
buffer.codeString(mCachePath);
buffer.codeUint32(mOffset);
buffer.codeUint32(mSize);
buffer.codeUint8(mProcessTypes);
}
// Returns the XDR data generated for this script during this session. See
@ -196,9 +180,6 @@ private:
// has not yet been finalized on the main thread.
void* mToken = nullptr;
// The set of processes in which this script has been used.
EnumSet<ProcessType> mProcessTypes{};
// The read-only XDR data for this script, which was either read from an
// existing cache file, or generated by encoding a script which was
// compiled during this session.
@ -296,9 +277,6 @@ private:
bool mSaveComplete = false;
bool mDataPrepared = false;
// The process type of the current process.
static ProcessType sProcessType;
nsCOMPtr<nsIFile> mProfD;
nsCOMPtr<nsIThread> mSaveThread;

View File

@ -43,7 +43,5 @@ LOCAL_INCLUDES += [
'/dom/base',
]
include('/ipc/chromium/chromium-config.mozbuild')
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-Wno-shadow']