Flutter Engine
The Flutter Engine
embedder_test_compositor.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 FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_COMPOSITOR_H_
6#define FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_COMPOSITOR_H_
7
8#include <vector>
9
10#include "flutter/fml/closure.h"
11#include "flutter/fml/macros.h"
12#include "flutter/shell/platform/embedder/embedder.h"
13#include "flutter/shell/platform/embedder/tests/embedder_test_backingstore_producer.h"
15
16namespace flutter {
17namespace testing {
18
20 public:
22 std::function<sk_sp<SkImage>(const FlutterLayer& layer,
23 GrDirectContext* context)>;
25 const FlutterLayer** layers,
26 size_t layers_count)>;
27
29
31
33 std::unique_ptr<EmbedderTestBackingStoreProducer> backingstore_producer);
34
36 FlutterBackingStore* backing_store_out);
37
38 bool CollectBackingStore(const FlutterBackingStore* backing_store);
39
40 bool Present(FlutterViewId view_id,
41 const FlutterLayer** layers,
42 size_t layers_count);
43
46
47 //----------------------------------------------------------------------------
48 /// @brief Allows tests to install a callback to notify them when the
49 /// entire render tree has been finalized so they can run their
50 /// assertions.
51 ///
52 /// @param[in] next_present_callback The next present callback
53 ///
54 void SetNextPresentCallback(const PresentCallback& next_present_callback);
55
56 void SetPresentCallback(const PresentCallback& present_callback,
57 bool one_shot);
58
60 void SetNextSceneCallback(const NextSceneCallback& next_scene_callback);
61
63
64 size_t GetPendingBackingStoresCount() const;
65
66 size_t GetBackingStoresCreatedCount() const;
67
68 size_t GetBackingStoresCollectedCount() const;
69
71
73
75
77
78 protected:
79 virtual bool UpdateOffscrenComposition(const FlutterLayer** layers,
80 size_t layers_count) = 0;
81
82 // TODO(gw280): encapsulate these properly for subclasses to use
83 std::unique_ptr<EmbedderTestBackingStoreProducer> backingstore_producer_;
86
94 std::vector<fml::closure> on_create_render_target_callbacks_;
95 std::vector<fml::closure> on_collect_render_target_callbacks_;
96 std::vector<fml::closure> on_present_callbacks_;
97
99};
100
101} // namespace testing
102} // namespace flutter
103
104#endif // FLUTTER_SHELL_PLATFORM_EMBEDDER_TESTS_EMBEDDER_TEST_COMPOSITOR_H_
void AddOnCreateRenderTargetCallback(const fml::closure &callback)
void AddOnPresentCallback(const fml::closure &callback)
void SetNextSceneCallback(const NextSceneCallback &next_scene_callback)
void AddOnCollectRenderTargetCallback(const fml::closure &callback)
std::vector< fml::closure > on_create_render_target_callbacks_
EmbedderTestCompositor(SkISize surface_size, sk_sp< GrDirectContext > context)
std::function< void(FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)> PresentCallback
bool CollectBackingStore(const FlutterBackingStore *backing_store)
std::function< void(sk_sp< SkImage > image)> NextSceneCallback
std::vector< fml::closure > on_collect_render_target_callbacks_
bool CreateBackingStore(const FlutterBackingStoreConfig *config, FlutterBackingStore *backing_store_out)
void SetNextPresentCallback(const PresentCallback &next_present_callback)
Allows tests to install a callback to notify them when the entire render tree has been finalized so t...
void SetBackingStoreProducer(std::unique_ptr< EmbedderTestBackingStoreProducer > backingstore_producer)
bool Present(FlutterViewId view_id, const FlutterLayer **layers, size_t layers_count)
virtual bool UpdateOffscrenComposition(const FlutterLayer **layers, size_t layers_count)=0
void SetPresentCallback(const PresentCallback &present_callback, bool one_shot)
std::unique_ptr< EmbedderTestBackingStoreProducer > backingstore_producer_
std::function< sk_sp< SkImage >(const FlutterLayer &layer, GrDirectContext *context)> PlatformViewRendererCallback
PlatformViewRendererCallback platform_view_renderer_callback_
void SetPlatformViewRendererCallback(const PlatformViewRendererCallback &callback)
FML_DISALLOW_COPY_AND_ASSIGN(EmbedderTestCompositor)
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
Dart_NativeFunction function
Definition: fuchsia.cc:51
sk_sp< const SkImage > image
Definition: SkRecords.h:269
int64_t FlutterViewId
Definition: flutter_view.h:13
std::function< void()> closure
Definition: closure.h:14
Definition: SkSize.h:16