| 1 | // Copyright 2013 The Flutter Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef FLUTTER_LIB_UI_IO_MANAGER_H_ |
| 6 | #define FLUTTER_LIB_UI_IO_MANAGER_H_ |
| 7 | |
| 8 | #include "flutter/flow/skia_gpu_object.h" |
| 9 | #include "flutter/fml/memory/weak_ptr.h" |
| 10 | #include "flutter/fml/synchronization/sync_switch.h" |
| 11 | #include "third_party/skia/include/gpu/GrDirectContext.h" |
| 12 | |
| 13 | namespace impeller { |
| 14 | class Context; |
| 15 | } // namespace impeller |
| 16 | |
| 17 | namespace flutter { |
| 18 | // Interface for methods that manage access to the resource GrDirectContext and |
| 19 | // Skia unref queue. Meant to be implemented by the owner of the resource |
| 20 | // GrDirectContext, i.e. the shell's IOManager. |
| 21 | class IOManager { |
| 22 | public: |
| 23 | virtual ~IOManager() = default; |
| 24 | |
| 25 | virtual fml::WeakPtr<IOManager> GetWeakIOManager() const = 0; |
| 26 | |
| 27 | virtual fml::WeakPtr<GrDirectContext> GetResourceContext() const = 0; |
| 28 | |
| 29 | virtual fml::RefPtr<flutter::SkiaUnrefQueue> GetSkiaUnrefQueue() const = 0; |
| 30 | |
| 31 | virtual std::shared_ptr<const fml::SyncSwitch> |
| 32 | GetIsGpuDisabledSyncSwitch() = 0; |
| 33 | |
| 34 | virtual std::shared_ptr<impeller::Context> GetImpellerContext() const; |
| 35 | }; |
| 36 | |
| 37 | } // namespace flutter |
| 38 | |
| 39 | #endif // FLUTTER_LIB_UI_IO_MANAGER_H_ |
| 40 | |