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 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_IMAGE_PROVIDER_ADAPTER_FLUTTER_IMAGE_PROVIDER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_IMAGE_PROVIDER_ADAPTER_FLUTTER_IMAGE_PROVIDER_H 18 19 #include "flutter/flow/skia_gpu_object.h" 20 #include "flutter/lib/ui/io_manager.h" 21 22 #include "core/components_ng/image_provider/image_provider.h" 23 24 namespace OHOS::Ace::NG { 25 26 struct FlutterRenderTaskHolder : public RenderTaskHolder { 27 DECLARE_ACE_TYPE(FlutterRenderTaskHolder, RenderTaskHolder); 28 29 public: FlutterRenderTaskHolderFlutterRenderTaskHolder30 FlutterRenderTaskHolder(fml::RefPtr<flutter::SkiaUnrefQueue> queue, fml::WeakPtr<flutter::IOManager> manager, 31 fml::RefPtr<fml::TaskRunner> taskRunner) 32 : unrefQueue(queue), ioManager(manager), ioTaskRunner(taskRunner) 33 {} 34 ~FlutterRenderTaskHolder() override = default; 35 36 fml::RefPtr<flutter::SkiaUnrefQueue> unrefQueue; 37 // weak reference of io manager must be check and used on io thread, because io manager is created on io thread. 38 fml::WeakPtr<flutter::IOManager> ioManager; 39 fml::RefPtr<fml::TaskRunner> ioTaskRunner; 40 }; 41 42 } // namespace OHOS::Ace::NG 43 44 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_IMAGE_PROVIDER_ADAPTER_FLUTTER_IMAGE_PROVIDER_H