5#define FML_USED_ON_EMBEDDER
7#include "flutter/common/task_runners.h"
8#include "flutter/fml/synchronization/count_down_latch.h"
9#include "flutter/fml/synchronization/waitable_event.h"
10#include "flutter/lib/ui/painting/canvas.h"
11#include "flutter/lib/ui/painting/image.h"
12#include "flutter/lib/ui/painting/picture.h"
13#include "flutter/lib/ui/painting/picture_recorder.h"
14#include "flutter/runtime/dart_vm.h"
15#include "flutter/shell/common/shell_test.h"
16#include "flutter/shell/common/thread_host.h"
17#include "flutter/testing/testing.h"
30 return reinterpret_cast<T*
>(peer);
43 auto native_image_handle =
52 current_display_list_ =
picture->display_list();
53 current_image_ =
image->image();
57 message_latch_.Signal();
63 frame_latch.CountDown();
73 AddNativeCallback(
"CaptureImageAndPicture",
77 std::unique_ptr<Shell>
shell = CreateShell(
settings, task_runners);
79 ASSERT_TRUE(
shell->IsSetup());
83 shell->GetPlatformView()->NotifyCreated();
86 configuration.SetEntrypoint(
"pumpImage");
88 shell->RunEngine(std::move(configuration), [&](
auto result) {
91 message_latch_.Wait();
93 ASSERT_TRUE(current_display_list_);
94 ASSERT_TRUE(current_image_);
102 message_latch_.Reset();
103 task_runner->PostTask([&, io_manager =
shell->GetIOManager()]() {
104 io_manager->GetSkiaUnrefQueue()->Drain();
105 message_latch_.Signal();
107 message_latch_.Wait();
109 if (current_display_list_) {
111 current_display_list_.reset();
115 current_image_.reset();
117 shell->GetPlatformView()->NotifyDestroyed();
118 DestroyShell(std::move(
shell), task_runners);
static RunConfiguration InferFromSettings(const Settings &settings, const fml::RefPtr< fml::TaskRunner > &io_worker=nullptr, IsolateLaunchType launch_type=IsolateLaunchType::kNewGroup)
Attempts to infer a run configuration from the settings object. This tries to create a run configurat...
sk_sp< DlImage > current_image_
sk_sp< DisplayList > current_display_list_
T * GetNativePeer(Dart_Handle handle)
fml::AutoResetWaitableEvent message_latch_
struct _Dart_Handle * Dart_Handle
DART_EXPORT Dart_Handle Dart_GetNativeArgument(Dart_NativeArguments args, int index)
DART_EXPORT Dart_Handle Dart_GetNativeInstanceField(Dart_Handle obj, int index, intptr_t *value)
struct _Dart_NativeArguments * Dart_NativeArguments
DART_EXPORT bool Dart_IsNull(Dart_Handle object)
DART_EXPORT Dart_Handle Dart_NewStringFromCString(const char *str)
DART_EXPORT DART_WARN_UNUSED_RESULT Dart_Handle Dart_GetField(Dart_Handle container, Dart_Handle name)
DART_EXPORT bool Dart_IsError(Dart_Handle handle)
DART_EXPORT const char * Dart_GetError(Dart_Handle handle)
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
fml::RefPtr< fml::TaskRunner > CreateNewThread(const std::string &name)
fml::RefPtr< fml::TaskRunner > GetCurrentTaskRunner()
sk_sp< const SkImage > image
sk_sp< const SkPicture > picture
TEST_F(DisplayListTest, Defaults)
static void SetViewportMetrics(JNIEnv *env, jobject jcaller, jlong shell_holder, jfloat devicePixelRatio, jint physicalWidth, jint physicalHeight, jint physicalPaddingTop, jint physicalPaddingRight, jint physicalPaddingBottom, jint physicalPaddingLeft, jint physicalViewInsetTop, jint physicalViewInsetRight, jint physicalViewInsetBottom, jint physicalViewInsetLeft, jint systemGestureInsetTop, jint systemGestureInsetRight, jint systemGestureInsetBottom, jint systemGestureInsetLeft, jint physicalTouchSlop, jintArray javaDisplayFeaturesBounds, jintArray javaDisplayFeaturesType, jintArray javaDisplayFeaturesState)
#define CREATE_NATIVE_ENTRY(native_entry)
#define EXPECT_TRUE(handle)