зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1337427 - Add MOZ_MUST_USE to GCVector bool returns, r=woof!
MozReview-Commit-ID: FuGjTr08mpL --HG-- extra : rebase_source : f4adc4ad2b7558f25b344f8f4a7667ca05eed9c9
This commit is contained in:
Родитель
a38125cbf4
Коммит
5b823a90ec
|
@ -68,17 +68,17 @@ class GCVector
|
|||
const T& back() const { return vector.back(); }
|
||||
|
||||
bool initCapacity(size_t cap) { return vector.initCapacity(cap); }
|
||||
bool reserve(size_t req) { return vector.reserve(req); }
|
||||
MOZ_MUST_USE bool reserve(size_t req) { return vector.reserve(req); }
|
||||
void shrinkBy(size_t amount) { return vector.shrinkBy(amount); }
|
||||
bool growBy(size_t amount) { return vector.growBy(amount); }
|
||||
bool resize(size_t newLen) { return vector.resize(newLen); }
|
||||
MOZ_MUST_USE bool growBy(size_t amount) { return vector.growBy(amount); }
|
||||
MOZ_MUST_USE bool resize(size_t newLen) { return vector.resize(newLen); }
|
||||
|
||||
void clear() { return vector.clear(); }
|
||||
|
||||
template<typename U> bool append(U&& item) { return vector.append(mozilla::Forward<U>(item)); }
|
||||
|
||||
template<typename... Args>
|
||||
bool
|
||||
MOZ_MUST_USE bool
|
||||
emplaceBack(Args&&... args) {
|
||||
return vector.emplaceBack(mozilla::Forward<Args>(args)...);
|
||||
}
|
||||
|
@ -99,16 +99,20 @@ class GCVector
|
|||
}
|
||||
|
||||
template<typename U, size_t O, class BP>
|
||||
bool appendAll(const mozilla::Vector<U, O, BP>& aU) { return vector.appendAll(aU); }
|
||||
MOZ_MUST_USE bool appendAll(const mozilla::Vector<U, O, BP>& aU) { return vector.appendAll(aU); }
|
||||
template<typename U, size_t O, class BP>
|
||||
bool appendAll(const GCVector<U, O, BP>& aU) { return vector.append(aU.begin(), aU.length()); }
|
||||
MOZ_MUST_USE bool appendAll(const GCVector<U, O, BP>& aU) {
|
||||
return vector.append(aU.begin(), aU.length());
|
||||
}
|
||||
|
||||
bool appendN(const T& val, size_t count) { return vector.appendN(val, count); }
|
||||
MOZ_MUST_USE bool appendN(const T& val, size_t count) { return vector.appendN(val, count); }
|
||||
|
||||
template<typename U> bool append(const U* aBegin, const U* aEnd) {
|
||||
template<typename U>
|
||||
MOZ_MUST_USE bool append(const U* aBegin, const U* aEnd) {
|
||||
return vector.append(aBegin, aEnd);
|
||||
}
|
||||
template<typename U> bool append(const U* aBegin, size_t aLength) {
|
||||
template<typename U>
|
||||
MOZ_MUST_USE bool append(const U* aBegin, size_t aLength) {
|
||||
return vector.append(aBegin, aLength);
|
||||
}
|
||||
|
||||
|
@ -194,29 +198,33 @@ class MutableWrappedPtrOperations<JS::GCVector<T, Capacity, AllocPolicy>, Wrappe
|
|||
return JS::MutableHandle<T>::fromMarkedLocation(&vec().operator[](aIndex));
|
||||
}
|
||||
|
||||
bool initCapacity(size_t aRequest) { return vec().initCapacity(aRequest); }
|
||||
bool reserve(size_t aRequest) { return vec().reserve(aRequest); }
|
||||
MOZ_MUST_USE bool initCapacity(size_t aRequest) { return vec().initCapacity(aRequest); }
|
||||
MOZ_MUST_USE bool reserve(size_t aRequest) { return vec().reserve(aRequest); }
|
||||
void shrinkBy(size_t aIncr) { vec().shrinkBy(aIncr); }
|
||||
bool growBy(size_t aIncr) { return vec().growBy(aIncr); }
|
||||
bool resize(size_t aNewLength) { return vec().resize(aNewLength); }
|
||||
bool growByUninitialized(size_t aIncr) { return vec().growByUninitialized(aIncr); }
|
||||
MOZ_MUST_USE bool growBy(size_t aIncr) { return vec().growBy(aIncr); }
|
||||
MOZ_MUST_USE bool resize(size_t aNewLength) { return vec().resize(aNewLength); }
|
||||
MOZ_MUST_USE bool growByUninitialized(size_t aIncr) { return vec().growByUninitialized(aIncr); }
|
||||
void infallibleGrowByUninitialized(size_t aIncr) { vec().infallibleGrowByUninitialized(aIncr); }
|
||||
bool resizeUninitialized(size_t aNewLength) { return vec().resizeUninitialized(aNewLength); }
|
||||
MOZ_MUST_USE bool resizeUninitialized(size_t aNewLength) { return vec().resizeUninitialized(aNewLength); }
|
||||
void clear() { vec().clear(); }
|
||||
void clearAndFree() { vec().clearAndFree(); }
|
||||
template<typename U> bool append(U&& aU) { return vec().append(mozilla::Forward<U>(aU)); }
|
||||
template<typename... Args> bool emplaceBack(Args&&... aArgs) {
|
||||
template<typename U>
|
||||
MOZ_MUST_USE bool append(U&& aU) { return vec().append(mozilla::Forward<U>(aU)); }
|
||||
template<typename... Args>
|
||||
MOZ_MUST_USE bool emplaceBack(Args&&... aArgs) {
|
||||
return vec().emplaceBack(mozilla::Forward<Args...>(aArgs...));
|
||||
}
|
||||
template<typename U, size_t O, class BP>
|
||||
bool appendAll(const mozilla::Vector<U, O, BP>& aU) { return vec().appendAll(aU); }
|
||||
MOZ_MUST_USE bool appendAll(const mozilla::Vector<U, O, BP>& aU) { return vec().appendAll(aU); }
|
||||
template<typename U, size_t O, class BP>
|
||||
bool appendAll(const JS::GCVector<U, O, BP>& aU) { return vec().appendAll(aU); }
|
||||
bool appendN(const T& aT, size_t aN) { return vec().appendN(aT, aN); }
|
||||
template<typename U> bool append(const U* aBegin, const U* aEnd) {
|
||||
MOZ_MUST_USE bool appendAll(const JS::GCVector<U, O, BP>& aU) { return vec().appendAll(aU); }
|
||||
MOZ_MUST_USE bool appendN(const T& aT, size_t aN) { return vec().appendN(aT, aN); }
|
||||
template<typename U>
|
||||
MOZ_MUST_USE bool append(const U* aBegin, const U* aEnd) {
|
||||
return vec().append(aBegin, aEnd);
|
||||
}
|
||||
template<typename U> bool append(const U* aBegin, size_t aLength) {
|
||||
template<typename U>
|
||||
MOZ_MUST_USE bool append(const U* aBegin, size_t aLength) {
|
||||
return vec().append(aBegin, aLength);
|
||||
}
|
||||
template<typename U> void infallibleAppend(U&& aU) {
|
||||
|
|
|
@ -97,7 +97,7 @@ BEGIN_TEST(testGCUID)
|
|||
JS::Rooted<ObjectVector> vec2(cx, ObjectVector(cx));
|
||||
for (size_t i = 0; i < N; ++i) {
|
||||
if (i % 2 == 1)
|
||||
vec2.append(vec[i]);
|
||||
CHECK(vec2.append(vec[i]));
|
||||
}
|
||||
vec.clear();
|
||||
MinimizeHeap(cx);
|
||||
|
|
|
@ -427,7 +427,7 @@ UnboxArrayPrimitive(JSContext* aCx, const jni::Object::LocalRef& aData,
|
|||
});
|
||||
|
||||
const size_t len = env->GetArrayLength(jarray);
|
||||
elements.initCapacity(len);
|
||||
NS_ENSURE_TRUE(elements.initCapacity(len), NS_ERROR_FAILURE);
|
||||
|
||||
for (size_t i = 0; i < len; i++) {
|
||||
NS_ENSURE_TRUE(elements.append((*ToValue)(Type(array[i]))),
|
||||
|
|
Загрузка…
Ссылка в новой задаче