mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1189722 - Fix const methods in MutableTraceableVectorOperations r=terrence
This commit is contained in:
parent
387201c73f
commit
ecb3e74e2c
@ -77,13 +77,19 @@ class MutableTraceableVectorOperations
|
||||
: public TraceableVectorOperations<Outer, T, Capacity, AllocPolicy, TraceFunc>
|
||||
{
|
||||
using Vec = TraceableVector<T, Capacity, AllocPolicy, TraceFunc>;
|
||||
const Vec& vec() const { return static_cast<const Outer*>(this)->extract(); }
|
||||
Vec& vec() { return static_cast<Outer*>(this)->extract(); }
|
||||
|
||||
public:
|
||||
const AllocPolicy& allocPolicy() const { return vec().allocPolicy(); }
|
||||
AllocPolicy& allocPolicy() { return vec().allocPolicy(); }
|
||||
const T* begin() const { return vec().begin(); }
|
||||
T* begin() { return vec().begin(); }
|
||||
const T* end() const { return vec().end(); }
|
||||
T* end() { return vec().end(); }
|
||||
const T& operator[](size_t aIndex) const { return vec().operator[](aIndex); }
|
||||
T& operator[](size_t aIndex) { return vec().operator[](aIndex); }
|
||||
const T& back() const { return vec().back(); }
|
||||
T& back() { return vec().back(); }
|
||||
|
||||
bool initCapacity(size_t aRequest) { return vec().initCapacity(aRequest); }
|
||||
|
@ -271,6 +271,42 @@ BEGIN_TEST(testGCRootedVector)
|
||||
CHECK(shape);
|
||||
}
|
||||
|
||||
CHECK(receiveConstRefToShapeVector(shapes));
|
||||
|
||||
// Ensure rooted converts to handles.
|
||||
CHECK(receiveHandleToShapeVector(shapes));
|
||||
CHECK(receiveMutableHandleToShapeVector(&shapes));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
receiveConstRefToShapeVector(const JS::Rooted<TraceableVector<Shape*>>& rooted)
|
||||
{
|
||||
// Ensure range enumeration works through the reference.
|
||||
for (auto shape : rooted) {
|
||||
CHECK(shape);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
receiveHandleToShapeVector(JS::Handle<TraceableVector<Shape*>> handle)
|
||||
{
|
||||
// Ensure range enumeration works through the handle.
|
||||
for (auto shape : handle) {
|
||||
CHECK(shape);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
receiveMutableHandleToShapeVector(JS::MutableHandle<TraceableVector<Shape*>> handle)
|
||||
{
|
||||
// Ensure range enumeration works through the handle.
|
||||
for (auto shape : handle) {
|
||||
CHECK(shape);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
END_TEST(testGCRootedVector)
|
||||
|
Loading…
Reference in New Issue
Block a user