Flutter Engine
The Flutter Engine
Namespaces | Classes | Typedefs | Functions | Variables
flutter_runner Namespace Reference

Namespaces

namespace  testing
 

Classes

class  AccessibilityBridge
 
struct  ActiveComponentV2
 
class  CompatTaskRunner
 
class  ComponentV2
 
class  Engine
 
class  ExternalViewEmbedder
 
class  FileInNamespaceBuffer
 A mapping to a buffer for a file that has been loaded into a namespace. More...
 
class  FlatlandConnection
 
class  FlutterRunnerProductConfiguration
 
class  FocusDelegate
 
class  IsolateConfigurator
 
struct  IxnHasher
 
class  Keyboard
 
class  Overflow
 
class  PlatformView
 
class  PointerDelegate
 
class  PointerInjectorDelegate
 
struct  ProgramMetadata
 
class  Runner
 
class  SoftwareSurface
 
class  SoftwareSurfaceProducer
 
class  Surface
 
class  SurfaceProducer
 
class  SurfaceProducerSurface
 
class  TextDelegate
 
struct  UniqueFDIONSTraits
 
class  VsyncWaiter
 
struct  VulkanImage
 
class  VulkanSurface
 
class  VulkanSurfacePool
 
class  VulkanSurfaceProducer
 

Typedefs

using ViewCallback = std::function< void()>
 
using ViewCreatedCallback = std::function< void(fuchsia::ui::composition::ContentId, fuchsia::ui::composition::ChildViewWatcherHandle child_view_watcher)>
 
using ViewIdCallback = std::function< void(fuchsia::ui::composition::ContentId)>
 
using on_frame_presented_event = std::function< void(fuchsia::scenic::scheduling::FramePresentedInfo)>
 
using OnEnableWireframeCallback = fit::function< void(bool)>
 
using OnUpdateViewCallback = fit::function< void(int64_t, SkRect, bool, bool)>
 
using OnCreateSurfaceCallback = fit::function< std::unique_ptr< flutter::Surface >()>
 
using OnSemanticsNodeUpdateCallback = fit::function< void(flutter::SemanticsNodeUpdates, float)>
 
using OnRequestAnnounceCallback = fit::function< void(std::string)>
 
using OnCreateViewCallback = fit::function< void(int64_t, ViewCallback, ViewCreatedCallback, bool, bool)>
 
using OnDestroyViewCallback = fit::function< void(int64_t, ViewIdCallback)>
 
using OnShaderWarmupCallback = std::function< void(const std::vector< std::string > &, std::function< void(uint32_t)>, uint64_t, uint64_t)>
 
using fup_EventPhase = fuchsia::ui::pointer::EventPhase
 
using fup_MouseDeviceInfo = fuchsia::ui::pointer::MouseDeviceInfo
 
using fup_MouseEvent = fuchsia::ui::pointer::MouseEvent
 
using fup_TouchEvent = fuchsia::ui::pointer::TouchEvent
 
using fup_TouchIxnStatus = fuchsia::ui::pointer::TouchInteractionStatus
 
using fup_TouchResponse = fuchsia::ui::pointer::TouchResponse
 
using fup_TouchResponseType = fuchsia::ui::pointer::TouchResponseType
 
using fup_ViewParameters = fuchsia::ui::pointer::ViewParameters
 
using fup_Config = fuchsia::ui::pointerinjector::Config
 
using fup_Context = fuchsia::ui::pointerinjector::Context
 
using fup_Data = fuchsia::ui::pointerinjector::Data
 
using fup_DeviceType = fuchsia::ui::pointerinjector::DeviceType
 
using fup_DispatchPolicy = fuchsia::ui::pointerinjector::DispatchPolicy
 
using fup_Event = fuchsia::ui::pointerinjector::Event
 
using fup_PointerSample = fuchsia::ui::pointerinjector::PointerSample
 
using fup_Target = fuchsia::ui::pointerinjector::Target
 
using fup_Viewport = fuchsia::ui::pointerinjector::Viewport
 
using fuv_ViewRef = fuchsia::ui::views::ViewRef
 
using ReleaseImageCallback = std::function< void()>
 
using UniqueFDIONS = fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits >
 
using FireCallbackCallback = std::function< void(fml::TimePoint, fml::TimePoint)>
 
using AwaitVsyncCallback = std::function< void(FireCallbackCallback)>
 
using AwaitVsyncForSecondaryCallbackCallback = std::function< void(FireCallbackCallback)>
 

Functions

static uint32_t FlutterIdToFuchsiaId (int32_t flutter_node_id)
 
static void PrintNodeSizeError (uint32_t node_id)
 
std::unique_ptr< fml::MappingLoadFile (int namespace_fd, const char *path, bool executable)
 
std::unique_ptr< fml::FileMappingMakeFileMapping (const char *path, bool executable)
 
static void Enqueue (zx::event fence, std::vector< zx::event > *fences, std::shared_ptr< Overflow > *overflow)
 
fml::MallocMapping MakeLocalizationPlatformMessageData (const Profile &intl_profile)
 
fml::MallocMapping MakeLocalizationPlatformMessageData (const fuchsia::intl::Profile &intl_profile)
 
static flutter::PointerData::Change GetChangeFromPointerEventPhase (fuchsia::ui::input::PointerEventPhase phase)
 
static flutter::PointerData::DeviceKind GetKindFromPointerType (fuchsia::ui::input::PointerEventType type)
 
static trace_flow_id_t PointerTraceHACK (float fa, float fb)
 
static void SetProcessName ()
 
static void SetThreadName (const std::string &thread_name)
 
static void RegisterProfilerSymbols (const char *symbols_path, const char *dso_name)
 
 TEST (RunnerTZDataTest, LoadsWithoutTZDataPresent)
 
 TEST (RunnerTZDataTest, LoadsWithTZDataPresent)
 
fml::RefPtr< fml::TaskRunnerCreateFMLTaskRunner (async_dispatcher_t *dispatcher)
 
static fuchsia::ui::input::InputMethodAction IntoInputMethodAction (const std::string action_string)
 
static const std::string IntoTextInputAction (fuchsia::ui::input::InputMethodAction action)
 
template<class T >
void SetInterfaceErrorHandler (fidl::InterfacePtr< T > &interface, std::string name)
 
template<class T >
void SetInterfaceErrorHandler (fidl::Binding< T > &binding, std::string name)
 
UniqueFDIONS UniqueFDIONSCreate ()
 
 TEST (VSyncWaiterFuchsia, FrameScheduledForStartTime)
 
static std::string GetCurrentProcessName ()
 
static zx_koid_t GetCurrentProcessId ()
 

Variables

static constexpr size_t kMaxFences
 
static constexpr fml::TimeDelta kInitialFlatlandVsyncOffset
 
static constexpr char kFlutterPlatformChannel [] = "flutter/platform"
 
static constexpr char kAccessibilityChannel [] = "flutter/accessibility"
 
static constexpr char kFlutterPlatformViewsChannel [] = "flutter/platform_views"
 
static constexpr char kFuchsiaShaderWarmupChannel [] = "fuchsia/shader_warmup"
 
static constexpr char kFuchsiaInputTestChannel [] = "fuchsia/input_test"
 
static constexpr char kFuchsiaChildViewChannel [] = "fuchsia/child_view"
 
static constexpr int64_t kFlutterImplicitViewId = 0ll
 
const auto fup_MAX_INJECT = fuchsia::ui::pointerinjector::MAX_INJECT
 
static constexpr char kInputActionKey [] = "inputAction"
 
static constexpr char kTextInputActionDone [] = "TextInputAction.done"
 
static constexpr char kTextInputActionNewline [] = "TextInputAction.newline"
 
static constexpr char kTextInputActionGo [] = "TextInputAction.go"
 
static constexpr char kTextInputActionNext [] = "TextInputAction.next"
 
static constexpr char kTextInputActionPrevious [] = "TextInputAction.previous"
 
static constexpr char kTextInputActionNone [] = "TextInputAction.none"
 
static constexpr char kTextInputActionSearch [] = "TextInputAction.search"
 
static constexpr char kTextInputActionSend [] = "TextInputAction.send"
 
static constexpr char kTextInputActionUnspecified []
 
constexpr char kTextInputChannel [] = "flutter/textinput"
 The channel name used for text editing platofrm messages. More...
 
constexpr char kKeyEventChannel [] = "flutter/keyevent"
 The channel name used for key event platform messages. More...
 

Detailed Description

Text editing functionality delegated from |PlatformView|. See |TextDelegate| for details.

Typedef Documentation

◆ AwaitVsyncCallback

Definition at line 22 of file vsync_waiter.h.

◆ AwaitVsyncForSecondaryCallbackCallback

Definition at line 24 of file vsync_waiter.h.

◆ FireCallbackCallback

Definition at line 19 of file vsync_waiter.h.

◆ fup_Config

using flutter_runner::fup_Config = typedef fuchsia::ui::pointerinjector::Config

Definition at line 10 of file pointer_injector_delegate.cc.

◆ fup_Context

using flutter_runner::fup_Context = typedef fuchsia::ui::pointerinjector::Context

Definition at line 11 of file pointer_injector_delegate.cc.

◆ fup_Data

using flutter_runner::fup_Data = typedef fuchsia::ui::pointerinjector::Data

Definition at line 12 of file pointer_injector_delegate.cc.

◆ fup_DeviceType

using flutter_runner::fup_DeviceType = typedef fuchsia::ui::pointerinjector::DeviceType

Definition at line 13 of file pointer_injector_delegate.cc.

◆ fup_DispatchPolicy

using flutter_runner::fup_DispatchPolicy = typedef fuchsia::ui::pointerinjector::DispatchPolicy

Definition at line 14 of file pointer_injector_delegate.cc.

◆ fup_Event

Definition at line 15 of file pointer_injector_delegate.cc.

◆ fup_EventPhase

typedef fuchsia::ui::pointerinjector::EventPhase flutter_runner::fup_EventPhase

Definition at line 29 of file pointer_delegate.cc.

◆ fup_MouseDeviceInfo

using flutter_runner::fup_MouseDeviceInfo = typedef fuchsia::ui::pointer::MouseDeviceInfo

Definition at line 30 of file pointer_delegate.cc.

◆ fup_MouseEvent

using flutter_runner::fup_MouseEvent = typedef fuchsia::ui::pointer::MouseEvent

Definition at line 31 of file pointer_delegate.cc.

◆ fup_PointerSample

using flutter_runner::fup_PointerSample = typedef fuchsia::ui::pointerinjector::PointerSample

Definition at line 17 of file pointer_injector_delegate.cc.

◆ fup_Target

using flutter_runner::fup_Target = typedef fuchsia::ui::pointerinjector::Target

Definition at line 18 of file pointer_injector_delegate.cc.

◆ fup_TouchEvent

using flutter_runner::fup_TouchEvent = typedef fuchsia::ui::pointer::TouchEvent

Definition at line 32 of file pointer_delegate.cc.

◆ fup_TouchIxnStatus

using flutter_runner::fup_TouchIxnStatus = typedef fuchsia::ui::pointer::TouchInteractionStatus

Definition at line 33 of file pointer_delegate.cc.

◆ fup_TouchResponse

using flutter_runner::fup_TouchResponse = typedef fuchsia::ui::pointer::TouchResponse

Definition at line 34 of file pointer_delegate.cc.

◆ fup_TouchResponseType

using flutter_runner::fup_TouchResponseType = typedef fuchsia::ui::pointer::TouchResponseType

Definition at line 35 of file pointer_delegate.cc.

◆ fup_ViewParameters

using flutter_runner::fup_ViewParameters = typedef fuchsia::ui::pointer::ViewParameters

Definition at line 36 of file pointer_delegate.cc.

◆ fup_Viewport

using flutter_runner::fup_Viewport = typedef fuchsia::ui::pointerinjector::Viewport

Definition at line 19 of file pointer_injector_delegate.cc.

◆ fuv_ViewRef

using flutter_runner::fuv_ViewRef = typedef fuchsia::ui::views::ViewRef

Definition at line 20 of file pointer_injector_delegate.cc.

◆ on_frame_presented_event

using flutter_runner::on_frame_presented_event = typedef std::function<void(fuchsia::scenic::scheduling::FramePresentedInfo)>

Definition at line 41 of file flatland_connection.h.

◆ OnCreateSurfaceCallback

Definition at line 45 of file platform_view.h.

◆ OnCreateViewCallback

Definition at line 50 of file platform_view.h.

◆ OnDestroyViewCallback

Definition at line 52 of file platform_view.h.

◆ OnEnableWireframeCallback

Definition at line 42 of file platform_view.h.

◆ OnRequestAnnounceCallback

using flutter_runner::OnRequestAnnounceCallback = typedef fit::function<void(std::string)>

Definition at line 49 of file platform_view.h.

◆ OnSemanticsNodeUpdateCallback

Definition at line 47 of file platform_view.h.

◆ OnShaderWarmupCallback

using flutter_runner::OnShaderWarmupCallback = typedef std::function<void(const std::vector<std::string>&, std::function<void(uint32_t)>, uint64_t, uint64_t)>

Definition at line 57 of file platform_view.h.

◆ OnUpdateViewCallback

using flutter_runner::OnUpdateViewCallback = typedef fit::function<void(int64_t, SkRect, bool, bool)>

Definition at line 44 of file platform_view.h.

◆ ReleaseImageCallback

Definition at line 21 of file surface_producer.h.

◆ UniqueFDIONS

Definition at line 25 of file unique_fdio_ns.h.

◆ ViewCallback

Definition at line 34 of file external_view_embedder.h.

◆ ViewCreatedCallback

using flutter_runner::ViewCreatedCallback = typedef std::function<void( fuchsia::ui::composition::ContentId, fuchsia::ui::composition::ChildViewWatcherHandle child_view_watcher)>

Definition at line 35 of file external_view_embedder.h.

◆ ViewIdCallback

using flutter_runner::ViewIdCallback = typedef std::function<void(fuchsia::ui::composition::ContentId)>

Definition at line 38 of file external_view_embedder.h.

Function Documentation

◆ CreateFMLTaskRunner()

fml::RefPtr< fml::TaskRunner > flutter_runner::CreateFMLTaskRunner ( async_dispatcher_t *  dispatcher)

Definition at line 51 of file task_runner_adapter.cc.

52 {
53 return fml::MakeRefCounted<CompatTaskRunner>(dispatcher);
54}

◆ Enqueue()

static void flutter_runner::Enqueue ( zx::event  fence,
std::vector< zx::event > *  fences,
std::shared_ptr< Overflow > *  overflow 
)
static

Definition at line 355 of file flatland_connection.cc.

357 {
358 constexpr size_t kMaxFences =
359 fuchsia::ui::composition::MAX_ACQUIRE_RELEASE_FENCE_COUNT;
360
361 // Number of all previously added fences, plus this one.
362 const auto num_all_fences =
363 fences->size() + 1 +
364 ((*overflow == nullptr) ? 0 : (*overflow)->fences_.size());
365
366 // If more than max number of fences come in, schedule any further fences into
367 // an overflow. The overflow fences are scheduled for processing here, but are
368 // processed in DoPresent().
369 if (num_all_fences <= kMaxFences) {
370 fences->push_back(std::move(fence));
371 } else if (num_all_fences == kMaxFences + 1) {
372 // The ownership of the overflow will be handed over to the signaling
373 // closure on DoPresent call. So we always expect that we enter here with
374 // overflow not set.
375 FML_CHECK((*overflow) == nullptr) << "overflow is still active";
376 *overflow = std::make_shared<Overflow>();
377
378 // Set up the overflow fences. Creates an overflow handle, places it
379 // into `fences` instead of the previous fence, and puts the prior fence
380 // and this one into overflow.
381 zx::event overflow_handle = std::move(fences->back());
382 fences->pop_back();
383
384 zx::event overflow_fence;
385 zx_status_t status = zx::event::create(0, &overflow_fence);
386 FML_CHECK(status == ZX_OK) << "status: " << zx_status_get_string(status);
387
388 // Every DoPresent should invalidate this handle. Holler if not.
389 FML_CHECK(!(*overflow)->event_.is_valid()) << "overflow valid";
390 status =
391 overflow_fence.duplicate(ZX_RIGHT_SAME_RIGHTS, &(*overflow)->event_);
392 FML_CHECK(status == ZX_OK) << "status: " << zx_status_get_string(status);
393 fences->push_back(std::move(overflow_fence));
394
395 // Prepare for wait_many call.
396 (*overflow)->fences_.push_back(std::move(overflow_handle));
397 (*overflow)->fences_.push_back(std::move(fence));
398
399 FML_LOG(INFO) << "Enqueue using fence overflow, expect a performance hit.";
400 } else {
401 FML_CHECK((*overflow) != nullptr);
402 // Just add to the overflow fences.
403 (*overflow)->fences_.push_back(std::move(fence));
404 }
405}
FlKeyEvent * event
#define FML_LOG(severity)
Definition: logging.h:82
#define FML_CHECK(condition)
Definition: logging.h:85
static constexpr size_t kMaxFences
int_closure create

◆ FlutterIdToFuchsiaId()

static uint32_t flutter_runner::FlutterIdToFuchsiaId ( int32_t  flutter_node_id)
static

Definition at line 497 of file accessibility_bridge.cc.

497 {
498 FML_DCHECK(flutter_node_id >= 0)
499 << "Unexpectedly received a negative semantics node ID.";
500 return static_cast<uint32_t>(flutter_node_id);
501}
#define FML_DCHECK(condition)
Definition: logging.h:103

◆ GetChangeFromPointerEventPhase()

static flutter::PointerData::Change flutter_runner::GetChangeFromPointerEventPhase ( fuchsia::ui::input::PointerEventPhase  phase)
static

Definition at line 256 of file platform_view.cc.

257 {
258 switch (phase) {
261 case fuchsia::ui::input::PointerEventPhase::HOVER:
263 case fuchsia::ui::input::PointerEventPhase::DOWN:
267 case fuchsia::ui::input::PointerEventPhase::UP:
269 case fuchsia::ui::input::PointerEventPhase::REMOVE:
271 case fuchsia::ui::input::PointerEventPhase::CANCEL:
273 default:
275 }
276}
static const int MOVE

◆ GetCurrentProcessId()

static zx_koid_t flutter_runner::GetCurrentProcessId ( )
static

Definition at line 25 of file vulkan_surface_pool.cc.

25 {
26 zx_info_handle_basic_t info;
27 zx_status_t status = zx::process::self()->get_info(
28 ZX_INFO_HANDLE_BASIC, &info, sizeof(info), nullptr, nullptr);
29 return status == ZX_OK ? info.koid : ZX_KOID_INVALID;
30}
static void info(const char *fmt,...) SK_PRINTF_LIKE(1
Definition: DM.cpp:213

◆ GetCurrentProcessName()

static std::string flutter_runner::GetCurrentProcessName ( )
static

Definition at line 18 of file vulkan_surface_pool.cc.

18 {
19 char name[ZX_MAX_NAME_LEN];
20 zx_status_t status =
21 zx::process::self()->get_property(ZX_PROP_NAME, name, sizeof(name));
22 return status == ZX_OK ? std::string(name) : std::string();
23}
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
Definition: ref_ptr.h:256

◆ GetKindFromPointerType()

static flutter::PointerData::DeviceKind flutter_runner::GetKindFromPointerType ( fuchsia::ui::input::PointerEventType  type)
static

Definition at line 278 of file platform_view.cc.

279 {
280 switch (type) {
281 case fuchsia::ui::input::PointerEventType::TOUCH:
283 case fuchsia::ui::input::PointerEventType::MOUSE:
285 default:
287 }
288}
GLenum type

◆ IntoInputMethodAction()

static fuchsia::ui::input::InputMethodAction flutter_runner::IntoInputMethodAction ( const std::string  action_string)
static

Definition at line 41 of file text_delegate.cc.

42 {
43 if (action_string == kTextInputActionNewline) {
44 return fuchsia::ui::input::InputMethodAction::NEWLINE;
45 } else if (action_string == kTextInputActionDone) {
46 return fuchsia::ui::input::InputMethodAction::DONE;
47 } else if (action_string == kTextInputActionGo) {
48 return fuchsia::ui::input::InputMethodAction::GO;
49 } else if (action_string == kTextInputActionNext) {
50 return fuchsia::ui::input::InputMethodAction::NEXT;
51 } else if (action_string == kTextInputActionPrevious) {
52 return fuchsia::ui::input::InputMethodAction::PREVIOUS;
53 } else if (action_string == kTextInputActionNone) {
54 return fuchsia::ui::input::InputMethodAction::NONE;
55 } else if (action_string == kTextInputActionSearch) {
56 return fuchsia::ui::input::InputMethodAction::SEARCH;
57 } else if (action_string == kTextInputActionSend) {
58 return fuchsia::ui::input::InputMethodAction::SEND;
59 } else if (action_string == kTextInputActionUnspecified) {
60 return fuchsia::ui::input::InputMethodAction::UNSPECIFIED;
61 }
62 // If this message comes along it means we should really add the missing 'if'
63 // above.
64 FML_VLOG(1) << "unexpected action_string: " << action_string;
65 // Substituting DONE for an unexpected action string will probably be OK.
66 return fuchsia::ui::input::InputMethodAction::DONE;
67}
#define FML_VLOG(verbose_level)
Definition: logging.h:98
static constexpr char kTextInputActionPrevious[]
static constexpr char kTextInputActionUnspecified[]
static constexpr char kTextInputActionGo[]
static constexpr char kTextInputActionDone[]
static constexpr char kTextInputActionNewline[]
static constexpr char kTextInputActionNone[]
static constexpr char kTextInputActionSearch[]
static constexpr char kTextInputActionNext[]
static constexpr char kTextInputActionSend[]

◆ IntoTextInputAction()

static const std::string flutter_runner::IntoTextInputAction ( fuchsia::ui::input::InputMethodAction  action)
static

Definition at line 70 of file text_delegate.cc.

71 {
72 if (action == fuchsia::ui::input::InputMethodAction::NEWLINE) {
74 } else if (action == fuchsia::ui::input::InputMethodAction::DONE) {
76 } else if (action == fuchsia::ui::input::InputMethodAction::GO) {
77 return kTextInputActionGo;
78 } else if (action == fuchsia::ui::input::InputMethodAction::NEXT) {
80 } else if (action == fuchsia::ui::input::InputMethodAction::PREVIOUS) {
82 } else if (action == fuchsia::ui::input::InputMethodAction::NONE) {
84 } else if (action == fuchsia::ui::input::InputMethodAction::SEARCH) {
86 } else if (action == fuchsia::ui::input::InputMethodAction::SEND) {
88 } else if (action == fuchsia::ui::input::InputMethodAction::UNSPECIFIED) {
90 }
91 // If this message comes along it means we should really add the missing 'if'
92 // above.
93 FML_VLOG(1) << "unexpected action: " << static_cast<uint32_t>(action);
94 // Substituting "done" for an unexpected text input action will probably
95 // be OK.
97}

◆ LoadFile()

std::unique_ptr< fml::Mapping > flutter_runner::LoadFile ( int  namespace_fd,
const char *  path,
bool  executable 
)

Loads a file from |file_path| into the namespace |namespace_fd|, returning the mapping for that file.

The file will be loaded with the readable permission. If |executable| is true, the file will be also be loaded with the executable permission.

Definition at line 67 of file file_in_namespace_buffer.cc.

69 {
70 FML_TRACE_EVENT("flutter", "LoadFile", "path", path);
71 return std::make_unique<FileInNamespaceBuffer>(namespace_fd, path,
72 executable);
73}
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir path
Definition: switches.h:57
#define FML_TRACE_EVENT(category_group, name,...)
Definition: trace_event.h:121

◆ MakeFileMapping()

std::unique_ptr< fml::FileMapping > flutter_runner::MakeFileMapping ( const char *  path,
bool  executable 
)

Opens the file at |path| and creates a file mapping for the file.

The file will be opened with the readable permission. If |executable| is true, the file will also be opened with the executable permission.

Definition at line 75 of file file_in_namespace_buffer.cc.

76 {
77 auto flags = fuchsia::io::OpenFlags::RIGHT_READABLE;
78 if (executable) {
79 flags |= fuchsia::io::OpenFlags::RIGHT_EXECUTABLE;
80 }
81
82 // The returned file descriptor is compatible with standard posix operations
83 // such as close, mmap, etc. We only need to treat open/open_at specially.
84 int fd;
85 const zx_status_t status =
86 fdio_open_fd(path, static_cast<uint32_t>(flags), &fd);
87 if (status != ZX_OK) {
88 return nullptr;
89 }
90
91 using Protection = fml::FileMapping::Protection;
92
93 std::initializer_list<Protection> protection_execute = {Protection::kRead,
94 Protection::kExecute};
95 std::initializer_list<Protection> protection_read = {Protection::kRead};
96 auto mapping = std::make_unique<fml::FileMapping>(
97 fml::UniqueFD{fd}, executable ? protection_execute : protection_read);
98
99 if (!mapping->IsValid()) {
100 return nullptr;
101 }
102 return mapping;
103}
FlutterSemanticsFlag flags

◆ MakeLocalizationPlatformMessageData() [1/2]

fml::MallocMapping flutter_runner::MakeLocalizationPlatformMessageData ( const fuchsia::intl::Profile &  intl_profile)

◆ MakeLocalizationPlatformMessageData() [2/2]

fml::MallocMapping flutter_runner::MakeLocalizationPlatformMessageData ( const Profile &  intl_profile)

Definition at line 29 of file fuchsia_intl.cc.

30 {
31 rapidjson::Document document;
32 auto& allocator = document.GetAllocator();
33 document.SetObject();
34 document.AddMember("method", "setLocale", allocator);
35 rapidjson::Value args(rapidjson::kArrayType);
36
37 for (const auto& locale_id : intl_profile.locales()) {
38 UErrorCode error_code = U_ZERO_ERROR;
39 icu::Locale locale = icu::Locale::forLanguageTag(locale_id.id, error_code);
40 if (U_FAILURE(error_code)) {
41 FML_LOG(ERROR) << "Error parsing locale ID \"" << locale_id.id << "\"";
42 continue;
43 }
44 args.PushBack(rapidjson::Value().SetString(locale.getLanguage(), allocator),
45 allocator);
46
47 auto country = locale.getCountry() != nullptr ? locale.getCountry() : "";
48 args.PushBack(rapidjson::Value().SetString(country, allocator), allocator);
49
50 auto script = locale.getScript() != nullptr ? locale.getScript() : "";
51 args.PushBack(rapidjson::Value().SetString(script, allocator), allocator);
52
53 std::string variant =
54 locale.getVariant() != nullptr ? locale.getVariant() : "";
55 // ICU4C capitalizes the variant for backward compatibility, even though
56 // the preferred form is lowercase. So we lowercase here.
57 std::transform(begin(variant), end(variant), begin(variant),
58 [](unsigned char c) { return std::tolower(c); });
59 args.PushBack(rapidjson::Value().SetString(variant, allocator), allocator);
60 }
61
62 document.AddMember("args", args, allocator);
63
64 rapidjson::StringBuffer buffer;
65 rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
66 document.Accept(writer);
67 auto data = reinterpret_cast<const uint8_t*>(buffer.GetString());
68 return fml::MallocMapping::Copy(data, buffer.GetSize());
69}
static MallocMapping Copy(const T *begin, const T *end)
Definition: mapping.h:162
static const char * begin(const StringSlice &s)
Definition: editor.cpp:252
glong glong end
G_BEGIN_DECLS G_MODULE_EXPORT FlValue * args
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot The VM snapshot data that will be memory mapped as read only SnapshotAssetPath must be present isolate snapshot The isolate snapshot data that will be memory mapped as read only SnapshotAssetPath must be present cache dir Path to the cache directory This is different from the persistent_cache_path in embedder which is used for Skia shader cache icu native lib Path to the library file that exports the ICU data vm service The hostname IP address on which the Dart VM Service should be served If not defaults to or::depending on whether ipv6 is specified vm service A custom Dart VM Service port The default is to pick a randomly available open port disable vm Disable the Dart VM Service The Dart VM Service is never available in release mode disable vm service Disable mDNS Dart VM Service publication Bind to the IPv6 localhost address for the Dart VM Service Ignored if vm service host is set endless trace buffer
Definition: switches.h:126
static SkColor4f transform(SkColor4f c, SkColorSpace *src, SkColorSpace *dst)
Definition: p3.cpp:47
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63
#define ERROR(message)
Definition: elf_loader.cc:260

◆ PointerTraceHACK()

static trace_flow_id_t flutter_runner::PointerTraceHACK ( float  fa,
float  fb 
)
static

Definition at line 292 of file platform_view.cc.

292 {
293 uint32_t ia, ib;
294 memcpy(&ia, &fa, sizeof(uint32_t));
295 memcpy(&ib, &fb, sizeof(uint32_t));
296 return (((uint64_t)ia) << 32) | ib;
297}

◆ PrintNodeSizeError()

static void flutter_runner::PrintNodeSizeError ( uint32_t  node_id)
static

Definition at line 520 of file accessibility_bridge.cc.

520 {
521 FML_LOG(ERROR) << "Semantics node with ID " << node_id
522 << " exceeded the maximum FIDL message size and may not "
523 "be delivered to the accessibility manager service.";
524}

◆ RegisterProfilerSymbols()

static void flutter_runner::RegisterProfilerSymbols ( const char *  symbols_path,
const char *  dso_name 
)
static

Definition at line 142 of file runner.cc.

143 {
144 std::string* symbols = new std::string();
145 if (dart_utils::ReadFileToString(symbols_path, symbols)) {
146 Dart_AddSymbols(dso_name, symbols->data(), symbols->size());
147 } else {
148 FML_LOG(ERROR) << "Failed to load " << symbols_path;
149 }
150}
DART_EXPORT void Dart_AddSymbols(const char *dso_name, void *buffer, intptr_t buffer_size)
bool ReadFileToString(const std::string &path, std::string *result)
Definition: files.cc:56

◆ SetInterfaceErrorHandler() [1/2]

template<class T >
void flutter_runner::SetInterfaceErrorHandler ( fidl::Binding< T > &  binding,
std::string  name 
)

Definition at line 109 of file text_delegate.cc.

109 {
110 binding.set_error_handler([name](zx_status_t status) {
111 FML_LOG(ERROR) << "Binding error on: " << name << ", status: " << status;
112 });
113}

◆ SetInterfaceErrorHandler() [2/2]

template<class T >
void flutter_runner::SetInterfaceErrorHandler ( fidl::InterfacePtr< T > &  interface,
std::string  name 
)

Definition at line 102 of file text_delegate.cc.

103 {
104 interface.set_error_handler([name](zx_status_t status) {
105 FML_LOG(ERROR) << "Interface error on: " << name << ", status: " << status;
106 });
107}

◆ SetProcessName()

static void flutter_runner::SetProcessName ( )
static

Definition at line 119 of file runner.cc.

119 {
120 std::stringstream stream;
121#if defined(DART_PRODUCT)
122 stream << "io.flutter.product_runner.";
123#else
124 stream << "io.flutter.runner.";
125#endif
127 stream << "aot";
128 } else {
129 stream << "jit";
130 }
131 const auto name = stream.str();
132 zx::process::self()->set_property(ZX_PROP_NAME, name.c_str(), name.size());
133}
static bool IsRunningPrecompiledCode()
Checks if VM instances in the process can run precompiled code. This call can be made at any time and...
Definition: dart_vm.cc:205

◆ SetThreadName()

static void flutter_runner::SetThreadName ( const std::string &  thread_name)
static

Definition at line 135 of file runner.cc.

135 {
136 zx::thread::self()->set_property(ZX_PROP_NAME, thread_name.c_str(),
137 thread_name.size());
138}

◆ TEST() [1/3]

flutter_runner::TEST ( RunnerTZDataTest  ,
LoadsWithoutTZDataPresent   
)

Definition at line 15 of file runner_tzdata_missing_unittest.cc.

15 {
16 bool success = Runner::SetupICUInternal();
17 ASSERT_TRUE(success) << "failed to load set up ICU data";
18}

◆ TEST() [2/3]

flutter_runner::TEST ( RunnerTZDataTest  ,
LoadsWithTZDataPresent   
)

Definition at line 14 of file runner_tzdata_unittest.cc.

14 {
15 // TODO(fxbug.dev/69570): Move to cml file if env_vars gains supported for the
16 // gtest_runner.
17 setenv("ICU_TIMEZONE_FILES_DIR", "/pkg/data/tzdata", true);
18
19 UErrorCode err = U_ZERO_ERROR;
20 const auto version_before = std::string(icu::TimeZone::getTZDataVersion(err));
21 ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
22
23 // This loads the tzdata. In Fuchsia, we force the data from this package
24 // to be version 2019a, so that we can test the resource load.
25 bool success = Runner::SetupICUInternal();
26 ASSERT_TRUE(success) << "failed to load timezone data";
27
28 const auto version_after = std::string(icu::TimeZone::getTZDataVersion(err));
29 ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
30
31 EXPECT_EQ("2019a", version_after);
32}

◆ TEST() [3/3]

flutter_runner::TEST ( VSyncWaiterFuchsia  ,
FrameScheduledForStartTime   
)

Definition at line 20 of file vsync_waiter_unittest.cc.

20 {
22 std::string prefix = "vsync_waiter_test";
23
25 auto platform_task_runner = fml::MessageLoop::GetCurrent().GetTaskRunner();
26
27 ThreadHost thread_host =
29 flutter::ThreadHost::Type::kUi |
30 flutter::ThreadHost::Type::kIo);
31 const flutter::TaskRunners task_runners(
32 prefix, // Dart thread labels
33 platform_task_runner, // platform
34 thread_host.raster_thread->GetTaskRunner(), // raster
35 thread_host.ui_thread->GetTaskRunner(), // ui
36 thread_host.io_thread->GetTaskRunner() // io
37 );
38
39 // await vsync will invoke the callback right away, but vsync waiter will post
40 // the task for frame_start time.
41 VsyncWaiter vsync_waiter(
43 const auto now = fml::TimePoint::Now();
44 const auto frame_start = now + fml::TimeDelta::FromMilliseconds(20);
45 const auto frame_end = now + fml::TimeDelta::FromMilliseconds(36);
46 callback(frame_start, frame_end);
47 },
48 /*secondary callback*/ nullptr, task_runners);
49
51 task_runners.GetUITaskRunner()->PostTask([&]() {
52 vsync_waiter.AsyncWaitForVsync(
53 [&](std::unique_ptr<flutter::FrameTimingsRecorder> recorder) {
54 const auto now = fml::TimePoint::Now();
55 EXPECT_GT(now, recorder->GetVsyncStartTime());
56 latch.Signal();
57 });
58 });
59
60 latch.Wait();
61}
static void EnsureInitializedForCurrentThread()
Definition: message_loop.cc:27
fml::RefPtr< fml::TaskRunner > GetTaskRunner() const
Definition: message_loop.cc:56
static FML_EMBEDDER_ONLY MessageLoop & GetCurrent()
Definition: message_loop.cc:19
static constexpr TimeDelta FromMilliseconds(int64_t millis)
Definition: time_delta.h:46
static TimePoint Now()
Definition: time_point.cc:49
@ kRaster
Suitable for thread which raster data.
Definition: embedder.h:266
FlKeyEvent uint64_t FlKeyResponderAsyncCallback callback
std::function< void(fml::TimePoint, fml::TimePoint)> FireCallbackCallback
Definition: vsync_waiter.h:20
The collection of all the threads used by the engine.
Definition: thread_host.h:21

◆ UniqueFDIONSCreate()

UniqueFDIONS flutter_runner::UniqueFDIONSCreate ( )
inline

Definition at line 27 of file unique_fdio_ns.h.

27 {
28 fdio_ns_t* ns = nullptr;
29 if (fdio_ns_create(&ns) == ZX_OK) {
30 return UniqueFDIONS{ns};
31 }
32 return UniqueFDIONS{nullptr};
33}
fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits > UniqueFDIONS

Variable Documentation

◆ fup_MAX_INJECT

const auto flutter_runner::fup_MAX_INJECT = fuchsia::ui::pointerinjector::MAX_INJECT

Definition at line 21 of file pointer_injector_delegate.cc.

◆ kAccessibilityChannel

constexpr char flutter_runner::kAccessibilityChannel[] = "flutter/accessibility"
staticconstexpr

Definition at line 52 of file platform_view.cc.

◆ kFlutterImplicitViewId

constexpr int64_t flutter_runner::kFlutterImplicitViewId = 0ll
staticconstexpr

Definition at line 57 of file platform_view.cc.

◆ kFlutterPlatformChannel

constexpr char flutter_runner::kFlutterPlatformChannel[] = "flutter/platform"
staticconstexpr

Definition at line 51 of file platform_view.cc.

◆ kFlutterPlatformViewsChannel

constexpr char flutter_runner::kFlutterPlatformViewsChannel[] = "flutter/platform_views"
staticconstexpr

Definition at line 53 of file platform_view.cc.

◆ kFuchsiaChildViewChannel

constexpr char flutter_runner::kFuchsiaChildViewChannel[] = "fuchsia/child_view"
staticconstexpr

Definition at line 56 of file platform_view.cc.

◆ kFuchsiaInputTestChannel

constexpr char flutter_runner::kFuchsiaInputTestChannel[] = "fuchsia/input_test"
staticconstexpr

Definition at line 55 of file platform_view.cc.

◆ kFuchsiaShaderWarmupChannel

constexpr char flutter_runner::kFuchsiaShaderWarmupChannel[] = "fuchsia/shader_warmup"
staticconstexpr

Definition at line 54 of file platform_view.cc.

◆ kInitialFlatlandVsyncOffset

constexpr fml::TimeDelta flutter_runner::kInitialFlatlandVsyncOffset
staticconstexpr
Initial value:

Definition at line 46 of file flatland_connection.h.

◆ kInputActionKey

constexpr char flutter_runner::kInputActionKey[] = "inputAction"
staticconstexpr

Definition at line 25 of file text_delegate.cc.

◆ kKeyEventChannel

constexpr char flutter_runner::kKeyEventChannel[] = "flutter/keyevent"
constexpr

The channel name used for key event platform messages.

Definition at line 30 of file text_delegate.h.

◆ kMaxFences

constexpr size_t flutter_runner::kMaxFences
staticconstexpr
Initial value:
=
fuchsia::ui::composition::MAX_ACQUIRE_RELEASE_FENCE_COUNT

Definition at line 29 of file flatland_connection.h.

◆ kTextInputActionDone

constexpr char flutter_runner::kTextInputActionDone[] = "TextInputAction.done"
staticconstexpr

Definition at line 29 of file text_delegate.cc.

◆ kTextInputActionGo

constexpr char flutter_runner::kTextInputActionGo[] = "TextInputAction.go"
staticconstexpr

Definition at line 31 of file text_delegate.cc.

◆ kTextInputActionNewline

constexpr char flutter_runner::kTextInputActionNewline[] = "TextInputAction.newline"
staticconstexpr

Definition at line 30 of file text_delegate.cc.

◆ kTextInputActionNext

constexpr char flutter_runner::kTextInputActionNext[] = "TextInputAction.next"
staticconstexpr

Definition at line 32 of file text_delegate.cc.

◆ kTextInputActionNone

constexpr char flutter_runner::kTextInputActionNone[] = "TextInputAction.none"
staticconstexpr

Definition at line 34 of file text_delegate.cc.

◆ kTextInputActionPrevious

constexpr char flutter_runner::kTextInputActionPrevious[] = "TextInputAction.previous"
staticconstexpr

Definition at line 33 of file text_delegate.cc.

◆ kTextInputActionSearch

constexpr char flutter_runner::kTextInputActionSearch[] = "TextInputAction.search"
staticconstexpr

Definition at line 35 of file text_delegate.cc.

◆ kTextInputActionSend

constexpr char flutter_runner::kTextInputActionSend[] = "TextInputAction.send"
staticconstexpr

Definition at line 36 of file text_delegate.cc.

◆ kTextInputActionUnspecified

constexpr char flutter_runner::kTextInputActionUnspecified[]
staticconstexpr
Initial value:
=
"TextInputAction.unspecified"

Definition at line 37 of file text_delegate.cc.

◆ kTextInputChannel

constexpr char flutter_runner::kTextInputChannel[] = "flutter/textinput"
constexpr

The channel name used for text editing platofrm messages.

Definition at line 27 of file text_delegate.h.