Skip to content

Commit

Permalink
Bug 1519636 - clang-format-8: Reformat recent changes to the Google c…
Browse files Browse the repository at this point in the history
…oding style r=Ehsan

clang-format-8 upstream had some improvements wrt macros
See: https://reviews.llvm.org/D33440
This is why the diff is bigger than usual

# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D26098
  • Loading branch information
sylvestre committed Apr 5, 2019
1 parent de3550a commit a45536a
Show file tree
Hide file tree
Showing 188 changed files with 3,153 additions and 2,745 deletions.
669 changes: 346 additions & 323 deletions accessible/base/MarkupMap.h

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions dom/base/AnonymousContent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -197,8 +197,7 @@ void AnonymousContent::GetComputedStylePropertyValue(
aRv = cs->GetPropertyValue(aPropertyName, aResult);
}

void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult)
{
void AnonymousContent::GetTargetIdForEvent(Event& aEvent, DOMString& aResult) {
nsCOMPtr<Element> el = do_QueryInterface(aEvent.GetOriginalTarget());
if (el && el->IsInNativeAnonymousSubtree() && mContentNode->Contains(el)) {
aResult.SetKnownLiveAtom(el->GetID(), DOMString::eTreatNullAsNull);
Expand Down
29 changes: 15 additions & 14 deletions dom/base/DocGroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -143,20 +143,21 @@ RefPtr<PerformanceInfoPromise> DocGroup::ReportPerformanceInfo() {
RefPtr<DocGroup> self = this;

return CollectMemoryInfo(top, mainThread)
->Then(mainThread, __func__,
[self, host, pid, windowID, duration, isTopLevel,
items](const PerformanceMemoryInfo& aMemoryInfo) {
PerformanceInfo info =
PerformanceInfo(host, pid, windowID, duration,
self->mPerformanceCounter->GetID(), false,
isTopLevel, aMemoryInfo, items);

return PerformanceInfoPromise::CreateAndResolve(std::move(info),
__func__);
},
[self](const nsresult rv) {
return PerformanceInfoPromise::CreateAndReject(rv, __func__);
});
->Then(
mainThread, __func__,
[self, host, pid, windowID, duration, isTopLevel,
items](const PerformanceMemoryInfo& aMemoryInfo) {
PerformanceInfo info =
PerformanceInfo(host, pid, windowID, duration,
self->mPerformanceCounter->GetID(), false,
isTopLevel, aMemoryInfo, items);

return PerformanceInfoPromise::CreateAndResolve(std::move(info),
__func__);
},
[self](const nsresult rv) {
return PerformanceInfoPromise::CreateAndReject(rv, __func__);
});
}

nsresult DocGroup::Dispatch(TaskCategory aCategory,
Expand Down
3 changes: 1 addition & 2 deletions dom/base/TreeOrderedArrayInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,7 @@ size_t TreeOrderedArray<Node>::Insert(Node& aNode) {
};

size_t idx;
BinarySearchIf(mList, 0, mList.Length(),
PositionComparator(aNode), &idx);
BinarySearchIf(mList, 0, mList.Length(), PositionComparator(aNode), &idx);
mList.InsertElementAt(idx, &aNode);
return idx;
}
Expand Down
3 changes: 1 addition & 2 deletions dom/base/UIDirectionManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ void OnPrefChange(const char* aPrefName, void*) {
void UIDirectionManager::Initialize() {
DebugOnly<nsresult> rv =
Preferences::RegisterCallback(OnPrefChange, "intl.uidirection");
MOZ_ASSERT(NS_SUCCEEDED(rv),
"Failed to observe \"intl.uidirection\"");
MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed to observe \"intl.uidirection\"");
}

/* static */
Expand Down
4 changes: 3 additions & 1 deletion dom/base/nsAttrValue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1646,7 +1646,9 @@ MiscContainer* nsAttrValue::ClearMiscContainer() {
delete cont->mValue.mIntMargin;
break;
}
default: { break; }
default: {
break;
}
}
}
ResetMiscAtomOrString();
Expand Down
4 changes: 3 additions & 1 deletion dom/base/nsAttrValueInlines.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,9 @@ inline void nsAttrValue::ToString(mozilla::dom::DOMString& aResult) const {
aResult.SetKnownLiveAtom(atom, mozilla::dom::DOMString::eNullNotExpected);
break;
}
default: { ToString(aResult.AsAString()); }
default: {
ToString(aResult.AsAString());
}
}
}

Expand Down
4 changes: 3 additions & 1 deletion dom/base/nsCCUncollectableMarker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,9 @@ nsresult nsCCUncollectableMarker::Observe(nsISupports* aSubject,
xpc_UnmarkSkippableJSHolders();
break;
}
default: { break; }
default: {
break;
}
}

return NS_OK;
Expand Down
4 changes: 3 additions & 1 deletion dom/cache/Context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,9 @@ Context::QuotaInitRunnable::Run() {
}
// -----
case STATE_WAIT_FOR_DIRECTORY_LOCK:
default: { MOZ_CRASH("unexpected state in QuotaInitRunnable"); }
default: {
MOZ_CRASH("unexpected state in QuotaInitRunnable");
}
}

if (resolver->Resolved()) {
Expand Down
2 changes: 1 addition & 1 deletion dom/canvas/CanvasRenderingContext2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,7 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(CanvasRenderingContext2D)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END

CanvasRenderingContext2D::ContextState::ContextState() = default;
CanvasRenderingContext2D::ContextState::ContextState() = default;

CanvasRenderingContext2D::ContextState::ContextState(const ContextState& aOther)
: fontGroup(aOther.fontGroup),
Expand Down
4 changes: 2 additions & 2 deletions dom/canvas/WebGLContextVertices.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,8 @@ void WebGLContext::VertexAttribAnyPointer(bool isFuncInt, GLuint index,
}

WebGLVertexAttribData& vd = mBoundVertexArray->mAttribs[index];
vd.VertexAttribPointer(isFuncInt, buffer, AutoAssertCast(size), type, normalized, stride,
byteOffset);
vd.VertexAttribPointer(isFuncInt, buffer, AutoAssertCast(size), type,
normalized, stride, byteOffset);
mBoundVertexArray->InvalidateCaches();
}

Expand Down
26 changes: 14 additions & 12 deletions dom/canvas/WebGLTexelConversions.h
Original file line number Diff line number Diff line change
Expand Up @@ -962,7 +962,7 @@ MOZ_ALWAYS_INLINE void
pack<WebGLTexelFormat::RGB565, WebGLTexelPremultiplicationOp::None, uint8_t,
uint16_t>(const uint8_t* __restrict src, uint16_t* __restrict dst) {
*dst = uint16_t(((src[0] & 0xF8) << 8) | ((src[1] & 0xFC) << 3) |
((src[2] & 0xF8) >> 3));
((src[2] & 0xF8) >> 3));
}

template <>
Expand All @@ -974,7 +974,8 @@ pack<WebGLTexelFormat::RGB565, WebGLTexelPremultiplicationOp::Premultiply,
uint8_t srcR = static_cast<uint8_t>(src[0] * scaleFactor);
uint8_t srcG = static_cast<uint8_t>(src[1] * scaleFactor);
uint8_t srcB = static_cast<uint8_t>(src[2] * scaleFactor);
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) | ((srcB & 0xF8) >> 3));
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) |
((srcB & 0xF8) >> 3));
}

// FIXME: this routine is lossy and must be removed.
Expand All @@ -987,7 +988,8 @@ pack<WebGLTexelFormat::RGB565, WebGLTexelPremultiplicationOp::Unpremultiply,
uint8_t srcR = static_cast<uint8_t>(src[0] * scaleFactor);
uint8_t srcG = static_cast<uint8_t>(src[1] * scaleFactor);
uint8_t srcB = static_cast<uint8_t>(src[2] * scaleFactor);
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) | ((srcB & 0xF8) >> 3));
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xFC) << 3) |
((srcB & 0xF8) >> 3));
}

template <>
Expand Down Expand Up @@ -1121,8 +1123,8 @@ template <>
MOZ_ALWAYS_INLINE void
pack<WebGLTexelFormat::RGBA4444, WebGLTexelPremultiplicationOp::None, uint8_t,
uint16_t>(const uint8_t* __restrict src, uint16_t* __restrict dst) {
*dst = uint16_t(((src[0] & 0xF0) << 8) | ((src[1] & 0xF0) << 4) | (src[2] & 0xF0) |
(src[3] >> 4));
*dst = uint16_t(((src[0] & 0xF0) << 8) | ((src[1] & 0xF0) << 4) |
(src[2] & 0xF0) | (src[3] >> 4));
}

template <>
Expand All @@ -1135,7 +1137,7 @@ pack<WebGLTexelFormat::RGBA4444, WebGLTexelPremultiplicationOp::Premultiply,
uint8_t srcG = static_cast<uint8_t>(src[1] * scaleFactor);
uint8_t srcB = static_cast<uint8_t>(src[2] * scaleFactor);
*dst = uint16_t(((srcR & 0xF0) << 8) | ((srcG & 0xF0) << 4) | (srcB & 0xF0) |
(src[3] >> 4));
(src[3] >> 4));
}

// FIXME: this routine is lossy and must be removed.
Expand All @@ -1149,15 +1151,15 @@ pack<WebGLTexelFormat::RGBA4444, WebGLTexelPremultiplicationOp::Unpremultiply,
uint8_t srcG = static_cast<uint8_t>(src[1] * scaleFactor);
uint8_t srcB = static_cast<uint8_t>(src[2] * scaleFactor);
*dst = uint16_t(((srcR & 0xF0) << 8) | ((srcG & 0xF0) << 4) | (srcB & 0xF0) |
(src[3] >> 4));
(src[3] >> 4));
}

template <>
MOZ_ALWAYS_INLINE void
pack<WebGLTexelFormat::RGBA5551, WebGLTexelPremultiplicationOp::None, uint8_t,
uint16_t>(const uint8_t* __restrict src, uint16_t* __restrict dst) {
*dst = uint16_t(((src[0] & 0xF8) << 8) | ((src[1] & 0xF8) << 3) |
((src[2] & 0xF8) >> 2) | (src[3] >> 7));
((src[2] & 0xF8) >> 2) | (src[3] >> 7));
}

template <>
Expand All @@ -1169,8 +1171,8 @@ pack<WebGLTexelFormat::RGBA5551, WebGLTexelPremultiplicationOp::Premultiply,
uint8_t srcR = static_cast<uint8_t>(src[0] * scaleFactor);
uint8_t srcG = static_cast<uint8_t>(src[1] * scaleFactor);
uint8_t srcB = static_cast<uint8_t>(src[2] * scaleFactor);
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) | ((srcB & 0xF8) >> 2) |
(src[3] >> 7));
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) |
((srcB & 0xF8) >> 2) | (src[3] >> 7));
}

// FIXME: this routine is lossy and must be removed.
Expand All @@ -1183,8 +1185,8 @@ pack<WebGLTexelFormat::RGBA5551, WebGLTexelPremultiplicationOp::Unpremultiply,
uint8_t srcR = static_cast<uint8_t>(src[0] * scaleFactor);
uint8_t srcG = static_cast<uint8_t>(src[1] * scaleFactor);
uint8_t srcB = static_cast<uint8_t>(src[2] * scaleFactor);
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) | ((srcB & 0xF8) >> 2) |
(src[3] >> 7));
*dst = uint16_t(((srcR & 0xF8) << 8) | ((srcG & 0xF8) << 3) |
((srcB & 0xF8) >> 2) | (src[3] >> 7));
}

template <>
Expand Down
3 changes: 2 additions & 1 deletion dom/canvas/WebGLTexture.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,8 @@ class WebGLTexture final : public nsWrapperCache,
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Y:
case LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_Z:
case LOCAL_GL_TEXTURE_CUBE_MAP_NEGATIVE_Z:
return AutoAssertCast(rawTexImageTarget - LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X);
return AutoAssertCast(rawTexImageTarget -
LOCAL_GL_TEXTURE_CUBE_MAP_POSITIVE_X);

default:
return 0;
Expand Down
10 changes: 5 additions & 5 deletions dom/canvas/WebGLTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,22 +60,22 @@ inline void* calloc(const ForbidNarrowing<size_t> n,

namespace detail {

template<typename From>
template <typename From>
class AutoAssertCastT final {
const From mVal;

public:
explicit AutoAssertCastT(const From val) : mVal(val) { }
public:
explicit AutoAssertCastT(const From val) : mVal(val) {}

template<typename To>
template <typename To>
operator To() const {
return AssertedCast<To>(mVal);
}
};

} // namespace detail

template<typename From>
template <typename From>
inline auto AutoAssertCast(const From val) {
return detail::AutoAssertCastT<From>(val);
}
Expand Down
27 changes: 14 additions & 13 deletions dom/clients/api/Client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,20 @@ already_AddRefed<Promise> Client::Focus(ErrorResult& aRv) {
MakeRefPtr<DOMMozPromiseRequestHolder<ClientStatePromise>>(mGlobal);

mHandle->Focus()
->Then(mGlobal->EventTargetFor(TaskCategory::Other), __func__,
[ipcClientInfo, holder, outerPromise](const ClientState& aResult) {
holder->Complete();
NS_ENSURE_TRUE_VOID(holder->GetParentObject());
RefPtr<Client> newClient = new Client(
holder->GetParentObject(),
ClientInfoAndState(ipcClientInfo, aResult.ToIPC()));
outerPromise->MaybeResolve(newClient);
},
[holder, outerPromise](nsresult aResult) {
holder->Complete();
outerPromise->MaybeReject(aResult);
})
->Then(
mGlobal->EventTargetFor(TaskCategory::Other), __func__,
[ipcClientInfo, holder, outerPromise](const ClientState& aResult) {
holder->Complete();
NS_ENSURE_TRUE_VOID(holder->GetParentObject());
RefPtr<Client> newClient =
new Client(holder->GetParentObject(),
ClientInfoAndState(ipcClientInfo, aResult.ToIPC()));
outerPromise->MaybeResolve(newClient);
},
[holder, outerPromise](nsresult aResult) {
holder->Complete();
outerPromise->MaybeReject(aResult);
})
->Track(*holder);

return outerPromise.forget();
Expand Down
19 changes: 10 additions & 9 deletions dom/clients/api/ClientDOMUtil.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,16 @@ void StartClientManagerOp(Func aFunc, const Arg& aArg, nsIGlobalObject* aGlobal,
MakeRefPtr<DOMMozPromiseRequestHolder<ClientOpPromise>>(aGlobal);

aFunc(aArg, target)
->Then(target, __func__,
[aResolve, holder](const ClientOpResult& aResult) {
holder->Complete();
aResolve(aResult);
},
[aReject, holder](nsresult aResult) {
holder->Complete();
aReject(aResult);
})
->Then(
target, __func__,
[aResolve, holder](const ClientOpResult& aResult) {
holder->Complete();
aResolve(aResult);
},
[aReject, holder](nsresult aResult) {
holder->Complete();
aReject(aResult);
})
->Track(*holder);
}

Expand Down
49 changes: 25 additions & 24 deletions dom/clients/api/Clients.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,30 +80,31 @@ already_AddRefed<Promise> Clients::Get(const nsAString& aClientID,
MakeRefPtr<DOMMozPromiseRequestHolder<ClientOpPromise>>(mGlobal);

innerPromise
->Then(target, __func__,
[outerPromise, holder, scope](const ClientOpResult& aResult) {
holder->Complete();
NS_ENSURE_TRUE_VOID(holder->GetParentObject());
RefPtr<Client> client = new Client(
holder->GetParentObject(), aResult.get_ClientInfoAndState());
if (client->GetStorageAccess() ==
nsContentUtils::StorageAccess::eAllow) {
outerPromise->MaybeResolve(std::move(client));
return;
}
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"Clients::Get() storage denied", [scope] {
ServiceWorkerManager::LocalizeAndReportToAllClients(
scope, "ServiceWorkerGetClientStorageError",
nsTArray<nsString>());
});
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
outerPromise->MaybeResolveWithUndefined();
},
[outerPromise, holder](nsresult aResult) {
holder->Complete();
outerPromise->MaybeResolveWithUndefined();
})
->Then(
target, __func__,
[outerPromise, holder, scope](const ClientOpResult& aResult) {
holder->Complete();
NS_ENSURE_TRUE_VOID(holder->GetParentObject());
RefPtr<Client> client = new Client(
holder->GetParentObject(), aResult.get_ClientInfoAndState());
if (client->GetStorageAccess() ==
nsContentUtils::StorageAccess::eAllow) {
outerPromise->MaybeResolve(std::move(client));
return;
}
nsCOMPtr<nsIRunnable> r = NS_NewRunnableFunction(
"Clients::Get() storage denied", [scope] {
ServiceWorkerManager::LocalizeAndReportToAllClients(
scope, "ServiceWorkerGetClientStorageError",
nsTArray<nsString>());
});
SystemGroup::Dispatch(TaskCategory::Other, r.forget());
outerPromise->MaybeResolveWithUndefined();
},
[outerPromise, holder](nsresult aResult) {
holder->Complete();
outerPromise->MaybeResolveWithUndefined();
})
->Track(*holder);

return outerPromise.forget();
Expand Down
Loading

0 comments on commit a45536a

Please sign in to comment.