diff options
author | Jason Sams <rjsams@android.com> | 2009-09-25 14:51:22 -0700 |
---|---|---|
committer | Jason Sams <rjsams@android.com> | 2009-09-25 14:51:22 -0700 |
commit | a9e7a05b84470257637c97d65f6562aa832c66ef (patch) | |
tree | 04a3175485ae7492c3387003c244953b6880c514 /libs/rs/rsElement.cpp | |
parent | a0cad2f5d19d95cfe496ebb82f3227dd4ed7c169 (diff) | |
download | frameworks_base-a9e7a05b84470257637c97d65f6562aa832c66ef.zip frameworks_base-a9e7a05b84470257637c97d65f6562aa832c66ef.tar.gz frameworks_base-a9e7a05b84470257637c97d65f6562aa832c66ef.tar.bz2 |
Improve renderscript context teardown. Track object in the system and then force their cleanup by releasing all user references once destroy context is called. Java layer will no longer send destroy notifications for objects garbage collected once a context is destroyed.
Diffstat (limited to 'libs/rs/rsElement.cpp')
-rw-r--r-- | libs/rs/rsElement.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/libs/rs/rsElement.cpp b/libs/rs/rsElement.cpp index b5267b3..e7ae247 100644 --- a/libs/rs/rsElement.cpp +++ b/libs/rs/rsElement.cpp @@ -22,13 +22,13 @@ using namespace android; using namespace android::renderscript; -Element::Element() +Element::Element(Context *rsc) : ObjectBase(rsc) { mComponents = NULL; mComponentCount = 0; } -Element::Element(uint32_t count) +Element::Element(Context *rsc, uint32_t count) : ObjectBase(rsc) { mComponents = new ObjectBaseRef<Component> [count]; mComponentCount = count; @@ -197,7 +197,8 @@ void rsi_ElementBegin(Context *rsc) void rsi_ElementAdd(Context *rsc, RsDataKind dk, RsDataType dt, bool isNormalized, size_t bits, const char *name) { ElementState * sec = &rsc->mStateElement; - Component *c = new Component(static_cast<Component::DataKind>(dk), + Component *c = new Component(rsc, + static_cast<Component::DataKind>(dk), static_cast<Component::DataType>(dt), isNormalized, bits, @@ -208,7 +209,7 @@ void rsi_ElementAdd(Context *rsc, RsDataKind dk, RsDataType dt, bool isNormalize RsElement rsi_ElementCreate(Context *rsc) { ElementState * sec = &rsc->mStateElement; - Element *se = new Element(sec->mComponentBuildList.size()); + Element *se = new Element(rsc, sec->mComponentBuildList.size()); for (size_t ct = 0; ct < se->getComponentCount(); ct++) { se->setComponent(ct, sec->mComponentBuildList[ct]); |