Merge "Fixing the lockless fifo destory bug. Removing unused code from element. build."
This commit is contained in:
committed by
Android (Google) Code Review
commit
0806d51832
@ -284,6 +284,15 @@ void Element::decRefs(const void *ptr) const {
|
||||
}
|
||||
}
|
||||
|
||||
Element::Builder::Builder() {
|
||||
const uint32_t initialCapacity = 32;
|
||||
mBuilderElementRefs.setCapacity(initialCapacity);
|
||||
mBuilderElements.setCapacity(initialCapacity);
|
||||
mBuilderNameStrings.setCapacity(initialCapacity);
|
||||
mBuilderNameLengths.setCapacity(initialCapacity);
|
||||
mBuilderArrays.setCapacity(initialCapacity);
|
||||
}
|
||||
|
||||
void Element::Builder::add(const Element *e, const char *nameStr, uint32_t arraySize) {
|
||||
mBuilderElementRefs.push(ObjectBaseRef<const Element>(e));
|
||||
mBuilderElements.push(e);
|
||||
@ -303,41 +312,12 @@ ObjectBaseRef<const Element> Element::Builder::create(Context *rsc) {
|
||||
|
||||
|
||||
ElementState::ElementState() {
|
||||
const uint32_t initialCapacity = 32;
|
||||
mBuilderElements.setCapacity(initialCapacity);
|
||||
mBuilderNameStrings.setCapacity(initialCapacity);
|
||||
mBuilderNameLengths.setCapacity(initialCapacity);
|
||||
mBuilderArrays.setCapacity(initialCapacity);
|
||||
}
|
||||
|
||||
ElementState::~ElementState() {
|
||||
rsAssert(!mElements.size());
|
||||
}
|
||||
|
||||
void ElementState::elementBuilderBegin() {
|
||||
mBuilderElements.clear();
|
||||
mBuilderNameStrings.clear();
|
||||
mBuilderNameLengths.clear();
|
||||
mBuilderArrays.clear();
|
||||
}
|
||||
|
||||
void ElementState::elementBuilderAdd(const Element *e, const char *nameStr, uint32_t arraySize) {
|
||||
mBuilderElements.push(e);
|
||||
mBuilderNameStrings.push(nameStr);
|
||||
mBuilderNameLengths.push(strlen(nameStr));
|
||||
mBuilderArrays.push(arraySize);
|
||||
|
||||
}
|
||||
|
||||
const Element *ElementState::elementBuilderCreate(Context *rsc) {
|
||||
return Element::create(rsc, mBuilderElements.size(),
|
||||
&(mBuilderElements.editArray()[0]),
|
||||
&(mBuilderNameStrings.editArray()[0]),
|
||||
mBuilderNameLengths.editArray(),
|
||||
mBuilderArrays.editArray());
|
||||
}
|
||||
|
||||
|
||||
/////////////////////////////////////////
|
||||
//
|
||||
|
||||
|
@ -30,6 +30,7 @@ class Element : public ObjectBase {
|
||||
public:
|
||||
class Builder {
|
||||
public:
|
||||
Builder();
|
||||
void add(const Element *e, const char *nameStr, uint32_t arraySize);
|
||||
ObjectBaseRef<const Element> create(Context *rsc);
|
||||
private:
|
||||
@ -135,17 +136,8 @@ public:
|
||||
ElementState();
|
||||
~ElementState();
|
||||
|
||||
void elementBuilderBegin();
|
||||
void elementBuilderAdd(const Element *e, const char *nameStr, uint32_t arraySize);
|
||||
const Element *elementBuilderCreate(Context *rsc);
|
||||
|
||||
// Cache of all existing elements.
|
||||
Vector<Element *> mElements;
|
||||
private:
|
||||
Vector<const Element *> mBuilderElements;
|
||||
Vector<const char*> mBuilderNameStrings;
|
||||
Vector<size_t> mBuilderNameLengths;
|
||||
Vector<uint32_t> mBuilderArrays;
|
||||
};
|
||||
|
||||
|
||||
|
@ -21,11 +21,11 @@
|
||||
using namespace android;
|
||||
using namespace android::renderscript;
|
||||
|
||||
LocklessCommandFifo::LocklessCommandFifo() : mBuffer(0) {
|
||||
LocklessCommandFifo::LocklessCommandFifo() : mBuffer(0), mInitialized(false) {
|
||||
}
|
||||
|
||||
LocklessCommandFifo::~LocklessCommandFifo() {
|
||||
if (!mInShutdown) {
|
||||
if (!mInShutdown && mInitialized) {
|
||||
shutdown();
|
||||
}
|
||||
if (mBuffer) {
|
||||
@ -58,6 +58,7 @@ bool LocklessCommandFifo::init(uint32_t sizeInBytes) {
|
||||
mGet = mBuffer;
|
||||
mEnd = mBuffer + (sizeInBytes) - 1;
|
||||
//dumpState("init");
|
||||
mInitialized = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -47,6 +47,7 @@ protected:
|
||||
uint8_t * mEnd;
|
||||
uint8_t mSize;
|
||||
bool mInShutdown;
|
||||
bool mInitialized;
|
||||
|
||||
Signal mSignalToWorker;
|
||||
Signal mSignalToControl;
|
||||
|
Reference in New Issue
Block a user