Flutter Engine
rasterizer.h
Go to the documentation of this file.
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 SHELL_COMMON_RASTERIZER_H_
6 #define SHELL_COMMON_RASTERIZER_H_
7 
8 #include <memory>
9 #include <optional>
10 
11 #include "flutter/common/settings.h"
12 #include "flutter/common/task_runners.h"
13 #include "flutter/flow/compositor_context.h"
14 #include "flutter/flow/embedded_views.h"
15 #include "flutter/flow/frame_timings.h"
16 #include "flutter/flow/layers/layer_tree.h"
17 #include "flutter/flow/surface.h"
18 #include "flutter/fml/closure.h"
19 #include "flutter/fml/memory/weak_ptr.h"
20 #include "flutter/fml/raster_thread_merger.h"
21 #include "flutter/fml/synchronization/sync_switch.h"
22 #include "flutter/fml/synchronization/waitable_event.h"
23 #include "flutter/fml/time/time_delta.h"
24 #include "flutter/fml/time/time_point.h"
25 #include "flutter/lib/ui/snapshot_delegate.h"
26 #include "flutter/shell/common/pipeline.h"
27 #include "flutter/shell/common/snapshot_surface_producer.h"
28 
29 namespace flutter {
30 
31 //------------------------------------------------------------------------------
32 /// The rasterizer is a component owned by the shell that resides on the raster
33 /// task runner. Each shell owns exactly one instance of a rasterizer. The
34 /// rasterizer may only be created, used and collected on the raster task
35 /// runner.
36 ///
37 /// The rasterizer owns the instance of the currently active on-screen render
38 /// surface. On this surface, it renders the contents of layer trees submitted
39 /// to it by the `Engine` (which lives on the UI task runner).
40 ///
41 /// The primary components owned by the rasterizer are the compositor context
42 /// and the on-screen render surface. The compositor context has all the GPU
43 /// state necessary to render frames to the render surface.
44 ///
45 class Rasterizer final : public SnapshotDelegate {
46  public:
47  //----------------------------------------------------------------------------
48  /// @brief Used to forward events from the rasterizer to interested
49  /// subsystems. Currently, the shell sets itself up as the
50  /// rasterizer delegate to listen for frame rasterization events.
51  /// It can then forward these events to the engine.
52  ///
53  /// Like all rasterizer operation, the rasterizer delegate call
54  /// are made on the raster task runner. Any delegate must ensure
55  /// that they can handle the threading implications.
56  ///
57  class Delegate {
58  public:
59  //--------------------------------------------------------------------------
60  /// @brief Notifies the delegate that a frame has been rendered. The
61  /// rasterizer collects profiling information for each part of
62  /// the frame workload. This profiling information is made
63  /// available to the delegate for forwarding to subsystems
64  /// interested in collecting such profiles. Currently, the shell
65  /// (the delegate) forwards this to the engine where Dart code
66  /// can react to this information.
67  ///
68  /// @see `FrameTiming`
69  ///
70  /// @param[in] frame_timing Instrumentation information for each phase of
71  /// the frame workload.
72  ///
73  virtual void OnFrameRasterized(const FrameTiming& frame_timing) = 0;
74 
75  /// Time limit for a smooth frame.
76  ///
77  /// See: `DisplayManager::GetMainDisplayRefreshRate`.
78  virtual fml::Milliseconds GetFrameBudget() = 0;
79 
80  /// Target time for the latest frame. See also `Shell::OnAnimatorBeginFrame`
81  /// for when this time gets updated.
82  virtual fml::TimePoint GetLatestFrameTargetTime() const = 0;
83 
84  /// Task runners used by the shell.
85  virtual const TaskRunners& GetTaskRunners() const = 0;
86 
87  /// The raster thread merger from parent shell's rasterizer.
89  GetParentRasterThreadMerger() const = 0;
90 
91  /// Accessor for the shell's GPU sync switch, which determines whether GPU
92  /// operations are allowed on the current thread.
93  ///
94  /// For example, on some platforms when the application is backgrounded it
95  /// is critical that GPU operations are not processed.
96  virtual std::shared_ptr<const fml::SyncSwitch> GetIsGpuDisabledSyncSwitch()
97  const = 0;
98  };
99 
100  //----------------------------------------------------------------------------
101  /// @brief Creates a new instance of a rasterizer. Rasterizers may only
102  /// be created on the raster task runner. Rasterizers are
103  /// currently only created by the shell (which also sets itself up
104  /// as the rasterizer delegate).
105  ///
106  /// @param[in] delegate The rasterizer delegate.
107  ///
108  Rasterizer(Delegate& delegate);
109 
110  //----------------------------------------------------------------------------
111  /// @brief Destroys the rasterizer. This must happen on the raster task
112  /// runner. All GPU resources are collected before this call
113  /// returns. Any context set up by the embedder to hold these
114  /// resources can be immediately collected as well.
115  ///
116  ~Rasterizer();
117 
118  //----------------------------------------------------------------------------
119  /// @brief Rasterizers may be created well before an on-screen surface is
120  /// available for rendering. Shells usually create a rasterizer in
121  /// their constructors. Once an on-screen surface is available
122  /// however, one may be provided to the rasterizer using this
123  /// call. No rendering may occur before this call. The surface is
124  /// held till the balancing call to `Rasterizer::Teardown` is
125  /// made. Calling a setup before tearing down the previous surface
126  /// (if this is not the first time the surface has been set up) is
127  /// user error.
128  ///
129  /// @see `Rasterizer::Teardown`
130  ///
131  /// @param[in] surface The on-screen render surface.
132  ///
133  void Setup(std::unique_ptr<Surface> surface);
134 
135  //----------------------------------------------------------------------------
136  /// @brief Releases the previously set up on-screen render surface and
137  /// collects associated resources. No more rendering may occur
138  /// till the next call to `Rasterizer::Setup` with a new render
139  /// surface. Calling a teardown without a setup is user error.
140  ///
141  void Teardown();
142 
143  //----------------------------------------------------------------------------
144  /// @brief Notifies the rasterizer that there is a low memory situation
145  /// and it must purge as many unnecessary resources as possible.
146  /// Currently, the Skia context associated with onscreen rendering
147  /// is told to free GPU resources.
148  ///
149  void NotifyLowMemoryWarning() const;
150 
151  //----------------------------------------------------------------------------
152  /// @brief Gets a weak pointer to the rasterizer. The rasterizer may only
153  /// be accessed on the raster task runner.
154  ///
155  /// @return The weak pointer to the rasterizer.
156  ///
158 
160 
161  //----------------------------------------------------------------------------
162  /// @brief Sometimes, it may be necessary to render the same frame again
163  /// without having to wait for the framework to build a whole new
164  /// layer tree describing the same contents. One such case is when
165  /// external textures (video or camera streams for example) are
166  /// updated in an otherwise static layer tree. To support this use
167  /// case, the rasterizer holds onto the last rendered layer tree.
168  ///
169  /// @bug https://github.com/flutter/flutter/issues/33939
170  ///
171  /// @return A pointer to the last layer or `nullptr` if this rasterizer
172  /// has never rendered a frame.
173  ///
175 
176  //----------------------------------------------------------------------------
177  /// @brief Draws a last layer tree to the render surface. This may seem
178  /// entirely redundant at first glance. After all, on surface loss
179  /// and re-acquisition, the framework generates a new layer tree.
180  /// Otherwise, why render the same contents to the screen again?
181  /// This is used as an optimization in cases where there are
182  /// external textures (video or camera streams for example) in
183  /// referenced in the layer tree. These textures may be updated at
184  /// a cadence different from that of the Flutter application.
185  /// Flutter can re-render the layer tree with just the updated
186  /// textures instead of waiting for the framework to do the work
187  /// to generate the layer tree describing the same contents.
188  ///
189  void DrawLastLayerTree(
190  std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder);
191 
192  //----------------------------------------------------------------------------
193  /// @brief Gets the registry of external textures currently in use by the
194  /// rasterizer. These textures may be updated at a cadence
195  /// different from that of the Flutter application. When an
196  /// external texture is referenced in the Flutter layer tree, that
197  /// texture is composited within the Flutter layer tree.
198  ///
199  /// @return A pointer to the external texture registry.
200  ///
202 
203  using LayerTreeDiscardCallback = std::function<bool(flutter::LayerTree&)>;
204 
205  //----------------------------------------------------------------------------
206  /// @brief Takes the next item from the layer tree pipeline and executes
207  /// the raster thread frame workload for that pipeline item to
208  /// render a frame on the on-screen surface.
209  ///
210  /// Why does the draw call take a layer tree pipeline and not the
211  /// layer tree directly?
212  ///
213  /// The pipeline is the way book-keeping of frame workloads
214  /// distributed across the multiple threads is managed. The
215  /// rasterizer deals with the pipelines directly (instead of layer
216  /// trees which is what it actually renders) because the pipeline
217  /// consumer's workload must be accounted for within the pipeline
218  /// itself. If the rasterizer took the layer tree directly, it
219  /// would have to be taken out of the pipeline. That would signal
220  /// the end of the frame workload and the pipeline would be ready
221  /// for new frames. But the last frame has not been rendered by
222  /// the frame yet! On the other hand, the pipeline must own the
223  /// layer tree it renders because it keeps a reference to the last
224  /// layer tree around till a new frame is rendered. So a simple
225  /// reference wont work either. The `Rasterizer::DoDraw` method
226  /// actually performs the GPU operations within the layer tree
227  /// pipeline.
228  ///
229  /// @see `Rasterizer::DoDraw`
230  ///
231  /// @param[in] pipeline The layer tree pipeline to take the next layer tree
232  /// to render from.
233  /// @param[in] discard_callback if specified and returns true, the layer tree
234  /// is discarded instead of being rendered
235  ///
237  std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder,
238  std::shared_ptr<Pipeline<flutter::LayerTree>> pipeline,
239  LayerTreeDiscardCallback discard_callback = NoDiscard);
240 
241  //----------------------------------------------------------------------------
242  /// @brief The type of the screenshot to obtain of the previously
243  /// rendered layer tree.
244  ///
245  enum class ScreenshotType {
246  //--------------------------------------------------------------------------
247  /// A format used to denote a Skia picture. A Skia picture is a serialized
248  /// representation of an `SkPicture` that can be used to introspect the
249  /// series of commands used to draw that picture.
250  ///
251  /// Skia pictures are typically stored as files with the .skp extension on
252  /// disk. These files may be viewed in an interactive debugger available at
253  /// https://debugger.skia.org/
254  ///
255  SkiaPicture,
256 
257  //--------------------------------------------------------------------------
258  /// A format used to denote uncompressed image data. This format
259  /// is 32 bits per pixel, 8 bits per component and
260  /// denoted by the `kN32_SkColorType ` Skia color type.
261  ///
262  UncompressedImage,
263 
264  //--------------------------------------------------------------------------
265  /// A format used to denote compressed image data. The PNG compressed
266  /// container is used.
267  ///
268  CompressedImage,
269  };
270 
271  //----------------------------------------------------------------------------
272  /// @brief A POD type used to return the screenshot data along with the
273  /// size of the frame.
274  ///
275  struct Screenshot {
276  //--------------------------------------------------------------------------
277  /// The data used to describe the screenshot. The data format depends on the
278  /// type of screenshot taken and any further encoding done to the same.
279  ///
280  /// @see `ScreenshotType`
281  ///
282  sk_sp<SkData> data;
283 
284  //--------------------------------------------------------------------------
285  /// The size of the screenshot in texels.
286  ///
287  SkISize frame_size = SkISize::MakeEmpty();
288 
289  //--------------------------------------------------------------------------
290  /// @brief Creates an empty screenshot
291  ///
292  Screenshot();
293 
294  //--------------------------------------------------------------------------
295  /// @brief Creates a screenshot with the specified data and size.
296  ///
297  /// @param[in] p_data The screenshot data
298  /// @param[in] p_size The screenshot size.
299  ///
300  Screenshot(sk_sp<SkData> p_data, SkISize p_size);
301 
302  //--------------------------------------------------------------------------
303  /// @brief The copy constructor for a screenshot.
304  ///
305  /// @param[in] other The screenshot to copy from.
306  ///
307  Screenshot(const Screenshot& other);
308 
309  //--------------------------------------------------------------------------
310  /// @brief Destroys the screenshot object and releases underlying data.
311  ///
312  ~Screenshot();
313  };
314 
315  //----------------------------------------------------------------------------
316  /// @brief Screenshots the last layer tree to one of the supported
317  /// screenshot types and optionally Base 64 encodes that data for
318  /// easier transmission and packaging (usually over the service
319  /// protocol for instrumentation tools running on the host).
320  ///
321  /// @param[in] type The type of the screenshot to gather.
322  /// @param[in] base64_encode Whether Base 64 encoding must be applied to the
323  /// data after a screenshot has been captured.
324  ///
325  /// @return A non-empty screenshot if one could be captured. A screenshot
326  /// capture may fail if there were no layer trees previously
327  /// rendered by this rasterizer, or, due to an unspecified
328  /// internal error. Internal error will be logged to the console.
329  ///
331 
332  //----------------------------------------------------------------------------
333  /// @brief Sets a callback that will be executed when the next layer tree
334  /// in rendered to the on-screen surface. This is used by
335  /// embedders to listen for one time operations like listening for
336  /// when the first frame is rendered so that they may hide splash
337  /// screens.
338  ///
339  /// The callback is only executed once and dropped on the GPU
340  /// thread when executed (lambda captures must be able to deal
341  /// with the threading repercussions of this behavior).
342  ///
343  /// @param[in] callback The callback to execute when the next layer tree is
344  /// rendered on-screen.
345  ///
347 
348  //----------------------------------------------------------------------------
349  /// @brief Set the External View Embedder. This is done on shell
350  /// initialization. This is non-null on platforms that support
351  /// embedding externally composited views.
352  ///
353  /// @param[in] view_embedder The external view embedder object.
354  ///
356  const std::shared_ptr<ExternalViewEmbedder>& view_embedder);
357 
358  //----------------------------------------------------------------------------
359  /// @brief Set the snapshot surface producer. This is done on shell
360  /// initialization. This is non-null on platforms that support taking
361  /// GPU accelerated raster snapshots in the background.
362  ///
363  /// @param[in] producer A surface producer for raster snapshotting when the
364  /// onscreen surface is not available.
365  ///
367  std::unique_ptr<SnapshotSurfaceProducer> producer);
368 
369  //----------------------------------------------------------------------------
370  /// @brief Returns a pointer to the compositor context used by this
371  /// rasterizer. This pointer will never be `nullptr`.
372  ///
373  /// @return The compositor context used by this rasterizer.
374  ///
376  return compositor_context_.get();
377  }
378 
379  //----------------------------------------------------------------------------
380  /// @brief Returns the raster thread merger used by this rasterizer.
381  /// This may be `nullptr`.
382  ///
383  /// @return The raster thread merger used by this rasterizer.
384  ///
386 
387  //----------------------------------------------------------------------------
388  /// @brief Skia has no notion of time. To work around the performance
389  /// implications of this, it may cache GPU resources to reference
390  /// them from one frame to the next. Using this call, embedders
391  /// may set the maximum bytes cached by Skia in its caches
392  /// dedicated to on-screen rendering.
393  ///
394  /// @attention This cache setting will be invalidated when the surface is
395  /// torn down via `Rasterizer::Teardown`. This call must be made
396  /// again with new limits after surface re-acquisition.
397  ///
398  /// @attention This cache does not describe the entirety of GPU resources
399  /// that may be cached. The `RasterCache` also holds very large
400  /// GPU resources.
401  ///
402  /// @see `RasterCache`
403  ///
404  /// @param[in] max_bytes The maximum byte size of resource that may be
405  /// cached for GPU rendering.
406  /// @param[in] from_user Whether this request was from user code, e.g. via
407  /// the flutter/skia message channel, in which case
408  /// it should not be overridden by the platform.
409  ///
410  void SetResourceCacheMaxBytes(size_t max_bytes, bool from_user);
411 
412  //----------------------------------------------------------------------------
413  /// @brief The current value of Skia's resource cache size, if a surface
414  /// is present.
415  ///
416  /// @attention This cache does not describe the entirety of GPU resources
417  /// that may be cached. The `RasterCache` also holds very large
418  /// GPU resources.
419  ///
420  /// @see `RasterCache`
421  ///
422  /// @return The size of Skia's resource cache, if available.
423  ///
424  std::optional<size_t> GetResourceCacheMaxBytes() const;
425 
426  //----------------------------------------------------------------------------
427  /// @brief Enables the thread merger if the external view embedder
428  /// supports dynamic thread merging.
429  ///
430  /// @attention This method is thread-safe. When the thread merger is enabled,
431  /// the raster task queue can run in the platform thread at any
432  /// time.
433  ///
434  /// @see `ExternalViewEmbedder`
435  ///
437 
438  //----------------------------------------------------------------------------
439  /// @brief Disables the thread merger if the external view embedder
440  /// supports dynamic thread merging.
441  ///
442  /// @attention This method is thread-safe. When the thread merger is
443  /// disabled, the raster task queue will continue to run in the
444  /// same thread until |EnableThreadMergerIfNeeded| is called.
445  ///
446  /// @see `ExternalViewEmbedder`
447  ///
449 
450  private:
452  std::unique_ptr<Surface> surface_;
453  std::unique_ptr<SnapshotSurfaceProducer> snapshot_surface_producer_;
454  std::unique_ptr<flutter::CompositorContext> compositor_context_;
455  // This is the last successfully rasterized layer tree.
456  std::unique_ptr<flutter::LayerTree> last_layer_tree_;
457  // Set when we need attempt to rasterize the layer tree again. This layer_tree
458  // has not successfully rasterized. This can happen due to the change in the
459  // thread configuration. This will be inserted to the front of the pipeline.
460  std::unique_ptr<flutter::LayerTree> resubmitted_layer_tree_;
461  fml::closure next_frame_callback_;
462  bool user_override_resource_cache_bytes_;
463  std::optional<size_t> max_cache_bytes_;
464  fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger_;
466  std::shared_ptr<ExternalViewEmbedder> external_view_embedder_;
467  // |SnapshotDelegate|
468  sk_sp<SkImage> MakeRasterSnapshot(
469  std::function<void(SkCanvas*)> draw_callback,
470  SkISize picture_size) override;
471 
472  // |SnapshotDelegate|
473  sk_sp<SkImage> MakeRasterSnapshot(sk_sp<SkPicture> picture,
474  SkISize picture_size) override;
475 
476  // |SnapshotDelegate|
477  sk_sp<SkImage> ConvertToRasterImage(sk_sp<SkImage> image) override;
478 
479  sk_sp<SkData> ScreenshotLayerTreeAsImage(
480  flutter::LayerTree* tree,
482  GrDirectContext* surface_context,
483  bool compressed);
484 
485  sk_sp<SkImage> DoMakeRasterSnapshot(
486  SkISize size,
487  std::function<void(SkCanvas*)> draw_callback);
488 
489  RasterStatus DoDraw(
490  std::unique_ptr<FrameTimingsRecorder> frame_timings_recorder,
491  std::unique_ptr<flutter::LayerTree> layer_tree);
492 
493  RasterStatus DrawToSurface(FrameTimingsRecorder& frame_timings_recorder,
494  flutter::LayerTree& layer_tree);
495 
496  RasterStatus DrawToSurfaceUnsafe(FrameTimingsRecorder& frame_timings_recorder,
497  flutter::LayerTree& layer_tree);
498 
499  void FireNextFrameCallbackIfPresent();
500 
501  static bool NoDiscard(const flutter::LayerTree& layer_tree) { return false; }
502 
504 };
505 
506 } // namespace flutter
507 
508 #endif // SHELL_COMMON_RASTERIZER_H_
KeyCallType type
std::optional< size_t > GetResourceCacheMaxBytes() const
The current value of Skia&#39;s resource cache size, if a surface is present.
Definition: rasterizer.cc:787
void Setup(std::unique_ptr< Surface > surface)
Rasterizers may be created well before an on-screen surface is available for rendering. Shells usually create a rasterizer in their constructors. Once an on-screen surface is available however, one may be provided to the rasterizer using this call. No rendering may occur before this call. The surface is held till the balancing call to Rasterizer::Teardown is made. Calling a setup before tearing down the previous surface (if this is not the first time the surface has been set up) is user error.
Definition: rasterizer.cc:51
MockDelegate delegate_
virtual std::shared_ptr< const fml::SyncSwitch > GetIsGpuDisabledSyncSwitch() const =0
void SetSnapshotSurfaceProducer(std::unique_ptr< SnapshotSurfaceProducer > producer)
Set the snapshot surface producer. This is done on shell initialization. This is non-null on platform...
Definition: rasterizer.cc:741
void SetExternalViewEmbedder(const std::shared_ptr< ExternalViewEmbedder > &view_embedder)
Set the External View Embedder. This is done on shell initialization. This is non-null on platforms t...
Definition: rasterizer.cc:736
fml::TaskRunnerAffineWeakPtr< Rasterizer > GetWeakPtr() const
Gets a weak pointer to the rasterizer. The rasterizer may only be accessed on the raster task runner...
Definition: rasterizer.cc:42
Dart_NativeFunction function
Definition: fuchsia.cc:51
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
void Teardown()
Releases the previously set up on-screen render surface and collects associated resources. No more rendering may occur till the next call to Rasterizer::Setup with a new render surface. Calling a teardown without a setup is user error.
Definition: rasterizer.cc:84
Screenshot ScreenshotLastLayerTree(ScreenshotType type, bool base64_encode)
Screenshots the last layer tree to one of the supported screenshot types and optionally Base 64 encod...
Definition: rasterizer.cc:689
FlKeyEvent FlKeyResponderAsyncCallback callback
virtual const TaskRunners & GetTaskRunners() const =0
Task runners used by the shell.
virtual fml::TimePoint GetLatestFrameTargetTime() const =0
void DisableThreadMergerIfNeeded()
Disables the thread merger if the external view embedder supports dynamic thread merging.
Definition: rasterizer.cc:112
std::function< void()> closure
Definition: closure.h:14
void EnableThreadMergerIfNeeded()
Enables the thread merger if the external view embedder supports dynamic thread merging.
Definition: rasterizer.cc:106
A POD type used to return the screenshot data along with the size of the frame.
Definition: rasterizer.h:275
ScreenshotType
The type of the screenshot to obtain of the previously rendered layer tree.
Definition: rasterizer.h:245
void SetNextFrameCallback(const fml::closure &callback)
Sets a callback that will be executed when the next layer tree in rendered to the on-screen surface...
Definition: rasterizer.cc:732
virtual const fml::RefPtr< fml::RasterThreadMerger > GetParentRasterThreadMerger() const =0
The raster thread merger from parent shell&#39;s rasterizer.
Used to forward events from the rasterizer to interested subsystems. Currently, the shell sets itself...
Definition: rasterizer.h:57
std::function< bool(flutter::LayerTree &)> LayerTreeDiscardCallback
Definition: rasterizer.h:203
fml::RefPtr< fml::RasterThreadMerger > GetRasterThreadMerger()
Returns the raster thread merger used by this rasterizer. This may be nullptr.
Definition: rasterizer.cc:746
~Rasterizer()
Destroys the rasterizer. This must happen on the raster task runner. All GPU resources are collected ...
flutter::TextureRegistry * GetTextureRegistry()
Gets the registry of external textures currently in use by the rasterizer. These textures may be upda...
Definition: rasterizer.cc:137
fml::TaskRunnerAffineWeakPtr< SnapshotDelegate > GetSnapshotDelegate() const
Definition: rasterizer.cc:46
virtual fml::Milliseconds GetFrameBudget()=0
RasterStatus Draw(std::unique_ptr< FrameTimingsRecorder > frame_timings_recorder, std::shared_ptr< Pipeline< flutter::LayerTree >> pipeline, LayerTreeDiscardCallback discard_callback=NoDiscard)
Takes the next item from the layer tree pipeline and executes the raster thread frame workload for th...
Definition: rasterizer.cc:155
Rasterizer(Delegate &delegate)
Creates a new instance of a rasterizer. Rasterizers may only be created on the raster task runner...
Definition: rasterizer.cc:31
void DrawLastLayerTree(std::unique_ptr< FrameTimingsRecorder > frame_timings_recorder)
Draws a last layer tree to the render surface. This may seem entirely redundant at first glance...
Definition: rasterizer.cc:145
#define FML_DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: macros.h:27
flutter::CompositorContext * compositor_context()
Returns a pointer to the compositor context used by this rasterizer. This pointer will never be nullp...
Definition: rasterizer.h:375
flutter::LayerTree * GetLastLayerTree()
Sometimes, it may be necessary to render the same frame again without having to wait for the framewor...
Definition: rasterizer.cc:141
void SetResourceCacheMaxBytes(size_t max_bytes, bool from_user)
Skia has no notion of time. To work around the performance implications of this, it may cache GPU res...
Definition: rasterizer.cc:760
virtual void OnFrameRasterized(const FrameTiming &frame_timing)=0
Notifies the delegate that a frame has been rendered. The rasterizer collects profiling information f...
std::chrono::duration< double, std::milli > Milliseconds
Definition: time_delta.h:18
void NotifyLowMemoryWarning() const
Notifies the rasterizer that there is a low memory situation and it must purge as many unnecessary re...
Definition: rasterizer.cc:118