Flutter Engine
shell_test_platform_view.cc
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 #include "flutter/shell/common/shell_test_platform_view.h"
6 
7 #ifdef SHELL_ENABLE_GL
8 #include "flutter/shell/common/shell_test_platform_view_gl.h"
9 #endif // SHELL_ENABLE_GL
10 #ifdef SHELL_ENABLE_VULKAN
11 #include "flutter/shell/common/shell_test_platform_view_vulkan.h"
12 #endif // SHELL_ENABLE_VULKAN
13 #ifdef SHELL_ENABLE_METAL
14 #include "flutter/shell/common/shell_test_platform_view_metal.h"
15 #endif // SHELL_ENABLE_METAL
16 
17 namespace flutter {
18 namespace testing {
19 
20 std::unique_ptr<ShellTestPlatformView> ShellTestPlatformView::Create(
21  PlatformView::Delegate& delegate,
22  TaskRunners task_runners,
23  std::shared_ptr<ShellTestVsyncClock> vsync_clock,
24  CreateVsyncWaiter create_vsync_waiter,
25  BackendType backend,
26  std::shared_ptr<ShellTestExternalViewEmbedder>
27  shell_test_external_view_embedder) {
28  // TODO(gw280): https://github.com/flutter/flutter/issues/50298
29  // Make this fully runtime configurable
30  switch (backend) {
32 #ifdef SHELL_ENABLE_GL
34  return std::make_unique<ShellTestPlatformViewGL>(
35  delegate, task_runners, vsync_clock, create_vsync_waiter,
36  shell_test_external_view_embedder);
37 #endif // SHELL_ENABLE_GL
38 #ifdef SHELL_ENABLE_VULKAN
40  return std::make_unique<ShellTestPlatformViewVulkan>(
41  delegate, task_runners, vsync_clock, create_vsync_waiter,
42  shell_test_external_view_embedder);
43 #endif // SHELL_ENABLE_VULKAN
44 #ifdef SHELL_ENABLE_METAL
46  return std::make_unique<ShellTestPlatformViewMetal>(
47  delegate, task_runners, vsync_clock, create_vsync_waiter,
48  shell_test_external_view_embedder);
49 #endif // SHELL_ENABLE_METAL
50 
51  default:
52  FML_LOG(FATAL) << "No backends supported for ShellTestPlatformView";
53  return nullptr;
54  }
55 }
56 
57 } // namespace testing
58 } // namespace flutter
#define FML_LOG(severity)
Definition: logging.h:65
std::function< std::unique_ptr< VsyncWaiter >()> CreateVsyncWaiter
Used to forward events from the platform view to interested subsystems. This forwarding is done by th...
Definition: platform_view.h:54
static std::unique_ptr< ShellTestPlatformView > Create(PlatformView::Delegate &delegate, TaskRunners task_runners, std::shared_ptr< ShellTestVsyncClock > vsync_clock, CreateVsyncWaiter create_vsync_waiter, BackendType backend, std::shared_ptr< ShellTestExternalViewEmbedder > shell_test_external_view_embedder)