mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00
Remove Allocator.release(Allocation[]) and references
PiperOrigin-RevId: 421530365
This commit is contained in:
parent
f40f290a30
commit
1022812dab
@ -50,13 +50,6 @@ public interface Allocator {
|
|||||||
*/
|
*/
|
||||||
void release(Allocation allocation);
|
void release(Allocation allocation);
|
||||||
|
|
||||||
/**
|
|
||||||
* Releases an array of {@link Allocation Allocations} back to the allocator.
|
|
||||||
*
|
|
||||||
* @param allocations The array of {@link Allocation}s being released.
|
|
||||||
*/
|
|
||||||
void release(Allocation[] allocations);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Releases all {@link Allocation Allocations} in the chain starting at the given {@link
|
* Releases all {@link Allocation Allocations} in the chain starting at the given {@link
|
||||||
* AllocationNode}.
|
* AllocationNode}.
|
||||||
|
@ -33,7 +33,6 @@ public final class DefaultAllocator implements Allocator {
|
|||||||
private final boolean trimOnReset;
|
private final boolean trimOnReset;
|
||||||
private final int individualAllocationSize;
|
private final int individualAllocationSize;
|
||||||
@Nullable private final byte[] initialAllocationBlock;
|
@Nullable private final byte[] initialAllocationBlock;
|
||||||
private final Allocation[] singleAllocationReleaseHolder;
|
|
||||||
|
|
||||||
private int targetBufferSize;
|
private int targetBufferSize;
|
||||||
private int allocatedCount;
|
private int allocatedCount;
|
||||||
@ -78,7 +77,6 @@ public final class DefaultAllocator implements Allocator {
|
|||||||
} else {
|
} else {
|
||||||
initialAllocationBlock = null;
|
initialAllocationBlock = null;
|
||||||
}
|
}
|
||||||
singleAllocationReleaseHolder = new Allocation[1];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public synchronized void reset() {
|
public synchronized void reset() {
|
||||||
@ -116,16 +114,8 @@ public final class DefaultAllocator implements Allocator {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public synchronized void release(Allocation allocation) {
|
public synchronized void release(Allocation allocation) {
|
||||||
singleAllocationReleaseHolder[0] = allocation;
|
availableAllocations[availableCount++] = allocation;
|
||||||
release(singleAllocationReleaseHolder);
|
allocatedCount--;
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void release(Allocation[] allocations) {
|
|
||||||
for (Allocation allocation : allocations) {
|
|
||||||
availableAllocations[availableCount++] = allocation;
|
|
||||||
}
|
|
||||||
allocatedCount -= allocations.length;
|
|
||||||
// Wake up threads waiting for the allocated size to drop.
|
// Wake up threads waiting for the allocated size to drop.
|
||||||
notifyAll();
|
notifyAll();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user