Bug 1519636 - Automatically reformat recent changes using clang-format r=Ehsan

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D60354

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Sylvestre Ledru 2020-01-21 09:51:27 +00:00
parent 8726edbce5
commit 187e9bafaf
88 changed files with 626 additions and 684 deletions

View File

@ -20,8 +20,8 @@ namespace dom {
class ChildProcessChannelListener final {
NS_INLINE_DECL_REFCOUNTING(ChildProcessChannelListener)
using Callback = std::function<void(nsIChannel*,
nsTArray<net::DocumentChannelRedirect>&&,
using Callback =
std::function<void(nsIChannel*, nsTArray<net::DocumentChannelRedirect>&&,
uint32_t, nsDOMNavigationTiming*)>;
void RegisterCallback(uint64_t aIdentifier, Callback&& aCallback);

View File

@ -601,7 +601,8 @@ void CustomElementRegistry::UpgradeCandidates(
return;
}
mozilla::UniquePtr<nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>> candidates;
mozilla::UniquePtr<nsTHashtable<nsRefPtrHashKey<nsIWeakReference>>>
candidates;
if (mCandidatesMap.Remove(aKey, &candidates)) {
MOZ_ASSERT(candidates);
CustomElementReactionsStack* reactionsStack =

View File

@ -191,8 +191,8 @@ class nsDOMNavigationTiming final : public mozilla::RelativeTimeline {
bool IsTopLevelContentDocumentInContentProcess() const;
// Should those be amended, the IPC serializer should be updated
// accordingly.
// Should those be amended, the IPC serializer should be updated
// accordingly.
mozilla::WeakPtr<nsDocShell> mDocShell;
nsCOMPtr<nsIURI> mUnloadedURI;

View File

@ -109,10 +109,8 @@ class nsIStyleSheetLinkingElement : public nsISupports {
already_AddRefed<nsIPrincipal> aTriggeringPrincipal,
already_AddRefed<nsIReferrerInfo> aReferrerInfo,
mozilla::CORSMode, const nsAString& aTitle,
const nsAString& aMedia,
const nsAString& aIntegrity,
const nsAString& aNonce,
HasAlternateRel, IsInline,
const nsAString& aMedia, const nsAString& aIntegrity,
const nsAString& aNonce, HasAlternateRel, IsInline,
IsExplicitlyEnabled);
~SheetInfo();

View File

@ -251,7 +251,8 @@ inline void AssignFromStringBuffer(nsStringBuffer* buffer, size_t len,
buffer->ToString(len, dest);
}
template <typename T, typename std::enable_if_t<std::is_same<typename T::char_type, char16_t>::value>* = nullptr>
template <typename T, typename std::enable_if_t<std::is_same<
typename T::char_type, char16_t>::value>* = nullptr>
inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) {
size_t len = JS::GetStringLength(s);
static_assert(js::MaxStringLength < (1 << 30),
@ -285,7 +286,8 @@ inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) {
}
// Specialization for UTF8String.
template <typename T, typename std::enable_if_t<std::is_same<typename T::char_type, char>::value>* = nullptr>
template <typename T, typename std::enable_if_t<std::is_same<
typename T::char_type, char>::value>* = nullptr>
inline bool AssignJSString(JSContext* cx, T& dest, JSString* s) {
using namespace mozilla;
CheckedInt<size_t> bufLen(JS::GetStringLength(s));

View File

@ -59,8 +59,7 @@ void BroadcastChannelService::RegisterActor(
AssertIsOnBackgroundThread();
MOZ_ASSERT(aParent);
const auto& parents =
mAgents.LookupForAdd(aOriginChannelKey).OrInsert([]() {
const auto& parents = mAgents.LookupForAdd(aOriginChannelKey).OrInsert([]() {
return new nsTArray<BroadcastChannelParent*>();
});

View File

@ -681,8 +681,7 @@ class RawBuffer {
* If aTakeData is true, RawBuffer will delete[] the memory when destroyed.
*/
RawBuffer(size_t len, T* data, bool aTakeData = false)
: mData(data), mLength(len), mOwnsData(aTakeData) {
}
: mData(data), mLength(len), mOwnsData(aTakeData) {}
RawBuffer(size_t len, RefPtr<mozilla::ipc::SharedMemoryBasic>& aSmem)
: mSmem(aSmem), mData(aSmem->memory()), mLength(len), mOwnsData(false) {

View File

@ -188,7 +188,6 @@ void WindowGlobalParent::GetContentBlockingLog(nsAString& aLog) {
aLog.Assign(std::move(log));
}
mozilla::ipc::IPCResult WindowGlobalParent::RecvLoadURI(
dom::BrowsingContext* aTargetBC, nsDocShellLoadState* aLoadState,
bool aSetNavigating) {
@ -311,7 +310,7 @@ void WindowGlobalParent::NotifyContentBlockingEvent(
MOZ_ASSERT_IF(isCookiesBlockedTracker && !aBlocked, aReason.isSome());
MOZ_DIAGNOSTIC_ASSERT(XRE_IsParentProcess());
// TODO: temporarily remove this until we find the root case of Bug 1609144
//MOZ_DIAGNOSTIC_ASSERT_IF(XRE_IsE10sParentProcess(), !IsInProcess());
// MOZ_DIAGNOSTIC_ASSERT_IF(XRE_IsE10sParentProcess(), !IsInProcess());
// Return early if this WindowGlobalParent is in process.
if (IsInProcess()) {

View File

@ -3666,8 +3666,8 @@ void DatastoreWriteOptimizer::ApplyAndReset(
// about the UpdateWithMove flag.
aOrderedItems.RemoveElementAt(index);
entry.Data() = MakeUnique<InsertItemInfo>(updateItemInfo->SerialNumber(),
updateItemInfo->GetKey(),
entry.Data() = MakeUnique<InsertItemInfo>(
updateItemInfo->SerialNumber(), updateItemInfo->GetKey(),
updateItemInfo->GetValue());
} else {
item.value() = updateItemInfo->GetValue();

View File

@ -1210,9 +1210,11 @@ bool RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) {
{
MutexAutoLock lock(mMutex);
const auto& domainInfo = mDomainMap.LookupForAdd(domain).OrInsert([&domain, parent]() {
const auto& domainInfo =
mDomainMap.LookupForAdd(domain).OrInsert([&domain, parent]() {
NS_ASSERTION(!parent, "Shouldn't have a parent here!");
Unused << parent; // silence clang -Wunused-lambda-capture in opt builds
Unused
<< parent; // silence clang -Wunused-lambda-capture in opt builds
WorkerDomainInfo* wdi = new WorkerDomainInfo();
wdi->mDomain = domain;
return wdi;
@ -1277,8 +1279,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate* aWorkerPrivate) {
if (!isServiceWorker) {
// Service workers are excluded since their lifetime is separate from
// that of dom windows.
const auto& windowArray =
mWindowMap.LookupForAdd(window).OrInsert(
const auto& windowArray = mWindowMap.LookupForAdd(window).OrInsert(
[]() { return new nsTArray<WorkerPrivate*>(1); });
if (!windowArray->Contains(aWorkerPrivate)) {
windowArray->AppendElement(aWorkerPrivate);

View File

@ -2194,7 +2194,6 @@ WorkerPrivate::WorkerPrivate(
mJSSettings.content.realmOptions.creationOptions().setToSourceEnabled(
UsesSystemPrincipal());
if (mIsSecureContext) {
mJSSettings.chrome.realmOptions.creationOptions().setSecureContext(true);
mJSSettings.content.realmOptions.creationOptions().setSecureContext(true);

View File

@ -193,8 +193,8 @@ ChangeStyleTransaction::DoTransaction() {
} else {
values.Assign(mValue);
}
rv = cssDecl->SetProperty(propertyNameString,
NS_ConvertUTF16toUTF8(values), priority);
rv = cssDecl->SetProperty(propertyNameString, NS_ConvertUTF16toUTF8(values),
priority);
NS_ENSURE_SUCCESS(rv, rv);
}

View File

@ -610,7 +610,8 @@ bool WordSplitState<T>::ShouldSkipWord(int32_t aStart, int32_t aLength) const {
// check to see if the word contains a digit
for (int32_t i = aStart; i < last; i++) {
if (mozilla::unicode::GetGenCategory(GetUnicharAt(i)) == nsUGenCategory::kNumber) {
if (mozilla::unicode::GetGenCategory(GetUnicharAt(i)) ==
nsUGenCategory::kNumber) {
return true;
}
}

View File

@ -3538,7 +3538,8 @@ void AsyncPanZoomController::RecordScrollPayload(const TimeStamp& aTimeStamp) {
}
}
void AsyncPanZoomController::StartTouch(const ParentLayerPoint& aPoint, uint32_t aTime) {
void AsyncPanZoomController::StartTouch(const ParentLayerPoint& aPoint,
uint32_t aTime) {
RecursiveMutexAutoLock lock(mRecursiveMutex);
mX.StartTouch(aPoint.x, aTime);
mY.StartTouch(aPoint.y, aTime);

View File

@ -843,7 +843,8 @@ class AsyncPanZoomController {
void TrackTouch(const MultiTouchInput& aEvent);
/**
* Register the start of a touch or pan gesture at the given position and time.
* Register the start of a touch or pan gesture at the given position and
* time.
*/
void StartTouch(const ParentLayerPoint& aPoint, uint32_t aTime);

View File

@ -739,7 +739,8 @@ mozilla::ipc::IPCResult ContentCompositorBridgeParent::RecvPreferredDXGIAdapter(
return IPC_FAIL_NO_REASON(this);
}
RefPtr<ID3D11Device> device = gfx::DeviceManagerDx::Get()->GetCompositorDevice();
RefPtr<ID3D11Device> device =
gfx::DeviceManagerDx::Get()->GetCompositorDevice();
if (!device) {
return IPC_FAIL_NO_REASON(this);
}

View File

@ -53,9 +53,9 @@ class gfxWindowsNativeDrawing {
* } while (nativeDraw.ShouldRenderAgain());
* nativeDraw.PaintToContext();
*/
gfxWindowsNativeDrawing(gfxContext* ctx, const gfxRect& nativeRect,
uint32_t nativeDrawFlags =
CANNOT_DRAW_TO_COLOR_ALPHA |
gfxWindowsNativeDrawing(
gfxContext* ctx, const gfxRect& nativeRect,
uint32_t nativeDrawFlags = CANNOT_DRAW_TO_COLOR_ALPHA |
CANNOT_AXIS_ALIGNED_SCALE |
CANNOT_COMPLEX_TRANSFORM);

View File

@ -551,7 +551,7 @@ enum class VRTelemetryId : uint8_t {
TOTAL = 4,
};
enum class VRTelemetryInstallFrom: uint8_t {
enum class VRTelemetryInstallFrom : uint8_t {
User = 0,
FxR = 1,
HTC = 2,
@ -559,7 +559,7 @@ enum class VRTelemetryInstallFrom: uint8_t {
TOTAL = 4,
};
enum class VRTelemetryEntryMethod: uint8_t {
enum class VRTelemetryEntryMethod : uint8_t {
SystemBtn = 0,
Library = 1,
Gaze = 2,

View File

@ -433,8 +433,8 @@ void DCSurface::UpdateAllocatedRect() {
for (auto it = mDCLayers.begin(); it != mDCLayers.end(); ++it) {
RECT rect;
rect.left = (LONG) (VIRTUAL_OFFSET + it->first.mX * mTileSize.width);
rect.top = (LONG) (VIRTUAL_OFFSET + it->first.mY * mTileSize.height);
rect.left = (LONG)(VIRTUAL_OFFSET + it->first.mX * mTileSize.width);
rect.top = (LONG)(VIRTUAL_OFFSET + it->first.mY * mTileSize.height);
rect.right = rect.left + mTileSize.width;
rect.bottom = rect.top + mTileSize.height;

View File

@ -28,10 +28,7 @@ class PipeToState : public NativeObject {
/**
* Memory layout for PipeToState instances.
*/
enum Slots {
Slot_Flags,
SlotCount
};
enum Slots { Slot_Flags, SlotCount };
private:
enum Flags {

View File

@ -162,7 +162,6 @@ class FreeSpan {
* index calculation easier; see TenuredCell::indexInArena() for details.
*/
class Arena {
/*
* The first span of free things in the arena. Most of these spans are
* stored as offsets in free regions of the data array, and most operations

View File

@ -1156,7 +1156,8 @@ JS_PUBLIC_API JSProtoKey JS_IdToProtoKey(JSContext* cx, HandleId id) {
return JSProto_Null;
}
static_assert(mozilla::ArrayLength(standard_class_names) == JSProto_LIMIT + 1);
static_assert(mozilla::ArrayLength(standard_class_names) ==
JSProto_LIMIT + 1);
return static_cast<JSProtoKey>(stdnm - standard_class_names);
}

View File

@ -1656,25 +1656,25 @@ static MOZ_NEVER_INLINE JS_HAZ_JSNATIVE_CALLER bool Interpret(JSContext* cx,
* indirect goto (aka a threaded interpreter), which is technically
* non-standard but is supported by all of our supported compilers.
*/
# define INTERPRETER_LOOP()
# define CASE(OP) label_##OP:
# define DEFAULT() \
#define INTERPRETER_LOOP()
#define CASE(OP) label_##OP:
#define DEFAULT() \
label_default:
# define DISPATCH_TO(OP) goto* addresses[(OP)]
#define DISPATCH_TO(OP) goto* addresses[(OP)]
# define LABEL(X) (&&label_##X)
#define LABEL(X) (&&label_##X)
// Use addresses instead of offsets to optimize for runtime speed over
// load-time relocation overhead.
static const void* const addresses[EnableInterruptsPseudoOpcode + 1] = {
# define OPCODE_LABEL(op, ...) LABEL(op),
#define OPCODE_LABEL(op, ...) LABEL(op),
FOR_EACH_OPCODE(OPCODE_LABEL)
# undef OPCODE_LABEL
# define TRAILING_LABEL(v) \
#undef OPCODE_LABEL
#define TRAILING_LABEL(v) \
((v) == EnableInterruptsPseudoOpcode ? LABEL(EnableInterruptsPseudoOpcode) \
: LABEL(default)),
FOR_EACH_TRAILING_UNUSED_OPCODE(TRAILING_LABEL)
# undef TRAILING_LABEL
#undef TRAILING_LABEL
};
/*

View File

@ -893,8 +893,8 @@ void js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v,
if (!reportScanStack) {
JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
JSMSG_CANT_CONVERT_TO,
NullOrUndefinedToCharZ(v), "object");
JSMSG_CANT_CONVERT_TO, NullOrUndefinedToCharZ(v),
"object");
return;
}
@ -938,8 +938,7 @@ void js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v,
if (!reportScanStack) {
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_PROPERTY_FAIL,
keyStr.get(),
NullOrUndefinedToCharZ(v));
keyStr.get(), NullOrUndefinedToCharZ(v));
return;
}
@ -957,8 +956,8 @@ void js::ReportIsNullOrUndefinedForPropertyAccess(JSContext* cx, HandleValue v,
}
JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr,
JSMSG_PROPERTY_FAIL_EXPR, keyStr.get(),
bytes.get(), NullOrUndefinedToCharZ(v));
JSMSG_PROPERTY_FAIL_EXPR, keyStr.get(), bytes.get(),
NullOrUndefinedToCharZ(v));
}
bool js::ReportValueErrorFlags(JSContext* cx, unsigned flags,

View File

@ -279,9 +279,9 @@ bool nsCounterManager::AddCounterChanges(nsIFrame* aFrame) {
nsCounterList* nsCounterManager::CounterListFor(nsAtom* aCounterName) {
MOZ_ASSERT(aCounterName);
return mNames.LookupForAdd(aCounterName).OrInsert([]() {
return new nsCounterList();
}).get();
return mNames.LookupForAdd(aCounterName)
.OrInsert([]() { return new nsCounterList(); })
.get();
}
void nsCounterManager::RecalcAll() {

View File

@ -89,9 +89,8 @@ struct nsCounterUseNode : public nsCounterNode {
}
// args go directly to member variables here and of nsGenConNode
nsCounterUseNode(mozilla::CounterStylePtr aCounterStyle,
nsString aSeparator, uint32_t aContentIndex,
bool aAllCounters)
nsCounterUseNode(mozilla::CounterStylePtr aCounterStyle, nsString aSeparator,
uint32_t aContentIndex, bool aAllCounters)
: nsCounterNode(aContentIndex, USE),
mCounterStyle(std::move(aCounterStyle)),
mSeparator(std::move(aSeparator)),

View File

@ -37,11 +37,9 @@ using mozilla::dom::Document;
already_AddRefed<nsIContentViewer> NS_NewContentViewer();
static const char* const gHTMLTypes[] = {TEXT_HTML,
VIEWSOURCE_CONTENT_TYPE,
static const char* const gHTMLTypes[] = {TEXT_HTML, VIEWSOURCE_CONTENT_TYPE,
APPLICATION_XHTML_XML,
APPLICATION_WAPXHTML_XML,
0};
APPLICATION_WAPXHTML_XML, 0};
static const char* const gXMLTypes[] = {TEXT_XML,
APPLICATION_XML,

View File

@ -9298,8 +9298,9 @@ static nsRect UnionBorderBoxes(
// Iterate over all children except pop-up, absolutely-positioned,
// float, and overflow ones.
const nsIFrame::ChildListIDs skip = {
nsIFrame::kPopupList, nsIFrame::kSelectPopupList, nsIFrame::kAbsoluteList,
nsIFrame::kFixedList, nsIFrame::kFloatList, nsIFrame::kOverflowList};
nsIFrame::kPopupList, nsIFrame::kSelectPopupList,
nsIFrame::kAbsoluteList, nsIFrame::kFixedList,
nsIFrame::kFloatList, nsIFrame::kOverflowList};
for (nsIFrame::ChildListIterator childLists(aFrame); !childLists.IsDone();
childLists.Next()) {
if (skip.contains(childLists.CurrentID())) {

View File

@ -22,7 +22,8 @@ class CSSFontFaceRuleDecl final : public nsICSSDeclaration {
NS_DECL_NSIDOMCSSSTYLEDECLARATION_HELPER
nsINode* GetParentObject() final;
void IndexedGetter(uint32_t aIndex, bool& aFound, nsACString& aPropName) final;
void IndexedGetter(uint32_t aIndex, bool& aFound,
nsACString& aPropName) final;
void GetPropertyValue(nsCSSFontDesc aFontDescID, nsAString& aResult) const;

View File

@ -626,7 +626,8 @@ static void AddImageURL(const nsStyleImageRequest& aRequest,
AddImageURL(aRequest.GetImageValue(), aURLs);
}
static void AddImageURL(const nsStyleImage& aImage, nsTArray<nsCString>& aURLs) {
static void AddImageURL(const nsStyleImage& aImage,
nsTArray<nsCString>& aURLs) {
if (auto* urlValue = aImage.GetURLValue()) {
AddImageURL(*urlValue, aURLs);
}
@ -1571,7 +1572,8 @@ already_AddRefed<CSSValue> nsComputedDOMStyle::GetGridTemplateColumnsRows(
uint32_t numSizes = trackSizes.Length();
MOZ_ASSERT(numSizes >= numLeadingImplicitTracks + numExplicitTracks);
const bool hasTracksToSerialize = serializeImplicit ? !!numSizes : !!numExplicitTracks;
const bool hasTracksToSerialize =
serializeImplicit ? !!numSizes : !!numExplicitTracks;
const bool hasRepeatAuto = aTrackList.HasRepeatAuto();
if (!hasTracksToSerialize && !hasRepeatAuto) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
@ -1693,8 +1695,8 @@ already_AddRefed<CSSValue> nsComputedDOMStyle::GetGridTemplateColumnsRows(
// Add any trailing implicit tracks.
if (serializeImplicit) {
for (uint32_t i = numLeadingImplicitTracks + numExplicitTracks; i < numSizes;
++i) {
for (uint32_t i = numLeadingImplicitTracks + numExplicitTracks;
i < numSizes; ++i) {
RefPtr<nsROCSSPrimitiveValue> val = new nsROCSSPrimitiveValue;
val->SetAppUnits(trackSizes[i]);
valueList->AppendCSSValue(val.forget());

View File

@ -74,7 +74,8 @@ class nsComputedDOMStyle final : public nsDOMCSSDeclaration,
const nsACString& aValue,
nsIPrincipal* aSubjectPrincipal) override;
void IndexedGetter(uint32_t aIndex, bool& aFound, nsACString& aPropName) final;
void IndexedGetter(uint32_t aIndex, bool& aFound,
nsACString& aPropName) final;
enum StyleType {
eDefaultOnly, // Only includes UA and user sheets

View File

@ -328,8 +328,9 @@ nsresult nsDOMCSSDeclaration::ParseCustomPropertyValue(
aSubjectPrincipal, &closureData,
[&](DeclarationBlock* decl, ParsingEnvironment& env) {
return Servo_DeclarationBlock_SetProperty(
decl->Raw(), &aPropertyName, &aPropValue, aIsImportant, env.mUrlExtraData,
ParsingMode::Default, env.mCompatMode, env.mLoader, closure);
decl->Raw(), &aPropertyName, &aPropValue, aIsImportant,
env.mUrlExtraData, ParsingMode::Default, env.mCompatMode,
env.mLoader, closure);
});
}

View File

@ -89,8 +89,8 @@ enum class StyleDisplay : uint16_t {
/// XUL boxes.
MozBox =
StyleDisplayFrom(StyleDisplayOutside::Block, StyleDisplayInside::MozBox),
MozInlineBox = StyleDisplayFrom(StyleDisplayOutside::Inline,
StyleDisplayInside::MozBox),
MozInlineBox =
StyleDisplayFrom(StyleDisplayOutside::Inline, StyleDisplayInside::MozBox),
MozGrid =
StyleDisplayFrom(StyleDisplayOutside::XUL, StyleDisplayInside::MozGrid),
MozGridGroup = StyleDisplayFrom(StyleDisplayOutside::XUL,

View File

@ -2733,8 +2733,8 @@ nsPrefBranch::RemoveObserverImpl(const nsACString& aDomain,
mozilla::UniquePtr<PrefCallback> pCallback;
mObservers.Remove(&key, &pCallback);
if (pCallback) {
rv = Preferences::UnregisterCallback(NotifyObserver, prefName, pCallback.get(),
Preferences::PrefixMatch);
rv = Preferences::UnregisterCallback(
NotifyObserver, prefName, pCallback.get(), Preferences::PrefixMatch);
}
return rv;

View File

@ -11,9 +11,7 @@
#include <shlwapi.h>
static int NormalImport() {
return ::GetSystemMetrics(SM_CYCAPTION);
}
static int NormalImport() { return ::GetSystemMetrics(SM_CYCAPTION); }
static bool DelayLoadImport() {
return !!::UrlIsW(L"http://example.com/", URLIS_FILEURL);

View File

@ -1216,8 +1216,8 @@ nsresult CacheFile::SetNetworkTimes(uint64_t aOnStartTime,
aOnStopTime <= kIndexTimeOutOfBound ? aOnStopTime : kIndexTimeOutOfBound;
if (mHandle && !mHandle->IsDoomed()) {
CacheFileIOManager::UpdateIndexEntry(mHandle, nullptr, nullptr,
&onStartTime16, &onStopTime16, nullptr);
CacheFileIOManager::UpdateIndexEntry(
mHandle, nullptr, nullptr, &onStartTime16, &onStopTime16, nullptr);
}
return NS_OK;
}
@ -2539,9 +2539,8 @@ nsresult CacheFile::InitIndexEntry() {
contentType = n64;
}
rv = CacheFileIOManager::UpdateIndexEntry(mHandle, &frecency, &hasAltData,
&onStartTime, &onStopTime,
&contentType);
rv = CacheFileIOManager::UpdateIndexEntry(
mHandle, &frecency, &hasAltData, &onStartTime, &onStopTime, &contentType);
NS_ENSURE_SUCCESS(rv, rv);
return NS_OK;

View File

@ -1033,13 +1033,12 @@ class UpdateIndexEntryEvent : public Runnable {
return NS_OK;
}
CacheIndex::UpdateEntry(
mHandle->Hash(), mHasFrecency ? &mFrecency : nullptr,
CacheIndex::UpdateEntry(mHandle->Hash(),
mHasFrecency ? &mFrecency : nullptr,
mHasHasAltData ? &mHasAltData : nullptr,
mHasOnStartTime ? &mOnStartTime : nullptr,
mHasOnStopTime ? &mOnStopTime : nullptr,
mHasContentType ? &mContentType : nullptr,
nullptr);
mHasContentType ? &mContentType : nullptr, nullptr);
return NS_OK;
}
@ -3517,10 +3516,12 @@ nsresult CacheFileIOManager::InitIndexEntry(CacheFileHandle* aHandle,
}
// static
nsresult CacheFileIOManager::UpdateIndexEntry(
CacheFileHandle* aHandle, const uint32_t* aFrecency,
const bool* aHasAltData, const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime, const uint8_t* aContentType) {
nsresult CacheFileIOManager::UpdateIndexEntry(CacheFileHandle* aHandle,
const uint32_t* aFrecency,
const bool* aHasAltData,
const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime,
const uint8_t* aContentType) {
LOG(
("CacheFileIOManager::UpdateIndexEntry() [handle=%p, frecency=%s, "
"hasAltData=%s, onStartTime=%s, onStopTime=%s, contentType=%s]",

View File

@ -925,10 +925,12 @@ nsresult CacheIndex::RemoveEntry(const SHA1Sum::Hash* aHash) {
}
// static
nsresult CacheIndex::UpdateEntry(
const SHA1Sum::Hash* aHash, const uint32_t* aFrecency,
const bool* aHasAltData, const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime, const uint8_t* aContentType,
nsresult CacheIndex::UpdateEntry(const SHA1Sum::Hash* aHash,
const uint32_t* aFrecency,
const bool* aHasAltData,
const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime,
const uint8_t* aContentType,
const uint32_t* aSize) {
LOG(
("CacheIndex::UpdateEntry() [hash=%08x%08x%08x%08x%08x, "
@ -976,9 +978,8 @@ nsresult CacheIndex::UpdateEntry(
return NS_ERROR_UNEXPECTED;
}
if (!HasEntryChanged(
entry, aFrecency, aHasAltData, aOnStartTime, aOnStopTime,
aContentType, aSize)) {
if (!HasEntryChanged(entry, aFrecency, aHasAltData, aOnStartTime,
aOnStopTime, aContentType, aSize)) {
return NS_OK;
}

View File

@ -682,10 +682,12 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
// MUST be initialized. Call to AddEntry() or EnsureEntryExists() and to
// InitEntry() must precede the call to this method.
// Pass nullptr if the value didn't change.
static nsresult UpdateEntry(
const SHA1Sum::Hash* aHash, const uint32_t* aFrecency,
const bool* aHasAltData, const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime, const uint8_t* aContentType,
static nsresult UpdateEntry(const SHA1Sum::Hash* aHash,
const uint32_t* aFrecency,
const bool* aHasAltData,
const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime,
const uint8_t* aContentType,
const uint32_t* aSize);
// Remove all entries from the index. Called when clearing the whole cache.
@ -789,10 +791,12 @@ class CacheIndex final : public CacheFileIOListener, public nsIRunnable {
OriginAttrsHash aOriginAttrsHash, bool aAnonymous);
// Checks whether any of the information about the entry has changed.
static bool HasEntryChanged(
CacheIndexEntry* aEntry, const uint32_t* aFrecency,
const bool* aHasAltData, const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime, const uint8_t* aContentType,
static bool HasEntryChanged(CacheIndexEntry* aEntry,
const uint32_t* aFrecency,
const bool* aHasAltData,
const uint16_t* aOnStartTime,
const uint16_t* aOnStopTime,
const uint8_t* aContentType,
const uint32_t* aSize);
// Merge all pending operations from mPendingUpdates into mIndex.

View File

@ -453,8 +453,7 @@ nsresult Http3Session::ProcessOutputAndEvents() {
void Http3Session::SetupTimer(uint64_t aTimeout) {
MOZ_ASSERT(OnSocketThread(), "not on socket thread");
LOG(("Http3Session::SetupTimer to %" PRIu64 "ms [this=%p].", aTimeout,
this));
LOG(("Http3Session::SetupTimer to %" PRIu64 "ms [this=%p].", aTimeout, this));
if (!mTimer) {
mTimer = NS_NewTimer();
}

View File

@ -148,7 +148,8 @@ class nsHttpAuthNode {
nsTArray<nsAutoPtr<nsHttpAuthEntry> > mList;
friend class nsHttpAuthCache;
friend class mozilla::DefaultDelete<nsHttpAuthNode>; // needs to call the destructor
friend class mozilla::DefaultDelete<nsHttpAuthNode>; // needs to call the
// destructor
};
//-----------------------------------------------------------------------------

View File

@ -772,6 +772,7 @@ class nsHttpHandler final : public nsIHttpProtocolHandler,
TimeStamp mLastActiveTabLoadOptimizationHit;
Mutex mSpdyBlacklistLock;
public:
MOZ_MUST_USE nsresult NewChannelId(uint64_t& channelId);

View File

@ -281,7 +281,8 @@ void nsExpatDriver::HandleStartElement(void* aUserData, const char16_t* aName,
if (self->mSink) {
// We store the tagdepth in a PRUint16, so make sure the limit fits in a
// PRUint16.
static_assert(sMaxXMLTreeDepth <=
static_assert(
sMaxXMLTreeDepth <=
std::numeric_limits<decltype(nsExpatDriver::mTagDepth)>::max());
if (++self->mTagDepth > sMaxXMLTreeDepth) {

View File

@ -14,8 +14,7 @@ namespace mozilla {
namespace recordreplay {
Assembler::Assembler(uint8_t* aStorage, size_t aSize)
: mCursor(aStorage),
mCursorEnd(aStorage + aSize) {}
: mCursor(aStorage), mCursorEnd(aStorage + aSize) {}
// The maximum byte length of an x86/x64 instruction.
static const size_t MaximumInstructionLength = 15;
@ -25,9 +24,7 @@ void Assembler::Advance(size_t aSize) {
MOZ_RELEASE_ASSERT(mCursor + MaximumInstructionLength <= mCursorEnd);
}
uint8_t* Assembler::Current() {
return mCursor;
}
uint8_t* Assembler::Current() { return mCursor; }
void Assembler::Jump(void* aTarget) {
PushImmediate(aTarget);
@ -53,13 +50,9 @@ void Assembler::Push16(uint16_t aValue) {
Advance(4);
}
void Assembler::Return() {
NewInstruction(0xC3);
}
void Assembler::Return() { NewInstruction(0xC3); }
void Assembler::Breakpoint() {
NewInstruction(0xCC);
}
void Assembler::Breakpoint() { NewInstruction(0xCC); }
void Assembler::PushRax() { NewInstruction(0x50); }
@ -91,7 +84,8 @@ void Assembler::MoveRaxToRegister(Register aRegister) {
void Assembler::MoveRegisterToRax(Register aRegister) {
if (aRegister <= Register::RDI) {
NewInstruction(0x48, 0x89, 0xC0 + ((int)aRegister - (int)Register::RAX) * 8);
NewInstruction(0x48, 0x89,
0xC0 + ((int)aRegister - (int)Register::RAX) * 8);
} else {
NewInstruction(0x4C, 0x89, 0xC0 + ((int)aRegister - (int)Register::R8) * 8);
}

View File

@ -16,7 +16,22 @@ namespace recordreplay {
// x86-64 general purpose registers.
enum class Register {
RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI, R8, R9, R10, R11, R12, R13, R14, R15,
RAX,
RCX,
RDX,
RBX,
RSP,
RBP,
RSI,
RDI,
R8,
R9,
R10,
R11,
R12,
R13,
R14,
R15,
};
// Assembler for x64 instructions. This is a simple assembler that is primarily

View File

@ -95,7 +95,8 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) {
}
if (aDiverged) {
PrintSpew("OnExternalCall Diverged %s %s\n", redirection.mName, messageName);
PrintSpew("OnExternalCall Diverged %s %s\n", redirection.mName,
messageName);
}
MonitorAutoLock lock(*gMonitor);
@ -106,8 +107,7 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) {
// Save all the call's inputs.
{
ExternalCallContext cx(call, aArguments,
ExternalCallPhase::SaveInput);
ExternalCallContext cx(call, aArguments, ExternalCallPhase::SaveInput);
redirection.mExternalCall(cx);
if (cx.mFailed) {
delete call;
@ -145,8 +145,7 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) {
// we need. Run the SaveOutput phase to capture these so that we can reuse
// them later and associate any system outputs with the call.
if (!aDiverged) {
ExternalCallContext cx(call, aArguments,
ExternalCallPhase::SaveOutput);
ExternalCallContext cx(call, aArguments, ExternalCallPhase::SaveOutput);
redirection.mExternalCall(cx);
if (isNewCall) {
gUnflushedCalls.append(call);
@ -169,9 +168,8 @@ bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged) {
// Synchronously wait for the call result.
InfallibleVector<char> outputData;
child::SendExternalCallRequest(call->mId,
inputData.begin(), inputData.length(),
&outputData);
child::SendExternalCallRequest(call->mId, inputData.begin(),
inputData.length(), &outputData);
// Decode the external call's output.
BufferStream outputStream(outputData.begin(), outputData.length());
@ -416,9 +414,9 @@ void EX_SystemOutput(ExternalCallContext& aCx, const void** aOutput,
break;
}
// If we haven't encountered the aliased call, fall through and generate
// a new value for it. Aliases might be spurious if they were derived from
// the recording and reflect a value that was released and had its memory
// reused.
// a new value for it. Aliases might be spurious if they were derived
// from the recording and reflect a value that was released and had its
// memory reused.
}
*aOutput = MangledSystemValue(aCx.mCall->mId);
} while (false);

View File

@ -170,9 +170,7 @@ struct ExternalCallContext {
ExternalCallContext(ExternalCall* aCall, CallArguments* aArguments,
ExternalCallPhase aPhase)
: mCall(aCall),
mArguments(aArguments),
mPhase(aPhase) {
: mCall(aCall), mArguments(aArguments), mPhase(aPhase) {
switch (mPhase) {
case ExternalCallPhase::SaveInput:
mInputStream.emplace(&mCall->mInput);
@ -218,7 +216,8 @@ struct ExternalCallContext {
bool AccessInput() { return mInputStream.isSome(); }
void ReadOrWriteInputBytes(void* aBuffer, size_t aSize, bool aExcludeInput = false) {
void ReadOrWriteInputBytes(void* aBuffer, size_t aSize,
bool aExcludeInput = false) {
switch (mPhase) {
case ExternalCallPhase::SaveInput:
// Only one buffer can be excluded, and it has to be the last input to
@ -298,8 +297,7 @@ struct ExternalCallContext {
// any outputs for the call must be filled in; otherwise, they already have
// been filled in using data from the recording. Returns false if the call was
// unable to be processed.
bool OnExternalCall(size_t aCallId, CallArguments* aArguments,
bool aDiverged);
bool OnExternalCall(size_t aCallId, CallArguments* aArguments, bool aDiverged);
// In the external process, perform one or more calls encoded in aInputData
// and encode the output of the final call in aOutputData.
@ -375,9 +373,8 @@ template <size_t StringArg>
static inline void EX_CString(ExternalCallContext& aCx) {
if (aCx.AccessInput()) {
auto& buffer = aCx.mArguments->Arg<StringArg, char*>();
size_t len = (aCx.mPhase == ExternalCallPhase::SaveInput)
? strlen(buffer) + 1
: 0;
size_t len =
(aCx.mPhase == ExternalCallPhase::SaveInput) ? strlen(buffer) + 1 : 0;
aCx.ReadOrWriteInputBytes(&len, sizeof(len));
aCx.ReadOrWriteInputBuffer((void**)&buffer, len);
}
@ -425,9 +422,9 @@ static inline void EX_SkipExecuting(ExternalCallContext& aCx) {
static inline void EX_NoOp(ExternalCallContext& aCx) {}
template <ExternalCallFn Fn0, ExternalCallFn Fn1,
ExternalCallFn Fn2 = EX_NoOp, ExternalCallFn Fn3 = EX_NoOp,
ExternalCallFn Fn4 = EX_NoOp, ExternalCallFn Fn5 = EX_NoOp>
template <ExternalCallFn Fn0, ExternalCallFn Fn1, ExternalCallFn Fn2 = EX_NoOp,
ExternalCallFn Fn3 = EX_NoOp, ExternalCallFn Fn4 = EX_NoOp,
ExternalCallFn Fn5 = EX_NoOp>
static inline void EX_Compose(ExternalCallContext& aCx) {
Fn0(aCx);
Fn1(aCx);

View File

@ -231,18 +231,21 @@ MOZ_EXPORT void RecordReplayInterface_InternalInvalidateRecording(
Unreachable();
}
MOZ_EXPORT void RecordReplayInterface_InternalBeginPassThroughThreadEventsWithLocalReplay() {
MOZ_EXPORT void
RecordReplayInterface_InternalBeginPassThroughThreadEventsWithLocalReplay() {
if (IsReplaying() && !gReplayingInCloud) {
BeginPassThroughThreadEvents();
}
}
MOZ_EXPORT void RecordReplayInterface_InternalEndPassThroughThreadEventsWithLocalReplay() {
MOZ_EXPORT void
RecordReplayInterface_InternalEndPassThroughThreadEventsWithLocalReplay() {
// If we are replaying locally we will be skipping over a section of the
// recording while events are passed through. Include the current stream
// position in the recording so that we will know how much to skip over.
MOZ_RELEASE_ASSERT(Thread::CurrentIsMainThread());
Stream* localReplayStream = gRecording->OpenStream(StreamName::LocalReplaySkip, 0);
Stream* localReplayStream =
gRecording->OpenStream(StreamName::LocalReplaySkip, 0);
Stream& events = Thread::Current()->Events();
size_t position = IsRecording() ? events.StreamPosition() : 0;
@ -279,7 +282,8 @@ void FlushRecording() {
gRecording->AllowStreamWrites();
if (gRecording->Size() > gRecordingDataSentToMiddleman) {
child::SendRecordingData(gRecordingDataSentToMiddleman,
child::SendRecordingData(
gRecordingDataSentToMiddleman,
gRecording->Data() + gRecordingDataSentToMiddleman,
gRecording->Size() - gRecordingDataSentToMiddleman);
gRecordingDataSentToMiddleman = gRecording->Size();
@ -484,12 +488,12 @@ static void CrashDetectorThread(void*) {
request.body.exception == EXC_BAD_ACCESS && request.body.codeCnt == 2) {
uint8_t* faultingAddress = (uint8_t*)request.body.code[1];
child::MinidumpInfo info(request.body.exception, request.body.code[0],
request.body.code[1],
request.body.thread.name,
request.body.code[1], request.body.thread.name,
request.body.task.name);
child::ReportCrash(info, faultingAddress);
} else {
child::ReportFatalError("CrashDetectorThread mach_msg "
child::ReportFatalError(
"CrashDetectorThread mach_msg "
"returned unexpected data");
}

View File

@ -306,15 +306,18 @@ uint8_t* GenerateRedirectStub(Assembler& aAssembler, size_t aCallId,
if (aPreserveCallerSaveRegisters) {
static Register registers[] = {
Register::RDI, Register::RDI /* for alignment */,
Register::RSI, Register::RDX, Register::RCX,
Register::R8, Register::R9, Register::R10, Register::R11,
Register::RSI, Register::RDX,
Register::RCX, Register::R8,
Register::R9, Register::R10,
Register::R11,
};
for (size_t i = 0; i < ArrayLength(registers); i++) {
aAssembler.MoveRegisterToRax(registers[i]);
aAssembler.PushRax();
}
aAssembler.MoveImmediateToRax((void*)aCallId);
uint8_t* after = aAssembler.Current() + Assembler::PushImmediateBytes + Assembler::JumpBytes;
uint8_t* after = aAssembler.Current() + Assembler::PushImmediateBytes +
Assembler::JumpBytes;
aAssembler.PushImmediate(after);
aAssembler.Jump(BitwiseCast<void*>(RecordReplayRedirectCall));
for (int i = ArrayLength(registers) - 1; i >= 0; i--) {

View File

@ -248,7 +248,7 @@ static void EX_ObjCInput(ExternalCallContext& aCx, id* aThingPtr) {
MOZ_RELEASE_ASSERT(cstring.get()[len - 1] == 0);
void* ptr = dlsym(RTLD_DEFAULT, cstring.get() + strlen(cloudPrefix));
MOZ_RELEASE_ASSERT(ptr);
*aThingPtr = (id)*(CFStringRef*)ptr;
*aThingPtr = (id) * (CFStringRef*)ptr;
break;
}
@ -303,7 +303,7 @@ static void EX_CFTypeOutputArg(ExternalCallContext& aCx) {
auto& arg = aCx.mArguments->Arg<Argument, const void**>();
if (aCx.mPhase == ExternalCallPhase::RestoreInput) {
arg = (const void**) aCx.AllocateBytes(sizeof(const void*));
arg = (const void**)aCx.AllocateBytes(sizeof(const void*));
}
EX_CFTypeOutput(aCx, arg, /* aOwnsReference = */ false);
@ -324,9 +324,8 @@ static void EX_AutoreleaseCFTypeRval(ExternalCallContext& aCx) {
if (rval && aCx.mPhase == ExternalCallPhase::SaveOutput && !IsReplaying()) {
SendMessageToObject(rval, "retain");
aCx.mReleaseCallbacks->append([=]() {
SendMessageToObject(rval, "autorelease");
});
aCx.mReleaseCallbacks->append(
[=]() { SendMessageToObject(rval, "autorelease"); });
}
}
@ -349,27 +348,28 @@ static PreambleResult Preamble_SetError(CallArguments* aArguments) {
}
#define ForEachFixedInputAddress(Macro) \
Macro(kCFTypeArrayCallBacks) \
Macro(kCFTypeDictionaryKeyCallBacks) \
Macro(kCFTypeArrayCallBacks) Macro(kCFTypeDictionaryKeyCallBacks) \
Macro(kCFTypeDictionaryValueCallBacks)
#define ForEachFixedInput(Macro) \
Macro(kCFAllocatorDefault) \
Macro(kCFAllocatorNull)
Macro(kCFAllocatorDefault) Macro(kCFAllocatorNull)
enum class FixedInput {
#define DefineEnum(Name) Name,
ForEachFixedInputAddress(DefineEnum)
ForEachFixedInput(DefineEnum)
ForEachFixedInputAddress(DefineEnum) ForEachFixedInput(DefineEnum)
#undef DefineEnum
};
static const void* GetFixedInput(FixedInput aWhich) {
switch (aWhich) {
#define FetchEnumAddress(Name) case FixedInput::Name: return &Name;
#define FetchEnumAddress(Name) \
case FixedInput::Name: \
return &Name;
ForEachFixedInputAddress(FetchEnumAddress)
#undef FetchEnumAddress
#define FetchEnum(Name) case FixedInput::Name: return Name;
#define FetchEnum(Name) \
case FixedInput::Name: \
return Name;
ForEachFixedInput(FetchEnum)
#undef FetchEnum
}
@ -384,9 +384,9 @@ static void EX_RequireFixed(ExternalCallContext& aCx) {
if (aCx.AccessInput()) {
const void* value = GetFixedInput(Which);
if (aCx.mPhase == ExternalCallPhase::SaveInput) {
MOZ_RELEASE_ASSERT(arg == value ||
(Which == FixedInput::kCFAllocatorDefault &&
arg == nullptr));
MOZ_RELEASE_ASSERT(
arg == value ||
(Which == FixedInput::kCFAllocatorDefault && arg == nullptr));
} else {
arg = value;
}
@ -552,9 +552,8 @@ static PreambleResult Preamble_mmap(CallArguments* aArguments) {
size_t hash = RecordReplayValue(0);
int fd = DirectOpenFile(path.get(), /* aWriting */ false);
void* fileContents = CallFunction<void*>(gOriginal_mmap, nullptr, size,
PROT_READ, MAP_PRIVATE,
fd, offset);
void* fileContents = CallFunction<void*>(
gOriginal_mmap, nullptr, size, PROT_READ, MAP_PRIVATE, fd, offset);
MOZ_RELEASE_ASSERT(fileContents != MAP_FAILED);
memcpy(memory, fileContents, size);
@ -730,8 +729,7 @@ static ssize_t WaitForCvar(pthread_mutex_t* aMutex, pthread_cond_t* aCond,
if (!lock) {
if (IsReplaying() && !AreThreadEventsPassedThrough()) {
Thread* thread = Thread::Current();
if (thread->MaybeWaitForFork(
[=]() { pthread_mutex_unlock(aMutex); })) {
if (thread->MaybeWaitForFork([=]() { pthread_mutex_unlock(aMutex); })) {
// We unlocked the mutex while the thread idled, so don't wait on the
// condvar: the state the thread is waiting on may have changed and it
// might not want to continue waiting. Returning immediately means this
@ -978,22 +976,21 @@ static PreambleResult Preamble_pthread_self(CallArguments* aArguments) {
return PreambleResult::PassThrough;
}
static void*
GetTLVTemplate(void* aPtr, size_t* aSize) {
static void* GetTLVTemplate(void* aPtr, size_t* aSize) {
uint8_t* tlvTemplate = nullptr;
*aSize = 0;
Dl_info info;
dladdr(aPtr, &info);
mach_header_64* header = (mach_header_64*) info.dli_fbase;
mach_header_64* header = (mach_header_64*)info.dli_fbase;
MOZ_RELEASE_ASSERT(header->magic == MH_MAGIC_64);
uint32_t offset = sizeof(mach_header_64);
for (size_t i = 0; i < header->ncmds; i++) {
load_command* cmd = (load_command*) ((uint8_t*)header + offset);
load_command* cmd = (load_command*)((uint8_t*)header + offset);
if (LC_SEGMENT_64 == (cmd->cmd & ~LC_REQ_DYLD)) {
segment_command_64* ncmd = (segment_command_64*) cmd;
section_64* sect = (section_64*) (ncmd + 1);
segment_command_64* ncmd = (segment_command_64*)cmd;
section_64* sect = (section_64*)(ncmd + 1);
for (size_t i = 0; i < ncmd->nsects; i++, sect++) {
switch (sect->flags & SECTION_TYPE) {
case S_THREAD_LOCAL_REGULAR:
@ -1314,7 +1311,7 @@ static void EX_PerformSelector(ExternalCallContext& aCx) {
}
if (aCx.mPhase == ExternalCallPhase::RestoreInput) {
selector = (const char*) sel_registerName(selector);
selector = (const char*)sel_registerName(selector);
}
EX_AutoreleaseCFTypeRval(aCx);
@ -1420,8 +1417,8 @@ static ObjCMessageInfo gObjCExternalCallMessages[] = {
// NSBezierPath
{"addClip", EX_NoOp, true},
{"bezierPathWithRoundedRect:xRadius:yRadius:",
EX_Compose<EX_StackArgumentData<sizeof(CGRect)>,
EX_FloatArg<0>, EX_FloatArg<1>, EX_AutoreleaseCFTypeRval>},
EX_Compose<EX_StackArgumentData<sizeof(CGRect)>, EX_FloatArg<0>,
EX_FloatArg<1>, EX_AutoreleaseCFTypeRval>},
// NSCell
{"drawFocusRingMaskWithFrame:inView:",
@ -1483,12 +1480,10 @@ static ObjCMessageInfo gObjCExternalCallMessages[] = {
EX_Compose<EX_FloatArg<0>, EX_AutoreleaseCFTypeRval>},
{"pointSize"},
{"smallSystemFontSize"},
{"systemFontOfSize:",
EX_Compose<EX_FloatArg<0>, EX_AutoreleaseCFTypeRval>},
{"systemFontOfSize:", EX_Compose<EX_FloatArg<0>, EX_AutoreleaseCFTypeRval>},
{"toolTipsFontOfSize:",
EX_Compose<EX_FloatArg<0>, EX_AutoreleaseCFTypeRval>},
{"userFontOfSize:",
EX_Compose<EX_FloatArg<0>, EX_AutoreleaseCFTypeRval>},
{"userFontOfSize:", EX_Compose<EX_FloatArg<0>, EX_AutoreleaseCFTypeRval>},
// NSFontManager
{"availableMembersOfFontFamily:",
@ -1529,7 +1524,7 @@ static void EX_objc_msgSend(ExternalCallContext& aCx) {
auto& message = aCx.mArguments->Arg<1, const char*>();
if (aCx.mPhase == ExternalCallPhase::RestoreInput) {
message = (const char*) sel_registerName(message);
message = (const char*)sel_registerName(message);
}
for (const ObjCMessageInfo& info : gObjCExternalCallMessages) {
@ -2177,8 +2172,8 @@ static SystemRedirection gSystemRedirections[] = {
Preamble_SetError<EACCES>},
{"lseek", RR_SaveRvalHadErrorNegative},
{"select$DARWIN_EXTSN",
RR_SaveRvalHadErrorNegative<RR_Compose<RR_OutParam<1, fd_set>,
RR_OutParam<2, fd_set>,
RR_SaveRvalHadErrorNegative<
RR_Compose<RR_OutParam<1, fd_set>, RR_OutParam<2, fd_set>,
RR_OutParam<3, fd_set>>>,
nullptr, nullptr, Preamble_WaitForever},
{"socketpair",
@ -2186,8 +2181,7 @@ static SystemRedirection gSystemRedirections[] = {
{"fileport_makeport", RR_SaveRvalHadErrorNegative<RR_OutParam<1, size_t>>},
{"getsockopt", RR_SaveRvalHadErrorNegative<RR_getsockopt>},
{"gettimeofday",
RR_SaveRvalHadErrorNegative<RR_Compose<
RR_OutParam<0, struct timeval>,
RR_SaveRvalHadErrorNegative<RR_Compose<RR_OutParam<0, struct timeval>,
RR_OutParam<1, struct timezone>>>,
nullptr, nullptr, Preamble_PassThrough},
{"getuid", RR_ScalarRval},
@ -2207,22 +2201,20 @@ static SystemRedirection gSystemRedirections[] = {
{"stat$INODE64", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct stat>>,
nullptr, nullptr, Preamble_SetError},
{"statfs$INODE64",
RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct statfs>>,
nullptr, nullptr, Preamble_SetError},
RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct statfs>>, nullptr,
nullptr, Preamble_SetError},
{"fstatfs$INODE64",
RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct statfs>>,
nullptr, nullptr, Preamble_SetError},
RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct statfs>>, nullptr,
nullptr, Preamble_SetError},
{"readlink", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<1, 2>>},
{"__getdirentries64",
RR_SaveRvalHadErrorNegative<RR_Compose<
RR_WriteBuffer<1, 2>, RR_OutParam<3, size_t>>>},
RR_SaveRvalHadErrorNegative<
RR_Compose<RR_WriteBuffer<1, 2>, RR_OutParam<3, size_t>>>},
{"getdirentriesattr",
RR_SaveRvalHadErrorNegative<RR_Compose<
RR_WriteBufferFixedSize<1, sizeof(struct attrlist)>,
RR_WriteBuffer<2, 3>,
RR_OutParam<4, size_t>,
RR_OutParam<5, size_t>,
RR_OutParam<6, size_t>>>},
RR_SaveRvalHadErrorNegative<
RR_Compose<RR_WriteBufferFixedSize<1, sizeof(struct attrlist)>,
RR_WriteBuffer<2, 3>, RR_OutParam<4, size_t>,
RR_OutParam<5, size_t>, RR_OutParam<6, size_t>>>},
{"getrusage", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct rusage>>,
nullptr, nullptr, Preamble_SetError},
{"getrlimit", RR_SaveRvalHadErrorNegative<RR_OutParam<1, struct rlimit>>},
@ -2248,15 +2240,12 @@ static SystemRedirection gSystemRedirections[] = {
{"umask", RR_ScalarRval},
{"__select",
RR_SaveRvalHadErrorNegative<
RR_Compose<RR_OutParam<1, fd_set>,
RR_OutParam<2, fd_set>,
RR_OutParam<3, fd_set>,
RR_OutParam<4, timeval>>>,
RR_Compose<RR_OutParam<1, fd_set>, RR_OutParam<2, fd_set>,
RR_OutParam<3, fd_set>, RR_OutParam<4, timeval>>>,
nullptr, nullptr, Preamble_WaitForever},
{"__process_policy", RR_SaveRvalHadErrorNegative},
{"__kdebug_trace", RR_SaveRvalHadErrorNegative},
{"guarded_kqueue_np",
RR_SaveRvalHadErrorNegative<RR_OutParam<0, size_t>>},
{"guarded_kqueue_np", RR_SaveRvalHadErrorNegative<RR_OutParam<0, size_t>>},
{"csops", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<2, 3>>},
{"__getlogin", RR_SaveRvalHadErrorNegative<RR_WriteBuffer<0, 1>>},
{"__workq_kernreturn", nullptr, Preamble___workq_kernreturn},
@ -2303,17 +2292,16 @@ static SystemRedirection gSystemRedirections[] = {
{"fwrite", RR_ScalarRval},
{"getenv", RR_CStringRval, Preamble_getenv, nullptr, Preamble_Veto<0>},
{"localtime_r",
RR_SaveRvalHadErrorZero<RR_Compose<RR_OutParam<1, struct tm>,
RR_RvalIsArgument<1>>>,
RR_SaveRvalHadErrorZero<
RR_Compose<RR_OutParam<1, struct tm>, RR_RvalIsArgument<1>>>,
nullptr, nullptr, Preamble_PassThrough},
{"gmtime_r",
RR_SaveRvalHadErrorZero<RR_Compose<RR_OutParam<1, struct tm>,
RR_RvalIsArgument<1>>>,
RR_SaveRvalHadErrorZero<
RR_Compose<RR_OutParam<1, struct tm>, RR_RvalIsArgument<1>>>,
nullptr, nullptr, Preamble_PassThrough},
{"localtime", nullptr, Preamble_localtime, nullptr, Preamble_PassThrough},
{"gmtime", nullptr, Preamble_gmtime, nullptr, Preamble_PassThrough},
{"mktime",
RR_Compose<RR_ScalarRval, RR_OutParam<0, struct tm>>},
{"mktime", RR_Compose<RR_ScalarRval, RR_OutParam<0, struct tm>>},
{"setlocale", RR_CStringRval},
{"strftime", RR_Compose<RR_ScalarRval, RR_WriteBufferViaRval<0, 1, 1>>},
{"arc4random", RR_ScalarRval, nullptr, nullptr, Preamble_PassThrough},
@ -2357,10 +2345,10 @@ static SystemRedirection gSystemRedirections[] = {
RR_Compose<RR_ScalarRval, RR_OutParam<2, mach_port_t>>},
{"task_set_special_port", RR_ScalarRval},
{"task_swap_exception_ports", RR_ScalarRval}, // Ignore out parameters
{"time", RR_Compose<RR_ScalarRval, RR_OutParam<0, time_t>>,
nullptr, nullptr, Preamble_PassThrough},
{"uname", RR_SaveRvalHadErrorNegative<RR_OutParam<0, utsname>>,
nullptr, nullptr, Preamble_SetError},
{"time", RR_Compose<RR_ScalarRval, RR_OutParam<0, time_t>>, nullptr,
nullptr, Preamble_PassThrough},
{"uname", RR_SaveRvalHadErrorNegative<RR_OutParam<0, utsname>>, nullptr,
nullptr, Preamble_SetError},
{"vm_allocate", nullptr, Preamble_VetoIfNotPassedThrough<KERN_FAILURE>},
{"vm_copy", nullptr, Preamble_PassThrough},
{"tzset"},
@ -2408,8 +2396,8 @@ static SystemRedirection gSystemRedirections[] = {
EX_CFArrayGetValueAtIndex},
{"CFArrayRemoveValueAtIndex"},
{"CFAttributedStringCreate", RR_ScalarRval, nullptr,
EX_Compose<EX_RequireDefaultAllocator<0>,
EX_CFTypeArg<1>, EX_CFTypeArg<2>, EX_CreateCFTypeRval>},
EX_Compose<EX_RequireDefaultAllocator<0>, EX_CFTypeArg<1>, EX_CFTypeArg<2>,
EX_CreateCFTypeRval>},
{"CFBundleCopyExecutableURL", RR_ScalarRval},
{"CFBundleCopyInfoDictionaryForURL", RR_ScalarRval},
{"CFBundleCreate", RR_ScalarRval},
@ -2432,16 +2420,13 @@ static SystemRedirection gSystemRedirections[] = {
EX_Compose<EX_UpdateCFTypeArg<0>, EX_CFTypeArg<1>, EX_CFTypeArg<2>>},
{"CFDictionaryCreate", RR_ScalarRval, nullptr, EX_CFDictionaryCreate},
{"CFDictionaryCreateMutable", RR_ScalarRval, nullptr,
EX_Compose<EX_RequireDefaultAllocator<0>,
EX_ScalarArg<1>,
EX_RequireFixed<2,
FixedInput::kCFTypeDictionaryKeyCallBacks>,
EX_RequireFixed<3,
FixedInput::kCFTypeDictionaryValueCallBacks>,
EX_Compose<EX_RequireDefaultAllocator<0>, EX_ScalarArg<1>,
EX_RequireFixed<2, FixedInput::kCFTypeDictionaryKeyCallBacks>,
EX_RequireFixed<3, FixedInput::kCFTypeDictionaryValueCallBacks>,
EX_CreateCFTypeRval>},
{"CFDictionaryCreateMutableCopy", RR_ScalarRval, nullptr,
EX_Compose<EX_RequireDefaultAllocator<0>,
EX_ScalarArg<1>, EX_CFTypeArg<2>, EX_CreateCFTypeRval>},
EX_Compose<EX_RequireDefaultAllocator<0>, EX_ScalarArg<1>, EX_CFTypeArg<2>,
EX_CreateCFTypeRval>},
{"CFDictionaryGetTypeID", RR_ScalarRval, nullptr, EX_NoOp},
{"CFDictionaryGetValue", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>, EX_CFTypeRval>},
@ -2500,13 +2485,11 @@ static SystemRedirection gSystemRedirections[] = {
{"CFStringCreateArrayBySeparatingStrings", RR_ScalarRval},
{"CFStringCreateMutable", RR_ScalarRval},
{"CFStringCreateWithBytes", RR_ScalarRval, nullptr,
EX_Compose<EX_RequireDefaultAllocator<0>,
EX_Buffer<1, 2>, EX_ScalarArg<3>, EX_ScalarArg<4>,
EX_CreateCFTypeRval>},
EX_Compose<EX_RequireDefaultAllocator<0>, EX_Buffer<1, 2>, EX_ScalarArg<3>,
EX_ScalarArg<4>, EX_CreateCFTypeRval>},
{"CFStringCreateWithBytesNoCopy", RR_ScalarRval},
{"CFStringCreateWithCharactersNoCopy", RR_ScalarRval, nullptr,
EX_Compose<EX_RequireDefaultAllocator<0>,
EX_Buffer<1, 2, UniChar>,
EX_Compose<EX_RequireDefaultAllocator<0>, EX_Buffer<1, 2, UniChar>,
EX_RequireFixed<3, FixedInput::kCFAllocatorNull>,
EX_CreateCFTypeRval>},
{"CFStringCreateWithCString", RR_ScalarRval},
@ -2522,8 +2505,7 @@ static SystemRedirection gSystemRedirections[] = {
// We also need to specify the argument register with the range's length
// here.
RR_WriteBuffer<3, 2, UniChar>, nullptr,
EX_Compose<EX_CFTypeArg<0>,
EX_ScalarArg<1>,
EX_Compose<EX_CFTypeArg<0>, EX_ScalarArg<1>,
EX_WriteBuffer<3, 2, UniChar>>},
{"CFStringGetCString", RR_Compose<RR_ScalarRval, RR_WriteBuffer<1, 2>>},
{"CFStringGetCStringPtr", nullptr, Preamble_VetoIfNotPassedThrough<0>},
@ -2546,18 +2528,17 @@ static SystemRedirection gSystemRedirections[] = {
EX_Compose<EX_RequireDefaultAllocator<0>, EX_CreateCFTypeRval>},
{"CFUUIDCreateString", RR_ScalarRval},
{"CFUUIDGetUUIDBytes", RR_ComplexScalarRval, nullptr, EX_CFTypeArg<0>},
{"CGAffineTransformConcat",
RR_OversizeRval<sizeof(CGAffineTransform)>, nullptr,
{"CGAffineTransformConcat", RR_OversizeRval<sizeof(CGAffineTransform)>,
nullptr,
EX_Compose<EX_StackArgumentData<2 * sizeof(CGAffineTransform)>,
EX_OversizeRval<CGAffineTransform>>},
{"CGAffineTransformInvert",
RR_OversizeRval<sizeof(CGAffineTransform)>, nullptr,
{"CGAffineTransformInvert", RR_OversizeRval<sizeof(CGAffineTransform)>,
nullptr,
EX_Compose<EX_StackArgumentData<sizeof(CGAffineTransform)>,
EX_OversizeRval<CGAffineTransform>>},
{"CGAffineTransformMakeScale",
RR_OversizeRval<sizeof(CGAffineTransform)>, nullptr,
EX_Compose<EX_FloatArg<0>,
EX_FloatArg<1>,
{"CGAffineTransformMakeScale", RR_OversizeRval<sizeof(CGAffineTransform)>,
nullptr,
EX_Compose<EX_FloatArg<0>, EX_FloatArg<1>,
EX_OversizeRval<CGAffineTransform>>},
{"CGBitmapContextCreateImage", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CreateCFTypeRval>},
@ -2595,8 +2576,7 @@ static SystemRedirection gSystemRedirections[] = {
EX_CFTypeArg<1>, EX_FlushCGContext<0>>},
{"CGContextDrawLinearGradient", RR_FlushCGContext<0>, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>,
EX_StackArgumentData<2 * sizeof(CGPoint)>,
EX_ScalarArg<2>,
EX_StackArgumentData<2 * sizeof(CGPoint)>, EX_ScalarArg<2>,
EX_FlushCGContext<0>>},
{"CGContextEndTransparencyLayer", nullptr, nullptr, EX_UpdateCFTypeArg<0>},
{"CGContextFillPath", RR_FlushCGContext<0>, nullptr,
@ -2630,13 +2610,11 @@ static SystemRedirection gSystemRedirections[] = {
{"CGContextSetGrayFillColor", nullptr, nullptr,
EX_Compose<EX_FloatArg<0>, EX_FloatArg<1>, EX_UpdateCFTypeArg<0>>},
{"CGContextSetRGBFillColor", nullptr, nullptr,
EX_Compose<EX_UpdateCFTypeArg<0>,
EX_FloatArg<0>, EX_FloatArg<1>, EX_FloatArg<2>,
EX_StackArgumentData<sizeof(CGFloat)>>},
EX_Compose<EX_UpdateCFTypeArg<0>, EX_FloatArg<0>, EX_FloatArg<1>,
EX_FloatArg<2>, EX_StackArgumentData<sizeof(CGFloat)>>},
{"CGContextSetRGBStrokeColor", nullptr, nullptr,
EX_Compose<EX_UpdateCFTypeArg<0>,
EX_FloatArg<0>, EX_FloatArg<1>, EX_FloatArg<2>,
EX_StackArgumentData<sizeof(CGFloat)>>},
EX_Compose<EX_UpdateCFTypeArg<0>, EX_FloatArg<0>, EX_FloatArg<1>,
EX_FloatArg<2>, EX_StackArgumentData<sizeof(CGFloat)>>},
{"CGContextSetShouldAntialias", nullptr, nullptr,
EX_Compose<EX_UpdateCFTypeArg<0>, EX_ScalarArg<1>>},
{"CGContextSetShouldSmoothFonts", nullptr, nullptr,
@ -2706,16 +2684,15 @@ static SystemRedirection gSystemRedirections[] = {
{"CGPathContainsPoint", RR_ScalarRval},
{"CGPathCreateMutable", RR_ScalarRval},
{"CGPathCreateWithRoundedRect", RR_ScalarRval, nullptr,
EX_Compose<EX_StackArgumentData<sizeof(CGRect)>,
EX_FloatArg<0>, EX_FloatArg<1>,
EX_InParam<0, CGAffineTransform>,
EX_Compose<EX_StackArgumentData<sizeof(CGRect)>, EX_FloatArg<0>,
EX_FloatArg<1>, EX_InParam<0, CGAffineTransform>,
EX_CreateCFTypeRval>},
{"CGPathGetBoundingBox", RR_OversizeRval<sizeof(CGRect)>},
{"CGPathGetCurrentPoint", RR_ComplexFloatRval},
{"CGPathIsEmpty", RR_ScalarRval},
{"CGRectApplyAffineTransform", RR_OversizeRval<sizeof(CGRect)>, nullptr,
EX_Compose<EX_StackArgumentData<sizeof(CGRect) +
sizeof(CGAffineTransform)>,
EX_Compose<
EX_StackArgumentData<sizeof(CGRect) + sizeof(CGAffineTransform)>,
EX_OversizeRval<CGRect>>},
{"CGSSetDebugOptions", RR_ScalarRval},
{"CGSShutdownServerConnections"},
@ -2733,29 +2710,21 @@ static SystemRedirection gSystemRedirections[] = {
{"CTFontCopyVariationAxes", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CreateCFTypeRval>},
{"CTFontCreateForString", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>,
EX_ScalarArg<2>, EX_ScalarArg<3>, EX_CreateCFTypeRval>},
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>, EX_ScalarArg<2>,
EX_ScalarArg<3>, EX_CreateCFTypeRval>},
{"CTFontCreatePathForGlyph", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>,
EX_ScalarArg<1>,
EX_InParam<2, CGAffineTransform>,
EX_CreateCFTypeRval>},
EX_Compose<EX_CFTypeArg<0>, EX_ScalarArg<1>,
EX_InParam<2, CGAffineTransform>, EX_CreateCFTypeRval>},
{"CTFontCreateWithFontDescriptor", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>,
EX_FloatArg<0>,
EX_InParam<1, CGAffineTransform>,
EX_CreateCFTypeRval>},
EX_Compose<EX_CFTypeArg<0>, EX_FloatArg<0>,
EX_InParam<1, CGAffineTransform>, EX_CreateCFTypeRval>},
{"CTFontCreateWithGraphicsFont", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>,
EX_FloatArg<0>,
EX_InParam<1, CGAffineTransform>,
EX_CFTypeArg<2>,
EX_Compose<EX_CFTypeArg<0>, EX_FloatArg<0>,
EX_InParam<1, CGAffineTransform>, EX_CFTypeArg<2>,
EX_CreateCFTypeRval>},
{"CTFontCreateWithName", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>,
EX_FloatArg<0>,
EX_InParam<1, CGAffineTransform>,
EX_CreateCFTypeRval>},
EX_Compose<EX_CFTypeArg<0>, EX_FloatArg<0>,
EX_InParam<1, CGAffineTransform>, EX_CreateCFTypeRval>},
{"CTFontDescriptorCopyAttribute", RR_ScalarRval, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>, EX_CreateCFTypeRval>},
{"CTFontDescriptorCreateCopyWithAttributes", RR_ScalarRval, nullptr,
@ -2769,8 +2738,7 @@ static SystemRedirection gSystemRedirections[] = {
EX_Buffer<2, 3, CGPoint>, EX_FlushCGContext<4>>},
{"CTFontGetAdvancesForGlyphs",
RR_Compose<RR_FloatRval, RR_WriteOptionalBuffer<3, 4, CGSize>>, nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_ScalarArg<1>,
EX_Buffer<2, 4, CGGlyph>,
EX_Compose<EX_CFTypeArg<0>, EX_ScalarArg<1>, EX_Buffer<2, 4, CGGlyph>,
EX_WriteBuffer<3, 4, CGSize>>},
{"CTFontGetAscent", RR_FloatRval, nullptr, EX_CFTypeArg<0>},
{"CTFontGetBoundingBox", RR_OversizeRval<sizeof(CGRect)>, nullptr,
@ -2780,8 +2748,7 @@ static SystemRedirection gSystemRedirections[] = {
RR_Compose<RR_OversizeRval<sizeof(CGRect)>,
RR_WriteOptionalBuffer<4, 5, CGRect>>,
nullptr,
EX_Compose<EX_CFTypeArg<1>, EX_ScalarArg<2>,
EX_Buffer<3, 5, CGGlyph>,
EX_Compose<EX_CFTypeArg<1>, EX_ScalarArg<2>, EX_Buffer<3, 5, CGGlyph>,
EX_OversizeRval<CGRect>, EX_WriteBuffer<4, 5, CGRect>>},
{"CTFontGetCapHeight", RR_FloatRval, nullptr, EX_CFTypeArg<0>},
{"CTFontGetDescent", RR_FloatRval, nullptr, EX_CFTypeArg<0>},
@ -2818,9 +2785,7 @@ static SystemRedirection gSystemRedirections[] = {
{"CTRunGetTypographicBounds",
// Argument indexes are off by one here as the CFRange argument uses two
// slots.
RR_Compose<RR_FloatRval,
RR_OutParam<3, CGFloat>,
RR_OutParam<4, CGFloat>,
RR_Compose<RR_FloatRval, RR_OutParam<3, CGFloat>, RR_OutParam<4, CGFloat>,
RR_OutParam<5, CGFloat>>,
nullptr,
EX_Compose<EX_CFTypeArg<0>, EX_ScalarArg<1>, EX_ScalarArg<2>,
@ -2830,9 +2795,7 @@ static SystemRedirection gSystemRedirections[] = {
EX_Compose<EX_CFTypeArg<0>, EX_CFTypeArg<1>, EX_CFTypeArg<2>,
EX_StackArgumentData<sizeof(CGRect)>>},
{"FSCompareFSRefs", RR_ScalarRval},
{"FSGetVolumeInfo",
RR_Compose<RR_ScalarRval,
RR_OutParam<5, HFSUniStr255>,
{"FSGetVolumeInfo", RR_Compose<RR_ScalarRval, RR_OutParam<5, HFSUniStr255>,
RR_OutParam<6, FSRef>>},
{"FSFindFolder", RR_Compose<RR_ScalarRval, RR_OutParam<3, FSRef>>},
{"Gestalt", RR_Compose<RR_ScalarRval, RR_OutParam<1, SInt32>>},
@ -2847,65 +2810,42 @@ static SystemRedirection gSystemRedirections[] = {
nullptr, EX_Compose<EX_ScalarArg<0>, EX_OutParam<1, SInt32>>},
{"HIThemeDrawButton", RR_Compose<RR_OutParam<4, HIRect>, RR_ScalarRval>,
nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeButtonDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>,
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIThemeButtonDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>,
EX_OutParam<4, HIRect>>},
{"HIThemeDrawFrame", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeFrameDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIThemeFrameDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeDrawGroupBox", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeGroupBoxDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIThemeGroupBoxDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeDrawGrowBox", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIPoint>,
EX_InParam<1, HIThemeGrowBoxDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIPoint>, EX_InParam<1, HIThemeGrowBoxDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeDrawMenuBackground", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeMenuDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIThemeMenuDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeDrawMenuItem", RR_Compose<RR_OutParam<5, HIRect>, RR_ScalarRval>,
nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIRect>,
EX_InParam<2, HIThemeMenuItemDrawInfo>,
EX_UpdateCFTypeArg<3>,
EX_ScalarArg<4>,
EX_OutParam<5, HIRect>>},
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIRect>,
EX_InParam<2, HIThemeMenuItemDrawInfo>, EX_UpdateCFTypeArg<3>,
EX_ScalarArg<4>, EX_OutParam<5, HIRect>>},
{"HIThemeDrawMenuSeparator", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIRect>,
EX_InParam<2, HIThemeMenuItemDrawInfo>,
EX_UpdateCFTypeArg<3>,
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIRect>,
EX_InParam<2, HIThemeMenuItemDrawInfo>, EX_UpdateCFTypeArg<3>,
EX_ScalarArg<4>>},
{"HIThemeDrawSeparator", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeSeparatorDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIThemeSeparatorDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeDrawTabPane", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIRect>,
EX_InParam<1, HIThemeTabPaneDrawInfo>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIRect>, EX_InParam<1, HIThemeTabPaneDrawInfo>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeDrawTrack", RR_ScalarRval, nullptr,
EX_Compose<EX_InParam<0, HIThemeTrackDrawInfo>,
EX_InParam<1, HIRect>,
EX_UpdateCFTypeArg<2>,
EX_ScalarArg<3>>},
EX_Compose<EX_InParam<0, HIThemeTrackDrawInfo>, EX_InParam<1, HIRect>,
EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
{"HIThemeGetGrowBoxBounds",
RR_Compose<RR_ScalarRval, RR_OutParam<2, HIRect>>,
nullptr,
EX_Compose<EX_InParam<0, HIPoint>,
EX_InParam<1, HIThemeGrowBoxDrawInfo>,
RR_Compose<RR_ScalarRval, RR_OutParam<2, HIRect>>, nullptr,
EX_Compose<EX_InParam<0, HIPoint>, EX_InParam<1, HIThemeGrowBoxDrawInfo>,
EX_OutParam<2, HIRect>>},
{"HIThemeSetFill", RR_ScalarRval, nullptr,
EX_Compose<EX_ScalarArg<0>, EX_UpdateCFTypeArg<2>, EX_ScalarArg<3>>},
@ -2917,13 +2857,9 @@ static SystemRedirection gSystemRedirections[] = {
RR_Compose<RR_ScalarRval, RR_OutParam<3, CFTypeRef>>},
{"LSCopyKindStringForMIMEType",
RR_Compose<RR_ScalarRval, RR_OutParam<1, CFStringRef>>},
{"LSGetApplicationForInfo",
RR_Compose<RR_ScalarRval,
RR_OutParam<4, FSRef>,
{"LSGetApplicationForInfo", RR_Compose<RR_ScalarRval, RR_OutParam<4, FSRef>,
RR_OutParam<5, CFURLRef>>},
{"LSGetApplicationForURL",
RR_Compose<RR_ScalarRval,
RR_OutParam<2, FSRef>,
{"LSGetApplicationForURL", RR_Compose<RR_ScalarRval, RR_OutParam<2, FSRef>,
RR_OutParam<3, CFURLRef>>},
{"LSCopyDefaultApplicationURLForURL",
RR_Compose<RR_ScalarRval, RR_OutParam<2, CFErrorRef>>},
@ -2971,9 +2907,7 @@ static SystemRedirection gSystemRedirections[] = {
// Redirection Generation
///////////////////////////////////////////////////////////////////////////////
size_t NumRedirections() {
return ArrayLength(gSystemRedirections);
}
size_t NumRedirections() { return ArrayLength(gSystemRedirections); }
static Redirection* gRedirections;
@ -3036,9 +2970,8 @@ void InitializeRedirections() {
redirection.mOriginalFunction = FunctionStartAddress(redirection);
if (IsRecordingOrReplaying()) {
redirection.mRedirectedFunction =
GenerateRedirectStub(assembler.ref(), i,
PreserveCallerSaveRegisters(redirection.mName));
redirection.mRedirectedFunction = GenerateRedirectStub(
assembler.ref(), i, PreserveCallerSaveRegisters(redirection.mName));
gRedirectionAddresses->insert(RedirectionAddressMap::value_type(
std::string(redirection.mName), redirection.mRedirectedFunction));
}
@ -3085,8 +3018,7 @@ static void ApplyBinding(const char* aName, void** aPtr) {
void* binding = FindRedirectionBinding(aName);
if (binding) {
if (!strcmp(aName, "_tlv_bootstrap")) {
MOZ_RELEASE_ASSERT(gTLVGetAddress == nullptr ||
gTLVGetAddress == *aPtr);
MOZ_RELEASE_ASSERT(gTLVGetAddress == nullptr || gTLVGetAddress == *aPtr);
gTLVGetAddress = *aPtr;
}
*aPtr = binding;
@ -3131,8 +3063,8 @@ struct MachOLibrary {
MOZ_RELEASE_ASSERT(rv >= 0);
mFileSize = info.st_size;
mFileAddress = (uint8_t*)mmap(nullptr, mFileSize, PROT_READ,
MAP_PRIVATE, mFile, 0);
mFileAddress =
(uint8_t*)mmap(nullptr, mFileSize, PROT_READ, MAP_PRIVATE, mFile, 0);
MOZ_RELEASE_ASSERT(mFileAddress != MAP_FAILED);
mach_header_64* header = (mach_header_64*)mFileAddress;
@ -3175,21 +3107,21 @@ struct MachOLibrary {
mach_header_64* header = (mach_header_64*)mFileAddress;
uint32_t offset = sizeof(mach_header_64);
for (size_t i = 0; i < header->ncmds; i++) {
load_command* cmd = (load_command*) (mFileAddress + offset);
load_command* cmd = (load_command*)(mFileAddress + offset);
aCallback(cmd);
offset += cmd->cmdsize;
}
}
void AddSymbolTable(symtab_command* aCmd) {
mSymbolTable = (nlist_64*) (mFileAddress + aCmd->symoff);
mSymbolTable = (nlist_64*)(mFileAddress + aCmd->symoff);
mSymbolCount = aCmd->nsyms;
mStringTable = (char*) (mFileAddress + aCmd->stroff);
mStringTable = (char*)(mFileAddress + aCmd->stroff);
}
void AddDynamicSymbolTable(dysymtab_command* aCmd) {
mIndirectSymbols = (uint32_t*) (mFileAddress + aCmd->indirectsymoff);
mIndirectSymbols = (uint32_t*)(mFileAddress + aCmd->indirectsymoff);
mIndirectSymbolCount = aCmd->nindirectsyms;
}
@ -3237,29 +3169,29 @@ struct MachOLibrary {
case BIND_OPCODE_SET_ADDEND_SLEB:
break;
case BIND_OPCODE_DO_BIND:
DoBinding(segmentIndex, segmentOffset,
symbolName, symbolFlags, symbolType);
DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags,
symbolType);
segmentOffset += sizeof(uintptr_t);
break;
case BIND_OPCODE_ADD_ADDR_ULEB:
segmentOffset += ReadLEB128(cursor, end);
break;
case BIND_OPCODE_DO_BIND_ADD_ADDR_ULEB:
DoBinding(segmentIndex, segmentOffset,
symbolName, symbolFlags, symbolType);
DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags,
symbolType);
segmentOffset += ReadLEB128(cursor, end) + sizeof(uintptr_t);
break;
case BIND_OPCODE_DO_BIND_ADD_ADDR_IMM_SCALED:
DoBinding(segmentIndex, segmentOffset,
symbolName, symbolFlags, symbolType);
DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags,
symbolType);
segmentOffset += immediate * sizeof(uintptr_t) + sizeof(uintptr_t);
break;
case BIND_OPCODE_DO_BIND_ULEB_TIMES_SKIPPING_ULEB: {
size_t count = ReadLEB128(cursor, end);
size_t skip = ReadLEB128(cursor, end);
for (size_t i = 0; i < count; i++) {
DoBinding(segmentIndex, segmentOffset,
symbolName, symbolFlags, symbolType);
DoBinding(segmentIndex, segmentOffset, symbolName, symbolFlags,
symbolType);
segmentOffset += skip + sizeof(uintptr_t);
}
break;
@ -3279,12 +3211,12 @@ struct MachOLibrary {
uint8_t* address = mAddress + seg->vmaddr + aSegmentOffset;
MOZ_RELEASE_ASSERT(aSymbolType == BIND_TYPE_POINTER);
void** ptr = (void**) address;
void** ptr = (void**)address;
ApplyBinding(aSymbolName, ptr);
}
void BindSegment(segment_command_64* aCmd) {
section_64* sect = (section_64*) (aCmd + 1);
section_64* sect = (section_64*)(aCmd + 1);
for (size_t i = 0; i < aCmd->nsects; i++, sect++) {
switch (sect->flags & SECTION_TYPE) {
case S_NON_LAZY_SYMBOL_POINTERS:
@ -3371,7 +3303,8 @@ struct PlatformSymbol {
uint32_t mValue;
};
#define NewPlatformSymbol(Name) { #Name, Name }
#define NewPlatformSymbol(Name) \
{ #Name, Name }
extern "C" {
@ -3396,7 +3329,7 @@ MOZ_EXPORT PlatformSymbol RecordReplayInterface_PlatformSymbols[] = {
NewPlatformSymbol(EPIPE),
NewPlatformSymbol(EAGAIN),
NewPlatformSymbol(ECONNRESET),
{ nullptr, 0 },
{nullptr, 0},
};
} // extern "C"
@ -3488,8 +3421,8 @@ void InitializeCurrentTime() {
}
double CurrentTime() {
return CallFunction<int64_t>(gOriginal_mach_absolute_time) *
gNsPerTick / 1000.0;
return CallFunction<int64_t>(gOriginal_mach_absolute_time) * gNsPerTick /
1000.0;
}
NativeThreadId DirectSpawnThread(void (*aFunction)(void*), void* aArgument,

View File

@ -27,9 +27,7 @@ static Monitor* gMainThreadCallbackMonitor;
// gMainThreadCallbackMonitor.
static StaticInfallibleVector<std::function<void()>> gMainThreadCallbacks;
void InitializeRewindState() {
gMainThreadCallbackMonitor = new Monitor();
}
void InitializeRewindState() { gMainThreadCallbackMonitor = new Monitor(); }
void NewCheckpoint() {
MOZ_RELEASE_ASSERT(Thread::CurrentIsMainThread());

View File

@ -180,8 +180,7 @@ void Stream::RecordOrReplayThreadEvent(ThreadEvent aEvent, const char* aExtra) {
}
extra = ReadInputString();
}
child::ReportFatalError(
"Event Mismatch: Recorded %s %s Replayed %s %s",
child::ReportFatalError("Event Mismatch: Recorded %s %s Replayed %s %s",
ThreadEventName(oldEvent), extra,
ThreadEventName(aEvent), aExtra ? aExtra : "");
}
@ -297,9 +296,8 @@ void Stream::Flush(bool aTakeLock) {
MOZ_RELEASE_ASSERT((size_t)compressedSize <= bound);
StreamChunkLocation chunk =
mRecording->WriteChunk(mName, mNameIndex,
mBallast.get(), compressedSize, mBufferPos,
mStreamPos - mBufferPos, aTakeLock);
mRecording->WriteChunk(mName, mNameIndex, mBallast.get(), compressedSize,
mBufferPos, mStreamPos - mBufferPos, aTakeLock);
mChunks.append(chunk);
MOZ_ALWAYS_TRUE(++mChunkIndex == mChunks.length());
@ -396,7 +394,7 @@ void Recording::NewContents(const uint8_t* aContents, size_t aSize,
MOZ_RELEASE_ASSERT(aSize >= sizeof(Header));
offset += sizeof(Header);
Header* header = (Header*) aContents;
Header* header = (Header*)aContents;
MOZ_RELEASE_ASSERT(header->mMagic == MagicValue);
BuildId currentBuildId;
@ -452,7 +450,7 @@ StreamChunkLocation Recording::WriteChunk(StreamName aName, size_t aNameIndex,
chunk.mStreamPos = aStreamPos;
ChunkDescriptor desc;
desc.mName = (uint32_t) aName;
desc.mName = (uint32_t)aName;
desc.mNameIndex = aNameIndex;
desc.mChunk = chunk;
@ -464,7 +462,8 @@ StreamChunkLocation Recording::WriteChunk(StreamName aName, size_t aNameIndex,
void Recording::ReadChunk(char* aDest, const StreamChunkLocation& aChunk) {
AutoSpinLock lock(mLock);
MOZ_RELEASE_ASSERT(aChunk.mOffset + aChunk.mCompressedSize <= mContents.length());
MOZ_RELEASE_ASSERT(aChunk.mOffset + aChunk.mCompressedSize <=
mContents.length());
memcpy(aDest, mContents.begin() + aChunk.mOffset, aChunk.mCompressedSize);
MOZ_RELEASE_ASSERT(HashBytes(aDest, aChunk.mCompressedSize) == aChunk.mHash);
}

View File

@ -177,7 +177,8 @@ class Stream {
// Note a new thread event for this stream, and make sure it is the same
// while replaying as it was while recording.
void RecordOrReplayThreadEvent(ThreadEvent aEvent, const char* aExtra = nullptr);
void RecordOrReplayThreadEvent(ThreadEvent aEvent,
const char* aExtra = nullptr);
// Replay a thread event without requiring it to be a specific event.
ThreadEvent ReplayThreadEvent();

View File

@ -113,7 +113,7 @@ void Thread::InitializeThreads() {
gThreads = new Thread[MaxThreadId + 1];
size_t nbytes = (MaxThreadId - MainThreadId) * ThreadStackSize;
gThreadStackMemory = (uint8_t*) DirectAllocateMemory(nbytes);
gThreadStackMemory = (uint8_t*)DirectAllocateMemory(nbytes);
for (size_t i = MainThreadId; i <= MaxThreadId; i++) {
Thread* thread = &gThreads[i];
@ -127,7 +127,8 @@ void Thread::InitializeThreads() {
thread->BindToCurrent();
thread->mNativeId = DirectCurrentThread();
} else {
thread->mStackBase = gThreadStackMemory + (i - MainThreadId - 1) * ThreadStackSize;
thread->mStackBase =
gThreadStackMemory + (i - MainThreadId - 1) * ThreadStackSize;
thread->mStackSize = ThreadStackSize - PageSize * 2;
// Make some memory between thread stacks inaccessible so that breakpad
@ -321,7 +322,8 @@ void Thread::ReleaseOrAcquireOwnedLocks(OwnedLockState aState) {
}
void** Thread::GetOrCreateStorage(uintptr_t aKey) {
for (StorageEntry** pentry = &mStorageEntries; *pentry; pentry = &(*pentry)->mNext) {
for (StorageEntry** pentry = &mStorageEntries; *pentry;
pentry = &(*pentry)->mNext) {
StorageEntry* entry = *pentry;
if (entry->mKey == aKey) {
// Put this at the front of the list.
@ -331,7 +333,7 @@ void** Thread::GetOrCreateStorage(uintptr_t aKey) {
return &entry->mData;
}
}
StorageEntry* entry = (StorageEntry*) AllocateStorage(sizeof(StorageEntry));
StorageEntry* entry = (StorageEntry*)AllocateStorage(sizeof(StorageEntry));
entry->mKey = aKey;
entry->mData = 0;
entry->mNext = mStorageEntries;
@ -343,7 +345,7 @@ uint8_t* Thread::AllocateStorage(size_t aSize) {
// malloc uses TLS, so go directly to the system to allocate TLS storage.
if (mStorageCursor + aSize >= mStorageLimit) {
size_t nbytes = std::max(aSize, PageSize);
mStorageCursor = (uint8_t*) DirectAllocateMemory(nbytes);
mStorageCursor = (uint8_t*)DirectAllocateMemory(nbytes);
mStorageLimit = mStorageCursor + nbytes;
}
uint8_t* res = mStorageCursor;
@ -510,8 +512,7 @@ void Thread::NotifyUnrecordedWait(
}
}
bool Thread::MaybeWaitForFork(
const std::function<void()>& aReleaseCallback) {
bool Thread::MaybeWaitForFork(const std::function<void()>& aReleaseCallback) {
MOZ_RELEASE_ASSERT(!PassThroughEvents());
if (IsMainThread()) {
return false;

View File

@ -173,7 +173,6 @@ class Thread {
uint8_t* AllocateStorage(size_t aSize);
public:
// These are used by certain redirections to convey information from the
// SaveOutput hook to the MiddlemanCall hook.
uintptr_t mRedirectionValue;
@ -236,9 +235,7 @@ class Thread {
}
// Get the macOS mach identifier for this thread.
uintptr_t GetMachId() const {
return mMachId;
}
uintptr_t GetMachId() const { return mMachId; }
// The actual start routine at the root of all recorded threads, and of all
// threads when replaying.

View File

@ -175,8 +175,7 @@ bool SaveThreadState(size_t aId, int* aStackSeparator) {
MOZ_RELEASE_ASSERT(aId <= MaxThreadId);
ThreadState* info = &gThreadState[aId];
bool res =
SaveThreadStateOrReturnFromRestore(info, aStackSeparator) == 0;
bool res = SaveThreadStateOrReturnFromRestore(info, aStackSeparator) == 0;
if (!res) {
ClearThreadState(info);
}
@ -199,13 +198,12 @@ void SaveThreadStack(size_t aId) {
// Release any existing stack contents from a previous fork.
free(info.mStackContents);
info.mStackContents = (uint8_t*) malloc(stackBytes);
info.mStackContents = (uint8_t*)malloc(stackBytes);
info.mStackBytes = stackBytes;
memcpy(info.mStackContents, info.mStackTop, info.mStackTopBytes);
memcpy(info.mStackContents + info.mStackTopBytes,
stackPointer + info.mStackTopBytes,
stackBytes - info.mStackTopBytes);
stackPointer + info.mStackTopBytes, stackBytes - info.mStackTopBytes);
}
void RestoreThreadStack(size_t aId) {

View File

@ -68,7 +68,8 @@ Channel::Channel(size_t aId, Kind aKind, const MessageHandler& aHandler,
mConnectionFd(0),
mFd(0),
mMessageBytes(0) {
MOZ_RELEASE_ASSERT(!IsRecordingOrReplaying() || AreThreadEventsPassedThrough());
MOZ_RELEASE_ASSERT(!IsRecordingOrReplaying() ||
AreThreadEventsPassedThrough());
if (IsParent()) {
ipc::FileDescriptor connection;
@ -223,8 +224,7 @@ Message::UniquePtr Channel::WaitForMessage() {
// Remove the message we just received from the incoming buffer.
size_t remaining = mMessageBytes - messageSize;
if (remaining) {
memmove(mMessageBuffer.begin(), &mMessageBuffer[messageSize],
remaining);
memmove(mMessageBuffer.begin(), &mMessageBuffer[messageSize], remaining);
}
mMessageBytes = remaining;

View File

@ -162,10 +162,8 @@ struct Message {
return mType == MessageType::CreateCheckpoint ||
mType == MessageType::SetDebuggerRunsInMiddleman ||
mType == MessageType::ExternalCallResponse ||
mType == MessageType::Ping ||
mType == MessageType::Terminate ||
mType == MessageType::Crash ||
mType == MessageType::Introduction ||
mType == MessageType::Ping || mType == MessageType::Terminate ||
mType == MessageType::Crash || mType == MessageType::Introduction ||
mType == MessageType::RecordingData;
}
@ -286,7 +284,8 @@ struct ErrorMessage : public Message {
typedef ErrorMessage<MessageType::FatalError> FatalErrorMessage;
typedef ErrorMessage<MessageType::CloudError> CloudErrorMessage;
typedef EmptyMessage<MessageType::UnhandledDivergence> UnhandledDivergenceMessage;
typedef EmptyMessage<MessageType::UnhandledDivergence>
UnhandledDivergenceMessage;
// The format for graphics data which will be sent to the middleman process.
// This needs to match the format expected for canvas image data, to avoid

View File

@ -161,8 +161,8 @@ static void ChannelMessageHandler(Message::UniquePtr aMsg) {
case MessageType::RecordingData: {
MonitorAutoLock lock(*gMonitor);
const RecordingDataMessage& nmsg = (const RecordingDataMessage&)*aMsg;
MOZ_RELEASE_ASSERT(
nmsg.mTag == gRecording->Size() + gPendingRecordingData.length());
MOZ_RELEASE_ASSERT(nmsg.mTag ==
gRecording->Size() + gPendingRecordingData.length());
gPendingRecordingData.append(nmsg.BinaryData(), nmsg.BinaryDataSize());
gMonitor->NotifyAll();
break;
@ -351,9 +351,9 @@ static void ForkListenerThread(void*) {
int nbytes = read(gForkReadFd, &process, sizeof(process));
MOZ_RELEASE_ASSERT(nbytes == sizeof(process));
process.mChannel = new Channel(0, Channel::Kind::ReplayRoot,
HandleMessageFromForkedProcess,
process.mPid);
process.mChannel =
new Channel(0, Channel::Kind::ReplayRoot,
HandleMessageFromForkedProcess, process.mPid);
// Send any messages destined for this fork.
size_t i = 0;
@ -377,8 +377,9 @@ static void InitializeForkListener() {
Thread::SpawnNonRecordedThread(ForkListenerThread, nullptr);
if (!ReplayingInCloud()) {
gFatalErrorMemory = (char*) mmap(nullptr, FatalErrorMemorySize,
PROT_READ | PROT_WRITE, MAP_ANON | MAP_SHARED, -1, 0);
gFatalErrorMemory =
(char*)mmap(nullptr, FatalErrorMemorySize, PROT_READ | PROT_WRITE,
MAP_ANON | MAP_SHARED, -1, 0);
MOZ_RELEASE_ASSERT(gFatalErrorMemory != MAP_FAILED);
}
}
@ -386,8 +387,7 @@ static void InitializeForkListener() {
static void SendMessageToForkedProcess(Message::UniquePtr aMsg) {
for (ForkedProcess& process : gForkedProcesses) {
if (process.mForkId == aMsg->mForkId) {
bool remove =
aMsg->mType == MessageType::Terminate ||
bool remove = aMsg->mType == MessageType::Terminate ||
aMsg->mType == MessageType::Crash;
process.mChannel->SendMessage(std::move(*aMsg));
if (remove) {
@ -467,15 +467,16 @@ static void SendFatalErrorMessage(size_t aForkId, const char* aMessage) {
char msgBuf[4096];
size_t header = sizeof(FatalErrorMessage);
size_t len = std::min(strlen(aMessage) + 1, sizeof(msgBuf) - header);
FatalErrorMessage* msg = new (msgBuf) FatalErrorMessage(header + len, aForkId);
FatalErrorMessage* msg =
new (msgBuf) FatalErrorMessage(header + len, aForkId);
memcpy(&msgBuf[header], aMessage, len);
msgBuf[sizeof(msgBuf) - 1] = 0;
// Don't take the message lock when sending this, to avoid touching the heap.
gChannel->SendMessage(std::move(*msg));
Print("***** Fatal Record/Replay Error #%lu:%lu *****\n%s\n", GetId(), aForkId,
aMessage);
Print("***** Fatal Record/Replay Error #%lu:%lu *****\n%s\n", GetId(),
aForkId, aMessage);
}
void ReportCrash(const MinidumpInfo& aInfo, void* aFaultingAddress) {
@ -840,8 +841,8 @@ void ManifestFinished(const js::CharBuffer& aBuffer) {
});
}
void SendExternalCallRequest(ExternalCallId aId,
const char* aInputData, size_t aInputSize,
void SendExternalCallRequest(ExternalCallId aId, const char* aInputData,
size_t aInputSize,
InfallibleVector<char>* aOutputData) {
AutoPassThroughThreadEvents pt;
MonitorAutoLock lock(*gMonitor);
@ -851,8 +852,8 @@ void SendExternalCallRequest(ExternalCallId aId,
}
gWaitingForCallResponse = true;
UniquePtr<ExternalCallRequestMessage> msg(ExternalCallRequestMessage::New(
gForkId, aId, aInputData, aInputSize));
UniquePtr<ExternalCallRequestMessage> msg(
ExternalCallRequestMessage::New(gForkId, aId, aInputData, aInputSize));
gChannel->SendMessage(std::move(*msg));
while (!gCallResponseMessage) {
@ -868,10 +869,10 @@ void SendExternalCallRequest(ExternalCallId aId,
gMonitor->Notify();
}
void SendExternalCallOutput(ExternalCallId aId,
const char* aOutputData, size_t aOutputSize) {
Message::UniquePtr msg(ExternalCallResponseMessage::New(
gForkId, aId, aOutputData, aOutputSize));
void SendExternalCallOutput(ExternalCallId aId, const char* aOutputData,
size_t aOutputSize) {
Message::UniquePtr msg(
ExternalCallResponseMessage::New(gForkId, aId, aOutputData, aOutputSize));
gChannel->SendMessage(std::move(*msg));
}

View File

@ -62,14 +62,14 @@ bool DebuggerRunsInMiddleman();
void ManifestFinished(const js::CharBuffer& aResponse);
// Send messages operating on external calls.
void SendExternalCallRequest(ExternalCallId aId,
const char* aInputData, size_t aInputSize,
void SendExternalCallRequest(ExternalCallId aId, const char* aInputData,
size_t aInputSize,
InfallibleVector<char>* aOutputData);
// Send the output from an external call to the root replaying process,
// to fill in its external call cache.
void SendExternalCallOutput(ExternalCallId aId,
const char* aOutputData, size_t aOutputSize);
void SendExternalCallOutput(ExternalCallId aId, const char* aOutputData,
size_t aOutputSize);
// Return whether a repaint is in progress and is not allowed to trigger an
// unhandled recording divergence per preferences.

View File

@ -27,8 +27,8 @@ ChildProcessInfo::ChildProcessInfo(
: mRecording(aRecordingProcessData.isSome()) {
MOZ_RELEASE_ASSERT(NS_IsMainThread());
Channel::Kind kind =
IsRecording() ? Channel::Kind::MiddlemanRecord : Channel::Kind::MiddlemanReplay;
Channel::Kind kind = IsRecording() ? Channel::Kind::MiddlemanRecord
: Channel::Kind::MiddlemanReplay;
mChannel = new Channel(aId, kind, [=](Message::UniquePtr aMsg) {
ReceiveChildMessageOnMainThread(aId, std::move(aMsg));
});
@ -297,7 +297,7 @@ void ChildProcessInfo::MaybeProcessPendingMessageRunnable() {
// Execute a task that processes a message received from the child. This is
// called on a channel thread, and the function executes asynchronously on
// the main thread.
/* static */ void ChildProcessInfo::ReceiveChildMessageOnMainThread(
/* static */ void ChildProcessInfo::ReceiveChildMessageOnMainThread(
size_t aChildId, Message::UniquePtr aMsg) {
MOZ_RELEASE_ASSERT(!NS_IsMainThread());

View File

@ -265,8 +265,8 @@ static bool Middleman_SendManifest(JSContext* aCx, unsigned aArgc, Value* aVp) {
}
size_t forkId;
parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0),
args.get(1), &forkId);
parent::ChildProcessInfo* child =
ToChildProcess(aCx, args.get(0), args.get(1), &forkId);
if (!child) {
return false;
}
@ -284,8 +284,8 @@ static bool Middleman_Ping(JSContext* aCx, unsigned aArgc, Value* aVp) {
CallArgs args = CallArgsFromVp(aArgc, aVp);
size_t forkId;
parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0),
args.get(1), &forkId);
parent::ChildProcessInfo* child =
ToChildProcess(aCx, args.get(0), args.get(1), &forkId);
if (!child) {
return false;
}
@ -428,8 +428,8 @@ static bool Middleman_Terminate(JSContext* aCx, unsigned aArgc, Value* aVp) {
CallArgs args = CallArgsFromVp(aArgc, aVp);
size_t forkId;
parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0),
args.get(1), &forkId);
parent::ChildProcessInfo* child =
ToChildProcess(aCx, args.get(0), args.get(1), &forkId);
if (!child) {
return false;
}
@ -445,8 +445,8 @@ static bool Middleman_CrashHangedChild(JSContext* aCx, unsigned aArgc,
CallArgs args = CallArgsFromVp(aArgc, aVp);
size_t forkId;
parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0),
args.get(1), &forkId);
parent::ChildProcessInfo* child =
ToChildProcess(aCx, args.get(0), args.get(1), &forkId);
if (!child) {
return false;
}
@ -472,8 +472,8 @@ static bool Middleman_UpdateRecording(JSContext* aCx, unsigned aArgc,
CallArgs args = CallArgsFromVp(aArgc, aVp);
size_t forkId;
parent::ChildProcessInfo* child = ToChildProcess(aCx, args.get(0),
args.get(1), &forkId);
parent::ChildProcessInfo* child =
ToChildProcess(aCx, args.get(0), args.get(1), &forkId);
if (!child) {
return false;
}
@ -1087,8 +1087,7 @@ struct ScriptHitInfo {
}
};
typedef HashMap<ScriptHitKey, ScriptHitVector*, ScriptHitKey>
ScriptHitMap;
typedef HashMap<ScriptHitKey, ScriptHitVector*, ScriptHitKey> ScriptHitMap;
struct AnyScriptHit {
uint32_t mScript;
@ -1349,8 +1348,8 @@ static bool RecordReplay_FindScriptHits(JSContext* aCx, unsigned aArgc,
for (const auto& hit : *hits) {
RootedObject hitObject(aCx, JS_NewObject(aCx, nullptr));
if (!hitObject ||
!JS_DefineProperty(aCx, hitObject, "progress",
(double)hit.mProgress, JSPROP_ENUMERATE) ||
!JS_DefineProperty(aCx, hitObject, "progress", (double)hit.mProgress,
JSPROP_ENUMERATE) ||
!JS_DefineProperty(aCx, hitObject, "frameIndex", hit.mFrameIndex,
JSPROP_ENUMERATE) ||
!values.append(ObjectValue(*hitObject))) {

View File

@ -198,7 +198,8 @@ class SendMessageToCloudRunnable : public Runnable {
SendMessageToCloudRunnable(int32_t aConnectionId, Message::UniquePtr aMsg)
: Runnable("SendMessageToCloudRunnable"),
mConnectionId(aConnectionId), mMsg(std::move(aMsg)) {}
mConnectionId(aConnectionId),
mMsg(std::move(aMsg)) {}
NS_IMETHODIMP Run() {
AutoSafeJSContext cx;
@ -256,7 +257,7 @@ static bool ConnectionCallback(JSContext* aCx, unsigned aArgc, JS::Value* aVp) {
if (ptr) {
Channel* channel = gConnectionChannels[id];
channel->SendMessageData((const char*) ptr, length);
channel->SendMessageData((const char*)ptr, length);
sentData = true;
}
}
@ -274,16 +275,16 @@ void CreateReplayingCloudProcess(base::ProcessId aProcessId,
MOZ_RELEASE_ASSERT(XRE_IsParentProcess());
if (!gConnection) {
nsCOMPtr<rrIConnection> connection =
do_ImportModule("resource://devtools/server/actors/replay/connection.js");
nsCOMPtr<rrIConnection> connection = do_ImportModule(
"resource://devtools/server/actors/replay/connection.js");
gConnection = connection.forget();
ClearOnShutdown(&gConnection);
AutoSafeJSContext cx;
JSAutoRealm ar(cx, xpc::PrivilegedJunkScope());
JSFunction* fun = JS_NewFunction(cx, ConnectionCallback, 2, 0,
"ConnectionCallback");
JSFunction* fun =
JS_NewFunction(cx, ConnectionCallback, 2, 0, "ConnectionCallback");
MOZ_RELEASE_ASSERT(fun);
JS::RootedValue callback(cx, JS::ObjectValue(*(JSObject*)fun));
if (NS_FAILED(gConnection->Initialize(callback))) {
@ -309,7 +310,8 @@ void CreateReplayingCloudProcess(base::ProcessId aProcessId,
RefPtr<SendMessageToCloudRunnable> runnable =
new SendMessageToCloudRunnable(connectionId, std::move(aMsg));
NS_DispatchToMainThread(runnable);
}, aProcessId);
},
aProcessId);
while ((size_t)connectionId >= gConnectionChannels.length()) {
gConnectionChannels.append(nullptr);
}

View File

@ -37,8 +37,8 @@
#include "mozilla/Unused.h"
#ifdef MOZ_WAYLAND
#include "nsAppRunner.h" // for IsWaylandDisabled
#include "mozilla/widget/mozwayland.h"
# include "nsAppRunner.h" // for IsWaylandDisabled
# include "mozilla/widget/mozwayland.h"
#endif
// stuff from glx.h
@ -552,7 +552,8 @@ bool fire_glxtest_process() {
write_end_of_the_pipe = pfd[1];
close_logging();
// TODO: --display command line argument is not properly handled
// NOTE: prefers X for now because eglQueryRendererIntegerMESA does not exist yet
// NOTE: prefers X for now because eglQueryRendererIntegerMESA does not
// exist yet
#ifdef MOZ_WAYLAND
if (IsWaylandDisabled() || getenv("DISPLAY") || !wayland_egltest())
#endif

View File

@ -948,8 +948,7 @@ void nsLookAndFeel::ConfigureContentGtkTheme() {
mozilla::Preferences::GetCString("widget.content.gtk-theme-override",
themeOverride);
if (!themeOverride.IsEmpty()) {
g_object_set(settings, "gtk-theme-name", themeOverride.get(),
nullptr);
g_object_set(settings, "gtk-theme-name", themeOverride.get(), nullptr);
LOG(("ConfigureContentGtkTheme(%s)\n", themeOverride.get()));
} else {
LOG(("ConfigureContentGtkTheme(%s)\n", GetGtkTheme().get()));

View File

@ -221,8 +221,7 @@ nsresult nsWindowBase::ClearNativeTouchSequence(nsIObserver* aObserver) {
// cancel all input points
for (auto iter = mActivePointers.Iter(); !iter.Done(); iter.Next()) {
auto info = iter.UserData();
InjectTouchPoint(info->mPointerId, info->mPosition,
POINTER_FLAG_CANCELED);
InjectTouchPoint(info->mPointerId, info->mPosition, POINTER_FLAG_CANCELED);
iter.Remove();
}

View File

@ -79,8 +79,7 @@ CycleCollectedJSContext::~CycleCollectedJSContext() {
return;
}
JS::SetHostCleanupFinalizationGroupCallback(
mJSContext, nullptr, nullptr);
JS::SetHostCleanupFinalizationGroupCallback(mJSContext, nullptr, nullptr);
mFinalizationGroupsToCleanUp.reset();
JS_SetContextPrivate(mJSContext, nullptr);
@ -745,7 +744,8 @@ nsresult CycleCollectedJSContext::NotifyUnhandledRejections::Cancel() {
class CleanupFinalizationGroupsRunnable : public CancelableRunnable {
public:
explicit CleanupFinalizationGroupsRunnable(CycleCollectedJSContext* aContext)
: CancelableRunnable("CleanupFinalizationGroupsRunnable"), mContext(aContext) {}
: CancelableRunnable("CleanupFinalizationGroupsRunnable"),
mContext(aContext) {}
NS_DECL_NSIRUNNABLE
private:
CycleCollectedJSContext* mContext;

View File

@ -85,9 +85,7 @@ class MicroTaskRunnable {
virtual ~MicroTaskRunnable() = default;
};
class CycleCollectedJSContext
: dom::PerThreadAtomCache,
private JS::JobQueue {
class CycleCollectedJSContext : dom::PerThreadAtomCache, private JS::JobQueue {
friend class CycleCollectedJSRuntime;
protected:

View File

@ -640,8 +640,8 @@ void LogModule::Printv(LogLevel aLevel, const char* aFmt, va_list aArgs) const {
sLogModuleManager->Print(Name(), aLevel, aFmt, aArgs);
}
void LogModule::Printv(LogLevel aLevel, const TimeStamp* aStart, const char* aFmt,
va_list aArgs) const {
void LogModule::Printv(LogLevel aLevel, const TimeStamp* aStart,
const char* aFmt, va_list aArgs) const {
MOZ_ASSERT(sLogModuleManager != nullptr);
// Forward to LogModule manager w/ level and name