1 /* 2 * Copyright (c) 2021-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 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_FACTORIES_FLUTTER_NODE_FACTORY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_FACTORIES_FLUTTER_NODE_FACTORY_H 18 19 #include <list> 20 #include <string> 21 22 #include "base/memory/ace_type.h" 23 #include "core/pipeline/base/factories/render_node_factory.h" 24 25 namespace OHOS::Ace { 26 27 constexpr size_t TEXT_CACHE_SIZE = 100; 28 constexpr size_t IMAGE_CACHE_SIZE = 100; 29 constexpr size_t BOX_CACHE_SIZE = 200; 30 31 class FlutterTextFactory final : public virtual RenderNodeFactory { 32 DECLARE_ACE_TYPE(FlutterTextFactory, RenderNodeFactory); 33 34 public: FlutterTextFactory()35 FlutterTextFactory(): RenderNodeFactory(TEXT_CACHE_SIZE) {} 36 37 ACE_DISALLOW_COPY_AND_MOVE(FlutterTextFactory); 38 }; 39 40 class FlutterImageFactory final : public virtual RenderNodeFactory { 41 DECLARE_ACE_TYPE(FlutterImageFactory, RenderNodeFactory); 42 43 public: FlutterImageFactory()44 FlutterImageFactory(): RenderNodeFactory(IMAGE_CACHE_SIZE) {} 45 46 ACE_DISALLOW_COPY_AND_MOVE(FlutterImageFactory); 47 }; 48 49 class FlutterBoxFactory final : public virtual RenderNodeFactory { 50 DECLARE_ACE_TYPE(FlutterBoxFactory, RenderNodeFactory); 51 52 public: FlutterBoxFactory()53 FlutterBoxFactory(): RenderNodeFactory(BOX_CACHE_SIZE) {} 54 55 ACE_DISALLOW_COPY_AND_MOVE(FlutterBoxFactory); 56 }; 57 58 } // namespace OHOS::Ace 59 60 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_BASE_FACTORIES_FLUTTER_NODE_FACTORY_H 61