summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java
diff options
context:
space:
mode:
authornicolasroard <nicolasroard@google.com>2013-09-08 23:14:57 -0700
committernicolasroard <nicolasroard@google.com>2013-09-08 23:23:28 -0700
commitec1e009a7faea0478e361bc2d48d856ab48a0209 (patch)
tree3898839dddb1b2c14ca2d4bad74cf73addf4cb87 /src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java
parent34cfdfcd1867fff67fffbbac7a8e942485f08ea1 (diff)
downloadandroid_packages_apps_Gallery2-ec1e009a7faea0478e361bc2d48d856ab48a0209.tar.gz
android_packages_apps_Gallery2-ec1e009a7faea0478e361bc2d48d856ab48a0209.tar.bz2
android_packages_apps_Gallery2-ec1e009a7faea0478e361bc2d48d856ab48a0209.zip
Improves memory management
Also adds some debugging tracking tools. bug:10112287 Change-Id: I3f9b3d173db99818e5c9ae9a62b0ec38cd2b341b
Diffstat (limited to 'src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java')
-rw-r--r--src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java b/src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java
index 871e4cd6c..267315ccd 100644
--- a/src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java
+++ b/src/com/android/gallery3d/filtershow/pipeline/SharedBuffer.java
@@ -30,15 +30,20 @@ public class SharedBuffer {
private volatile boolean mNeedsRepaint = true;
public void setProducer(Bitmap producer) {
+ removeProducer();
+ Buffer buffer = new Buffer(producer);
+ synchronized (this) {
+ mProducer = buffer;
+ }
+ }
+
+ public void removeProducer() {
synchronized (this) {
if (mProducer != null) {
mProducer.remove();
+ mProducer = null;
}
}
- Buffer buffer = new Buffer(producer);
- synchronized (this) {
- mProducer = buffer;
- }
}
public synchronized Buffer getProducer() {