summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2016-01-26 10:50:10 -0800
committer John Reck <jreck@google.com> 2016-01-26 10:50:10 -0800
commit65182ccffc46a601bf22ffbbfa8df4e4df01102f (patch)
treecc0fed603c3b24ace9dfcf3a68ba52481c22afab
parent14de0415bb7c9a98b2585f92ce89fd8f3d2a53be (diff)
Fix tests
Disable FrameBuilder.clippedMerging as it relies on merged bitmap ops which was disabled in b/26793764 Fix Buffer to correctly initialize mRefs count Change-Id: I87d2fcc690a2ae14eaf751f650f522be5b622edf
-rw-r--r--libs/hwui/BufferPool.h13
-rw-r--r--libs/hwui/tests/unit/BufferPoolTests.cpp1
-rw-r--r--libs/hwui/tests/unit/FrameBuilderTests.cpp3
3 files changed, 12 insertions, 5 deletions
diff --git a/libs/hwui/BufferPool.h b/libs/hwui/BufferPool.h
index 9bda2333329d..005b399f603b 100644
--- a/libs/hwui/BufferPool.h
+++ b/libs/hwui/BufferPool.h
@@ -16,8 +16,9 @@
#pragma once
-#include <utils/RefBase.h>
-#include <utils/Log.h>
+#include "utils/RefBase.h"
+#include "utils/Log.h"
+#include "utils/Macros.h"
#include <atomic>
#include <stdint.h>
@@ -37,6 +38,7 @@ namespace uirenderer {
class BufferPool : public VirtualLightRefBase {
public:
class Buffer {
+ PREVENT_COPY_AND_ASSIGN(Buffer);
public:
int64_t* getBuffer() { return mBuffer.get(); }
size_t getSize() { return mSize; }
@@ -57,14 +59,17 @@ public:
return refs - 1;
}
+ bool isUniqueRef() {
+ return mRefs.load() == 1;
+ }
+
private:
friend class BufferPool;
- Buffer(BufferPool* pool, size_t size) {
+ Buffer(BufferPool* pool, size_t size) : mRefs(1) {
mSize = size;
mBuffer.reset(new int64_t[size]);
mPool = pool;
- mRefs++;
}
void setPool(BufferPool* pool) {
diff --git a/libs/hwui/tests/unit/BufferPoolTests.cpp b/libs/hwui/tests/unit/BufferPoolTests.cpp
index 09bd302333d3..44e6d3a0cbea 100644
--- a/libs/hwui/tests/unit/BufferPoolTests.cpp
+++ b/libs/hwui/tests/unit/BufferPoolTests.cpp
@@ -36,6 +36,7 @@ TEST(BufferPool, acquireThenRelease) {
ASSERT_EQ(bufferCount - i, pool->getAvailableBufferCount());
acquiredBuffers[i] = pool->acquire();
ASSERT_NE(nullptr, acquiredBuffers[i]);
+ ASSERT_TRUE(acquiredBuffers[i]->isUniqueRef());
}
for (size_t i = 0; i < bufferCount; i++) {
diff --git a/libs/hwui/tests/unit/FrameBuilderTests.cpp b/libs/hwui/tests/unit/FrameBuilderTests.cpp
index b51bd2ff99cf..cdbab2e3728d 100644
--- a/libs/hwui/tests/unit/FrameBuilderTests.cpp
+++ b/libs/hwui/tests/unit/FrameBuilderTests.cpp
@@ -215,7 +215,8 @@ TEST(FrameBuilder, simpleBatching) {
<< "Expect number of ops = 2 * loop count";
}
-TEST(FrameBuilder, clippedMerging) {
+// TODO: Disabled due to b/26793764
+TEST(FrameBuilder, DISABLED_clippedMerging) {
class ClippedMergingTestRenderer : public TestRendererBase {
public:
void onMergedBitmapOps(const MergedBakedOpList& opList) override {