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 | e514b45de8561fbc6ef6770845102ca10b0a69d7 (patch) | |
| tree | 572fdc8b1dbc14b53c61f9c81f90fbc642024b45 /rsElement.cpp | |
| parent | 86f1b23aaaf9b8822a009d8c3e585e46768abb6a (diff) | |
| download | android_frameworks_rs-e514b45de8561fbc6ef6770845102ca10b0a69d7.tar.gz android_frameworks_rs-e514b45de8561fbc6ef6770845102ca10b0a69d7.tar.bz2 android_frameworks_rs-e514b45de8561fbc6ef6770845102ca10b0a69d7.zip | |
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 'rsElement.cpp')
| -rw-r--r-- | rsElement.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/rsElement.cpp b/rsElement.cpp index b5267b36..e7ae2474 100644 --- a/rsElement.cpp +++ b/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]); |
