Backout 5649b6b8cec3 (bug 1219246) for Linux xpcshell bustage

This commit is contained in:
Nathan Froyd 2015-10-31 13:34:06 -04:00
Родитель cd7a409e01
Коммит 78c64c0cde
4 изменённых файлов: 37 добавлений и 41 удалений

Просмотреть файл

@ -71,7 +71,6 @@
#include "nsArrayEnumerator.h"
#include "nsStringEnumerator.h"
#include "mozilla/FileUtils.h"
#include "mozilla/UniquePtr.h"
#include "nsDataHashtable.h"
#include <new> // for placement new
@ -621,18 +620,18 @@ DoRegisterManifest(NSLocationType aType,
MOZ_ASSERT(!aXPTOnly || !nsComponentManagerImpl::gComponentManager);
uint32_t len;
FileLocation::Data data;
UniquePtr<char[]> buf;
nsAutoArrayPtr<char> buf;
nsresult rv = aFile.GetData(data);
if (NS_SUCCEEDED(rv)) {
rv = data.GetSize(&len);
}
if (NS_SUCCEEDED(rv)) {
buf = MakeUnique<char[]>(len + 1);
rv = data.Copy(buf.get(), len);
buf = new char[len + 1];
rv = data.Copy(buf, len);
}
if (NS_SUCCEEDED(rv)) {
buf[len] = '\0';
ParseManifest(aType, aFile, buf.get(), aChromeOnly, aXPTOnly);
ParseManifest(aType, aFile, buf, aChromeOnly, aXPTOnly);
} else if (NS_BOOTSTRAPPED_LOCATION != aType) {
nsCString uri;
aFile.GetURIString(uri);
@ -700,17 +699,17 @@ DoRegisterXPT(FileLocation& aFile)
uint32_t len;
FileLocation::Data data;
UniquePtr<char[]> buf;
nsAutoArrayPtr<char> buf;
nsresult rv = aFile.GetData(data);
if (NS_SUCCEEDED(rv)) {
rv = data.GetSize(&len);
}
if (NS_SUCCEEDED(rv)) {
buf = MakeUnique<char[]>(len);
rv = data.Copy(buf.get(), len);
buf = new char[len];
rv = data.Copy(buf, len);
}
if (NS_SUCCEEDED(rv)) {
XPTInterfaceInfoManager::GetSingleton()->RegisterBuffer(buf.get(), len);
XPTInterfaceInfoManager::GetSingleton()->RegisterBuffer(buf, len);
#ifdef MOZ_B2G_LOADER
MarkRegisteredXPTIInfo(aFile);
#endif

Просмотреть файл

@ -24,8 +24,6 @@
#define READ_BINARYMODE "r"
#endif
using namespace mozilla;
#ifdef XP_WIN
inline FILE*
TS_tfopen(const char* aPath, const wchar_t* aMode)
@ -125,7 +123,7 @@ nsINIParser::InitFromFILE(FILE* aFd)
}
/* malloc an internal buf the size of the file */
mFileContents = MakeUnique<char[]>(flen + 2);
mFileContents = new char[flen + 2];
if (!mFileContents) {
return NS_ERROR_OUT_OF_MEMORY;
}
@ -135,7 +133,7 @@ nsINIParser::InitFromFILE(FILE* aFd)
return NS_BASE_STREAM_OSERROR;
}
int rd = fread(mFileContents.get(), sizeof(char), flen, aFd);
int rd = fread(mFileContents, sizeof(char), flen, aFd);
if (rd != flen) {
return NS_BASE_STREAM_OSERROR;
}
@ -174,13 +172,13 @@ nsINIParser::InitFromFILE(FILE* aFd)
return NS_ERROR_FAILURE;
}
UniquePtr<char[]> utf8Buffer(new char[flen]);
nsAutoArrayPtr<char> utf8Buffer(new char[flen]);
if (WideCharToMultiByte(CP_UTF8, 0, reinterpret_cast<LPWSTR>(buffer), -1,
utf8Buffer.get(), flen, nullptr, nullptr) == 0) {
utf8Buffer, flen, nullptr, nullptr) == 0) {
return NS_ERROR_FAILURE;
}
mFileContents = Move(utf8Buffer);
buffer = mFileContents.get();
mFileContents = utf8Buffer.forget();
buffer = mFileContents;
}
#endif
@ -244,13 +242,13 @@ nsINIParser::InitFromFILE(FILE* aFd)
break;
}
if (!v->next) {
v->next = MakeUnique<INIValue>(key, token);
v->next = new INIValue(key, token);
if (!v->next) {
return NS_ERROR_OUT_OF_MEMORY;
}
break;
}
v = v->next.get();
v = v->next;
}
NS_ASSERTION(v, "v should never be null coming out of this loop");
}
@ -271,7 +269,7 @@ nsINIParser::GetString(const char* aSection, const char* aKey,
return NS_OK;
}
val = val->next.get();
val = val->next;
}
return NS_ERROR_FAILURE;
@ -295,7 +293,7 @@ nsINIParser::GetString(const char* aSection, const char* aKey,
return NS_OK;
}
val = val->next.get();
val = val->next;
}
return NS_ERROR_FAILURE;
@ -320,7 +318,7 @@ nsINIParser::GetStrings(const char* aSection,
for (mSections.Get(aSection, &val);
val;
val = val->next.get()) {
val = val->next) {
if (!aCB(val->key, val->value, aClosure)) {
return NS_OK;

Просмотреть файл

@ -15,7 +15,7 @@
#include "nscore.h"
#include "nsClassHashtable.h"
#include "mozilla/UniquePtr.h"
#include "nsAutoPtr.h"
#include <stdio.h>
@ -106,11 +106,11 @@ private:
const char* key;
const char* value;
mozilla::UniquePtr<INIValue> next;
nsAutoPtr<INIValue> next;
};
nsClassHashtable<nsDepCharHashKey, INIValue> mSections;
mozilla::UniquePtr<char[]> mFileContents;
nsAutoArrayPtr<char> mFileContents;
nsresult InitFromFILE(FILE* aFd);
};

Просмотреть файл

@ -18,7 +18,6 @@
#include "nsIFile.h"
#include "prinrval.h"
#include "nsThreadUtils.h"
#include "mozilla/UniquePtr.h"
#include "gtest/gtest.h"
namespace TestExpirationTracker {
@ -50,7 +49,7 @@ public:
LogAction(obj, "Created");
}
nsTArray<mozilla::UniquePtr<Object>> mUniverse;
nsTArray<nsAutoArrayPtr<Object> > mUniverse;
void LogAction(Object* aObj, const char* aAction) {
if (logging) {
@ -80,28 +79,28 @@ public:
break;
}
case 1: {
UniquePtr<Object>& objref = mUniverse[uint32_t(rand())%mUniverse.Length()];
if (objref->mExpiration.IsTracked()) {
nsExpirationTracker<Object,K>::RemoveObject(objref.get());
LogAction(objref.get(), "Removed");
obj = mUniverse[uint32_t(rand())%mUniverse.Length()];
if (obj->mExpiration.IsTracked()) {
nsExpirationTracker<Object,K>::RemoveObject(obj);
LogAction(obj, "Removed");
}
break;
}
case 2: {
UniquePtr<Object>& objref = mUniverse[uint32_t(rand())%mUniverse.Length()];
if (!objref->mExpiration.IsTracked()) {
objref->Touch();
nsExpirationTracker<Object,K>::AddObject(objref.get());
LogAction(objref.get(), "Added");
obj = mUniverse[uint32_t(rand())%mUniverse.Length()];
if (!obj->mExpiration.IsTracked()) {
obj->Touch();
nsExpirationTracker<Object,K>::AddObject(obj);
LogAction(obj, "Added");
}
break;
}
case 3: {
UniquePtr<Object>& objref = mUniverse[uint32_t(rand())%mUniverse.Length()];
if (objref->mExpiration.IsTracked()) {
objref->Touch();
nsExpirationTracker<Object,K>::MarkUsed(objref.get());
LogAction(objref.get(), "Marked used");
obj = mUniverse[uint32_t(rand())%mUniverse.Length()];
if (obj->mExpiration.IsTracked()) {
obj->Touch();
nsExpirationTracker<Object,K>::MarkUsed(obj);
LogAction(obj, "Marked used");
}
break;
}