5#include "flutter/shell/common/shell_io_manager.h"
9#include "flutter/fml/message_loop.h"
10#include "flutter/shell/common/context_options.h"
30 context->setResourceCacheLimit(0);
40 std::shared_ptr<const fml::SyncSwitch> is_gpu_disabled_sync_switch,
42 std::shared_ptr<impeller::Context> impeller_context,
44 : resource_context_(
std::move(resource_context)),
45 resource_context_weak_factory_(
48 resource_context_.
get())
51 std::move(unref_queue_task_runner),
52 unref_queue_drain_delay,
55 is_gpu_disabled_sync_switch_(
std::move(is_gpu_disabled_sync_switch)),
56 impeller_context_(
std::move(impeller_context)),
58 if (!resource_context_) {
60 FML_DLOG(WARNING) <<
"The IO manager was initialized without a resource "
61 "context. Async texture uploads will be disabled. "
62 "Expect performance degradation.";
70 is_gpu_disabled_sync_switch_->Execute(
79 if (!resource_context_) {
86 resource_context_ = std::move(resource_context);
87 resource_context_weak_factory_ =
89 ? std::make_unique<fml::WeakPtrFactory<GrDirectContext>>(
90 resource_context_.
get())
92 unref_queue_->UpdateResourceContext(resource_context_);
96 return weak_factory_.GetWeakPtr();
101 return resource_context_weak_factory_
102 ? resource_context_weak_factory_->GetWeakPtr()
113 return weak_factory_.GetWeakPtr();
117std::shared_ptr<const fml::SyncSwitch>
119 return is_gpu_disabled_sync_switch_;
124 return impeller_context_;
fml::WeakPtr< ShellIOManager > GetWeakPtr()
ShellIOManager(sk_sp< GrDirectContext > resource_context, std::shared_ptr< const fml::SyncSwitch > is_gpu_disabled_sync_switch, fml::RefPtr< fml::TaskRunner > unref_queue_task_runner, std::shared_ptr< impeller::Context > impeller_context, fml::TimeDelta unref_queue_drain_delay=fml::TimeDelta::FromMilliseconds(8))
static sk_sp< GrDirectContext > CreateCompatibleResourceLoadingContext(GrBackendApi backend, const sk_sp< const GrGLInterface > &gl_interface)
fml::RefPtr< flutter::SkiaUnrefQueue > GetSkiaUnrefQueue() const override
void UpdateResourceContext(sk_sp< GrDirectContext > resource_context)
~ShellIOManager() override
std::shared_ptr< const fml::SyncSwitch > GetIsGpuDisabledSyncSwitch() override
void NotifyResourceContextAvailable(sk_sp< GrDirectContext > resource_context)
std::shared_ptr< impeller::Context > GetImpellerContext() const override
fml::WeakPtr< IOManager > GetWeakIOManager() const override
fml::WeakPtr< GrDirectContext > GetResourceContext() const override
#define FML_DLOG(severity)
SK_API sk_sp< GrDirectContext > MakeGL(sk_sp< const GrGLInterface >, const GrContextOptions &)
GrContextOptions MakeDefaultContextOptions(ContextType type, std::optional< GrBackendApi > api)
Initializes GrContextOptions with values suitable for Flutter. The options can be further tweaked bef...
RefPtr< T > MakeRefCounted(Args &&... args)
const myers::Point & get(const myers::Segment &)
Represents the 2 code paths available when calling |SyncSwitch::Execute|.