Bug 1648541 - Rename details namespace in SPSCQueue r=froydnj

I will admit from the start that this patch is goofy and is not the "proper" fix.

If you're unlucky enough to tickle the current unification in `dom/media`, then there's a conflict between `namespace mozilla::details` of `SPSCQueue.h` and `namespace details` of Chromium's `task.h`. Ultimately, the badness stems from some unified file doing `using namespace mozilla;`, but I'm really not enthusiastic about reworking that when I just want to get unblocked.

I'm going to attempt to justify the yuckiness of this patch on the basis that:
* `SPSCQueue.h` is super self-contained and rarely looked at, I bet nobody will notice this change
* Tons of other code prefers the spelling `mozilla::detail` anyway

Differential Revision: https://phabricator.services.mozilla.com/D81162
This commit is contained in:
David Major 2020-06-25 19:30:52 +00:00
parent 6017f891b8
commit a0cb558b98

View File

@ -20,7 +20,7 @@
namespace mozilla {
namespace details {
namespace detail {
template <typename T, bool IsPod = std::is_trivial<T>::value>
struct MemoryOperations {
/**
@ -58,7 +58,7 @@ struct MemoryOperations<T, false> {
std::move(aSource, aSource + aCount, aDestination);
}
};
} // namespace details
} // namespace detail
/**
* This data structure allows producing data from one thread, and consuming it
@ -166,14 +166,14 @@ class SPSCRingBufferBase {
int secondPart = toWrite - firstPart;
if (aElements) {
details::MemoryOperations<T>::MoveOrCopy(mData.get() + wrIdx, aElements,
firstPart);
details::MemoryOperations<T>::MoveOrCopy(
detail::MemoryOperations<T>::MoveOrCopy(mData.get() + wrIdx, aElements,
firstPart);
detail::MemoryOperations<T>::MoveOrCopy(
mData.get(), aElements + firstPart, secondPart);
} else {
details::MemoryOperations<T>::ConstructDefault(mData.get() + wrIdx,
firstPart);
details::MemoryOperations<T>::ConstructDefault(mData.get(), secondPart);
detail::MemoryOperations<T>::ConstructDefault(mData.get() + wrIdx,
firstPart);
detail::MemoryOperations<T>::ConstructDefault(mData.get(), secondPart);
}
mWriteIndex.store(IncrementIndex(wrIdx, toWrite),
@ -211,10 +211,10 @@ class SPSCRingBufferBase {
int secondPart = toRead - firstPart;
if (elements) {
details::MemoryOperations<T>::MoveOrCopy(elements, mData.get() + rdIdx,
firstPart);
details::MemoryOperations<T>::MoveOrCopy(elements + firstPart,
mData.get(), secondPart);
detail::MemoryOperations<T>::MoveOrCopy(elements, mData.get() + rdIdx,
firstPart);
detail::MemoryOperations<T>::MoveOrCopy(elements + firstPart, mData.get(),
secondPart);
}
mReadIndex.store(IncrementIndex(rdIdx, toRead),