blob: 586c0f33aa2a039bc47ba670e63b6f8524a1f619 [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef QUICHE_COMMON_QUICHE_SIMPLE_BUFFER_ALLOCATOR_H_
#define QUICHE_COMMON_QUICHE_SIMPLE_BUFFER_ALLOCATOR_H_
#include "common/platform/api/quiche_export.h"
#include "common/quiche_buffer_allocator.h"
namespace quiche {
// Provides buffer allocation using operators new[] and delete[] on char arrays.
// Note that some of the QUICHE code relies on this being the case for deleting
// new[]-allocated arrays from elsewhere.
class QUICHE_EXPORT_PRIVATE SimpleBufferAllocator
: public QuicheBufferAllocator {
public:
static SimpleBufferAllocator* Get() {
static SimpleBufferAllocator* singleton = new SimpleBufferAllocator();
return singleton;
}
char* New(size_t size) override;
char* New(size_t size, bool flag_enable) override;
void Delete(char* buffer) override;
};
} // namespace quiche
#endif // QUICHE_COMMON_QUICHE_SIMPLE_BUFFER_ALLOCATOR_H_