Make RingBufferAllocator explicit.

This CL makes RingBufferAllocator explicit and fixes up the two call
sites.

Bug: dawn:1339
Change-Id: I8e6fe4f41a2031fafaaa281255ee242331c24306
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86870
Reviewed-by: Ben Clayton <bclayton@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Dan Sinclair <dsinclair@chromium.org>
Auto-Submit: Dan Sinclair <dsinclair@chromium.org>
This commit is contained in:
dan sinclair 2022-04-19 20:26:34 +00:00 committed by Dawn LUCI CQ
parent 609496d4fb
commit ebdb70b81d
2 changed files with 5 additions and 5 deletions

View File

@ -19,8 +19,8 @@
namespace dawn::native {
DynamicUploader::DynamicUploader(DeviceBase* device) : mDevice(device) {
mRingBuffers.emplace_back(
std::unique_ptr<RingBuffer>(new RingBuffer{nullptr, {kRingBufferSize}}));
mRingBuffers.emplace_back(std::unique_ptr<RingBuffer>(
new RingBuffer{nullptr, RingBufferAllocator(kRingBufferSize)}));
}
void DynamicUploader::ReleaseStagingBuffer(std::unique_ptr<StagingBufferBase> stagingBuffer) {
@ -66,8 +66,8 @@ namespace dawn::native {
// Upon failure, append a newly created ring buffer to fulfill the
// request.
if (startOffset == RingBufferAllocator::kInvalidOffset) {
mRingBuffers.emplace_back(
std::unique_ptr<RingBuffer>(new RingBuffer{nullptr, {kRingBufferSize}}));
mRingBuffers.emplace_back(std::unique_ptr<RingBuffer>(
new RingBuffer{nullptr, RingBufferAllocator(kRingBufferSize)}));
targetRingBuffer = mRingBuffers.back().get();
startOffset = targetRingBuffer->mAllocator.Allocate(allocationSize, serial);

View File

@ -27,7 +27,7 @@ namespace dawn::native {
class RingBufferAllocator {
public:
RingBufferAllocator() = default;
RingBufferAllocator(uint64_t maxSize);
explicit RingBufferAllocator(uint64_t maxSize);
~RingBufferAllocator() = default;
RingBufferAllocator(const RingBufferAllocator&) = default;
RingBufferAllocator& operator=(const RingBufferAllocator&) = default;