@@ -74,82 +74,41 @@ class Rasterizer final : public SnapshotDelegate {
7474 // / Target time for the latest frame. See also `Shell::OnAnimatorBeginFrame`
7575 // / for when this time gets updated.
7676 virtual fml::TimePoint GetLatestFrameTargetTime () const = 0;
77- };
7877
79- // TODO(dnfield): remove once embedders have caught up.
80- class DummyDelegate : public Delegate {
81- void OnFrameRasterized (const FrameTiming&) override {}
82- fml::Milliseconds GetFrameBudget () override {
83- return fml::kDefaultFrameBudget ;
84- }
85- // Returning a time in the past so we don't add additional trace
86- // events when exceeding the frame budget for other embedders.
87- fml::TimePoint GetLatestFrameTargetTime () const override {
88- return fml::TimePoint::FromEpochDelta (fml::TimeDelta::Zero ());
89- }
90- };
78+ // / Task runners used by the shell.
79+ virtual const TaskRunners& GetTaskRunners () const = 0;
9180
92- // ----------------------------------------------------------------------------
93- // / @brief Creates a new instance of a rasterizer. Rasterizers may only
94- // / be created on the GPU task runner. Rasterizers are currently
95- // / only created by the shell. Usually, the shell also sets itself
96- // / up as the rasterizer delegate. But, this constructor sets up a
97- // / dummy rasterizer delegate.
98- // /
99- // TODO(chinmaygarde): The rasterizer does not use the task runners for
100- // anything other than thread checks. Remove the same as an argument.
101- // /
102- // / @param[in] task_runners The task runners used by the shell.
103- // / @param[in] compositor_context The compositor context used to hold all
104- // / the GPU state used by the rasterizer.
105- // / @param[in] is_gpu_disabled_sync_switch
106- // / A `SyncSwitch` for handling disabling of the GPU (typically happens
107- // / when an app is backgrounded)
108- // /
109- Rasterizer (TaskRunners task_runners,
110- std::unique_ptr<flutter::CompositorContext> compositor_context,
111- std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch);
81+ // / Accessor for the shell's GPU sync switch, which determines whether GPU
82+ // / operations are allowed on the current thread.
83+ // /
84+ // / For example, on some platforms when the application is backgrounded it
85+ // / is critical that GPU operations are not processed.
86+ virtual std::shared_ptr<fml::SyncSwitch> GetIsGpuDisabledSyncSwitch ()
87+ const = 0;
88+ };
11289
11390 // ----------------------------------------------------------------------------
11491 // / @brief Creates a new instance of a rasterizer. Rasterizers may only
11592 // / be created on the GPU task runner. Rasterizers are currently
11693 // / only created by the shell (which also sets itself up as the
11794 // / rasterizer delegate).
11895 // /
119- // TODO(chinmaygarde): The rasterizer does not use the task runners for
120- // anything other than thread checks. Remove the same as an argument.
121- // /
12296 // / @param[in] delegate The rasterizer delegate.
123- // / @param[in] task_runners The task runners used by the shell.
124- // / @param[in] is_gpu_disabled_sync_switch
125- // / A `SyncSwitch` for handling disabling of the GPU (typically happens
126- // / when an app is backgrounded)
12797 // /
128- Rasterizer (Delegate& delegate,
129- TaskRunners task_runners,
130- std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch);
98+ Rasterizer (Delegate& delegate);
13199
132100 // ----------------------------------------------------------------------------
133101 // / @brief Creates a new instance of a rasterizer. Rasterizers may only
134102 // / be created on the GPU task runner. Rasterizers are currently
135103 // / only created by the shell (which also sets itself up as the
136104 // / rasterizer delegate).
137105 // /
138- // TODO(chinmaygarde): The rasterizer does not use the task runners for
139- // anything other than thread checks. Remove the same as an argument.
140- // /
141106 // / @param[in] delegate The rasterizer delegate.
142- // / @param[in] task_runners The task runners used by the shell.
143107 // / @param[in] compositor_context The compositor context used to hold all
144108 // / the GPU state used by the rasterizer.
145- // / @param[in] is_gpu_disabled_sync_switch
146- // / A `SyncSwitch` for handling disabling of the GPU (typically happens
147- // / when an app is backgrounded)
148109 // /
149110 Rasterizer (Delegate& delegate,
150- TaskRunners task_runners,
151- std::unique_ptr<flutter::CompositorContext> compositor_context,
152- std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch);
111+ std::unique_ptr<flutter::CompositorContext> compositor_context);
153112
154113 // ----------------------------------------------------------------------------
155114 // / @brief Destroys the rasterizer. This must happen on the GPU task
@@ -432,7 +391,6 @@ class Rasterizer final : public SnapshotDelegate {
432391
433392 private:
434393 Delegate& delegate_;
435- TaskRunners task_runners_;
436394 std::unique_ptr<Surface> surface_;
437395 std::unique_ptr<flutter::CompositorContext> compositor_context_;
438396 // This is the last successfully rasterized layer tree.
@@ -446,7 +404,6 @@ class Rasterizer final : public SnapshotDelegate {
446404 std::optional<size_t > max_cache_bytes_;
447405 fml::TaskRunnerAffineWeakPtrFactory<Rasterizer> weak_factory_;
448406 fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
449- std::shared_ptr<fml::SyncSwitch> is_gpu_disabled_sync_switch_;
450407
451408 // |SnapshotDelegate|
452409 sk_sp<SkImage> MakeRasterSnapshot (sk_sp<SkPicture> picture,
0 commit comments