1 /* 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef ALLOCATOR_MANAGER_H 16 #define ALLOCATOR_MANAGER_H 17 #include <memory> 18 #include "allocator.h" 19 namespace OHOS { 20 namespace HDI { 21 namespace DISPLAY { 22 class AllocatorManager { 23 public: GetInstance()24 static AllocatorManager& GetInstance() 25 { 26 static AllocatorManager instance; 27 return instance; 28 } 29 int32_t Init(); 30 int32_t DeInit(); 31 Allocator* GetAllocator(uint64_t usage); 32 33 private: 34 bool init_ = false; 35 std::shared_ptr<Allocator> frameBufferAllocator_ = nullptr; 36 std::shared_ptr<Allocator> allocator_ = nullptr; 37 }; 38 } 39 } 40 } 41 #endif // ALLOCATOR_MANAGER_H 42