Flutter Engine
flutter_runner Namespace Reference

Namespaces

 testing
 

Classes

class  AccessibilityBridge
 
struct  ActiveApplication
 
class  Application
 
class  CompatTaskRunner
 
class  CompositorContext
 
class  Engine
 
class  FileInNamespaceBuffer
 
class  FlutterRunnerProductConfiguration
 
class  FuchsiaExternalViewEmbedder
 
class  IsolateConfigurator
 
class  PlatformView
 
class  Runner
 
class  ScopedFrame
 
class  SessionConnection
 
class  Surface
 
class  SurfaceProducer
 
class  SurfaceProducerSurface
 
class  Thread
 
struct  UniqueFDIONSTraits
 
struct  VsyncInfo
 
class  VsyncRecorder
 
class  VsyncWaiter
 
struct  VulkanImage
 
class  VulkanSurface
 
class  VulkanSurfacePool
 
class  VulkanSurfaceProducer
 

Typedefs

using OnEnableWireframe = fit::function< void(bool)>
 
using OnCreateView = fit::function< void(int64_t, bool, bool)>
 
using OnUpdateView = fit::function< void(int64_t, bool, bool)>
 
using OnDestroyView = fit::function< void(int64_t)>
 
using OnCreateSurface = fit::function< std::unique_ptr< flutter::Surface >()>
 
using on_frame_presented_event = std::function< void(fuchsia::scenic::scheduling::FramePresentedInfo)>
 
typedef void(* ThreadEntry) (Thread *)
 
using UniqueFDIONS = fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits >
 

Functions

static uint32_t FlutterIdToFuchsiaId (int32_t flutter_node_id)
 
static void PrintNodeSizeError (uint32_t node_id)
 
static std::string DebugLabelForURL (const std::string &url)
 
static std::unique_ptr< fml::FileMappingMakeFileMapping (const char *path, bool executable)
 
static flutter::MappingCallback MakeDataFileMapping (const char *absolute_path, bool executable=false)
 
std::unique_ptr< fml::MappingCreateWithContentsOfFile (int namespace_fd, const char *file_path, bool executable)
 
static void CreateCompilationTrace (Dart_Isolate isolate)
 
std::vector< uint8_t > MakeLocalizationPlatformMessageData (const Profile &intl_profile)
 
std::vector< uint8_t > MakeLocalizationPlatformMessageData (const fuchsia::intl::Profile &intl_profile)
 
async::Loop * MakeObservableLoop (bool attachToThread)
 
template<class T >
void SetInterfaceErrorHandler (fidl::InterfacePtr< T > &interface, std::string name)
 
template<class T >
void SetInterfaceErrorHandler (fidl::Binding< T > &binding, std::string name)
 
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 (RunnerTest, TZData)
 
void ExecuteAfterTaskObservers ()
 
void CurrentMessageLoopAddAfterTaskObserver (intptr_t key, fit::closure observer)
 
void CurrentMessageLoopRemoveAfterTaskObserver (intptr_t key)
 
fml::RefPtr< fml::TaskRunnerCreateFMLTaskRunner (async_dispatcher_t *dispatcher)
 
UniqueFDIONS UniqueFDIONSCreate ()
 
bool CreateVulkanImage (vulkan::VulkanProvider &vulkan_provider, const SkISize &size, VulkanImage *out_vulkan_image)
 

Variables

constexpr char kDataKey [] = "data"
 
constexpr char kAssetsKey [] = "assets"
 
constexpr char kTmpPath [] = "/tmp"
 
constexpr char kServiceRootPath [] = "/svc"
 
constexpr char kRunnerConfigPath [] = "/config/data/flutter_runner_config"
 
static constexpr char kFlutterPlatformChannel [] = "flutter/platform"
 
static constexpr char kTextInputChannel [] = "flutter/textinput"
 
static constexpr char kKeyEventChannel [] = "flutter/keyevent"
 
static constexpr char kAccessibilityChannel [] = "flutter/accessibility"
 
static constexpr char kFlutterPlatformViewsChannel [] = "flutter/platform_views"
 
thread_local std::map< intptr_t, fit::closure > tTaskObservers
 

Typedef Documentation

◆ on_frame_presented_event

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

Definition at line 20 of file session_connection.h.

◆ OnCreateSurface

using flutter_runner::OnCreateSurface = typedef fit::function<std::unique_ptr<flutter::Surface>()>

Definition at line 31 of file platform_view.h.

◆ OnCreateView

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

Definition at line 28 of file platform_view.h.

◆ OnDestroyView

using flutter_runner::OnDestroyView = typedef fit::function<void(int64_t)>

Definition at line 30 of file platform_view.h.

◆ OnEnableWireframe

using flutter_runner::OnEnableWireframe = typedef fit::function<void(bool)>

Definition at line 27 of file platform_view.h.

◆ OnUpdateView

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

Definition at line 29 of file platform_view.h.

◆ ThreadEntry

typedef void(* flutter_runner::ThreadEntry) (Thread *)

Definition at line 18 of file thread.cc.

◆ UniqueFDIONS

Definition at line 24 of file unique_fdio_ns.h.

Function Documentation

◆ CreateCompilationTrace()

static void flutter_runner::CreateCompilationTrace ( Dart_Isolate  isolate)
static

Definition at line 431 of file engine.cc.

References engine, FML_CHECK, FML_DLOG, FML_LOG, fml::TimeDelta::FromSeconds(), tonic::LogIfError(), flutter_runner::Engine::Delegate::OnEngineTerminate(), and dart_utils::WriteFile().

431  {
432  Dart_EnterIsolate(isolate);
433 
434  {
435  Dart_EnterScope();
436  uint8_t* trace = nullptr;
437  intptr_t trace_length = 0;
438  Dart_Handle result = Dart_SaveCompilationTrace(&trace, &trace_length);
439  tonic::LogIfError(result);
440 
441  for (intptr_t start = 0; start < trace_length;) {
442  intptr_t end = start;
443  while ((end < trace_length) && trace[end] != '\n')
444  end++;
445 
446  std::string line(reinterpret_cast<char*>(&trace[start]), end - start);
447  FML_LOG(INFO) << "compilation-trace: " << line;
448 
449  start = end + 1;
450  }
451 
452  Dart_ExitScope();
453  }
454 
455  // Re-enter Dart scope to release the compilation trace's memory.
456 
457  {
458  Dart_EnterScope();
459  uint8_t* feedback = nullptr;
460  intptr_t feedback_length = 0;
461  Dart_Handle result = Dart_SaveTypeFeedback(&feedback, &feedback_length);
462  tonic::LogIfError(result);
463  const std::string kTypeFeedbackFile = "/data/dart_type_feedback.bin";
464  if (dart_utils::WriteFile(kTypeFeedbackFile,
465  reinterpret_cast<const char*>(feedback),
466  feedback_length)) {
467  FML_LOG(INFO) << "Dart type feedback written to " << kTypeFeedbackFile;
468  } else {
469  FML_LOG(ERROR) << "Could not write Dart type feedback to "
470  << kTypeFeedbackFile;
471  }
472  Dart_ExitScope();
473  }
474 
475  Dart_ExitIsolate();
476 }
bool WriteFile(const std::string &path, const char *data, ssize_t size)
Definition: files.cc:69
#define FML_LOG(severity)
Definition: logging.h:65
bool LogIfError(Dart_Handle handle)
Definition: dart_error.cc:15

◆ CreateFMLTaskRunner()

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

Definition at line 51 of file task_runner_adapter.cc.

Referenced by flutter_runner::Engine::Engine(), MakeDataFileMapping(), flutter_runner_test::TEST_F(), and flutter_runner::testing::TEST_F().

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

◆ CreateVulkanImage()

bool flutter_runner::CreateVulkanImage ( vulkan::VulkanProvider vulkan_provider,
const SkISize &  size,
VulkanImage out_vulkan_image 
)

Definition at line 43 of file vulkan_surface.cc.

References FML_DCHECK, TRACE_EVENT0, vulkan::VulkanProvider::vk(), VK_CALL_LOG_ERROR, vulkan::VulkanProvider::vk_device(), flutter_runner::VulkanImage::vk_external_image_create_info, flutter_runner::VulkanImage::vk_image, flutter_runner::VulkanImage::vk_image_create_info, and flutter_runner::VulkanImage::vk_memory_requirements.

Referenced by flutter_runner::VulkanSurfacePool::AcquireSurface(), and flutter_runner::VulkanSurface::GetSize().

45  {
46  TRACE_EVENT0("flutter", "CreateVulkanImage");
47 
48  FML_DCHECK(!size.isEmpty());
49  FML_DCHECK(out_vulkan_image != nullptr);
50 
51  // The image creation parameters need to be the same as those in scenic
52  // (src/ui/scenic/lib/gfx/resources/gpu_image.cc and
53  // src/ui/lib/escher/util/image_utils.cc) or else the different vulkan
54  // devices may interpret the bytes differently.
55  // TODO(SCN-1369): Use API to coordinate this with scenic.
56  out_vulkan_image->vk_external_image_create_info = {
57  .sType = VK_STRUCTURE_TYPE_EXTERNAL_MEMORY_IMAGE_CREATE_INFO,
58  .pNext = nullptr,
59  .handleTypes = VK_EXTERNAL_MEMORY_HANDLE_TYPE_TEMP_ZIRCON_VMO_BIT_FUCHSIA,
60  };
61  out_vulkan_image->vk_image_create_info = {
62  .sType = VK_STRUCTURE_TYPE_IMAGE_CREATE_INFO,
63  .pNext = &out_vulkan_image->vk_external_image_create_info,
64  .flags = kVulkanImageCreateFlags,
65  .imageType = VK_IMAGE_TYPE_2D,
66  .format = kVulkanFormat,
67  .extent = VkExtent3D{static_cast<uint32_t>(size.width()),
68  static_cast<uint32_t>(size.height()), 1},
69  .mipLevels = 1,
70  .arrayLayers = 1,
71  .samples = VK_SAMPLE_COUNT_1_BIT,
72  .tiling = VK_IMAGE_TILING_OPTIMAL,
73  .usage = VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT |
74  VK_IMAGE_USAGE_TRANSFER_DST_BIT |
75  VK_IMAGE_USAGE_TRANSFER_SRC_BIT | VK_IMAGE_USAGE_SAMPLED_BIT,
76  .sharingMode = VK_SHARING_MODE_EXCLUSIVE,
77  .queueFamilyIndexCount = 0,
78  .pQueueFamilyIndices = nullptr,
79  .initialLayout = VK_IMAGE_LAYOUT_UNDEFINED,
80  };
81 
82  {
83  VkImage vk_image = VK_NULL_HANDLE;
84 
85  if (VK_CALL_LOG_ERROR(vulkan_provider.vk().CreateImage(
86  vulkan_provider.vk_device(),
87  &out_vulkan_image->vk_image_create_info, nullptr, &vk_image)) !=
88  VK_SUCCESS) {
89  return false;
90  }
91 
92  out_vulkan_image->vk_image = {
93  vk_image, [&vulkan_provider = vulkan_provider](VkImage image) {
94  vulkan_provider.vk().DestroyImage(vulkan_provider.vk_device(), image,
95  NULL);
96  }};
97  }
98 
99  vulkan_provider.vk().GetImageMemoryRequirements(
100  vulkan_provider.vk_device(), out_vulkan_image->vk_image,
101  &out_vulkan_image->vk_memory_requirements);
102 
103  return true;
104 }
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:75
#define FML_DCHECK(condition)
Definition: logging.h:86
constexpr std::size_t size(T(&array)[N])
Definition: size.h:13
virtual const vulkan::VulkanHandle< VkDevice > & vk_device()=0
#define VK_CALL_LOG_ERROR(expression)
virtual const vulkan::VulkanProcTable & vk()=0

◆ CreateWithContentsOfFile()

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

Definition at line 518 of file component.cc.

References flutter::DartVMRef::Create(), FML_CHECK, FML_DLOG, FML_LOG, FML_TRACE_EVENT, flutter_runner::Engine::GetEngineReturnCode(), flutter::DartVM::IsRunningPrecompiledCode(), and settings_.

520  {
521  FML_TRACE_EVENT("flutter", "LoadFile", "path", file_path);
522  auto source = std::make_unique<FileInNamespaceBuffer>(namespace_fd, file_path,
523  executable);
524  return source->GetMapping() == nullptr ? nullptr : std::move(source);
525 }
#define FML_TRACE_EVENT(category_group, name,...)
Definition: trace_event.h:71

◆ CurrentMessageLoopAddAfterTaskObserver()

void flutter_runner::CurrentMessageLoopAddAfterTaskObserver ( intptr_t  key,
fit::closure  observer 
)

Definition at line 19 of file task_observers.cc.

Referenced by MakeDataFileMapping().

20  {
21  if (observer) {
22  tTaskObservers[key] = std::move(observer);
23  }
24 }
thread_local std::map< intptr_t, fit::closure > tTaskObservers

◆ CurrentMessageLoopRemoveAfterTaskObserver()

void flutter_runner::CurrentMessageLoopRemoveAfterTaskObserver ( intptr_t  key)

Definition at line 26 of file task_observers.cc.

Referenced by MakeDataFileMapping().

26  {
27  tTaskObservers.erase(key);
28 }
thread_local std::map< intptr_t, fit::closure > tTaskObservers

◆ DebugLabelForURL()

static std::string flutter_runner::DebugLabelForURL ( const std::string &  url)
static

Definition at line 105 of file component.cc.

Referenced by MakeDataFileMapping().

105  {
106  auto found = url.rfind("/");
107  if (found == std::string::npos) {
108  return url;
109  } else {
110  return {url, found + 1};
111  }
112 }

◆ ExecuteAfterTaskObservers()

void flutter_runner::ExecuteAfterTaskObservers ( )

Definition at line 13 of file task_observers.cc.

13  {
14  for (const auto& callback : tTaskObservers) {
15  callback.second();
16  }
17 }
thread_local std::map< intptr_t, fit::closure > tTaskObservers

◆ FlutterIdToFuchsiaId()

static uint32_t flutter_runner::FlutterIdToFuchsiaId ( int32_t  flutter_node_id)
static

Definition at line 217 of file accessibility_bridge.cc.

References FML_DCHECK, flutter_runner::AccessibilityBridge::kMaxMessageSize, and flutter_runner::AccessibilityBridge::kNodeIdSize.

Referenced by flutter_runner::AccessibilityBridge::AddSemanticsNodeUpdate().

217  {
218  FML_DCHECK(flutter_node_id >= 0)
219  << "Unexpectedly recieved a negative semantics node ID.";
220  return static_cast<uint32_t>(flutter_node_id);
221 }
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ GetChangeFromPointerEventPhase()

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

Definition at line 401 of file platform_view.cc.

References flutter::PointerData::kAdd, flutter::PointerData::kCancel, flutter::PointerData::kDown, flutter::PointerData::kHover, flutter::PointerData::kMove, flutter::PointerData::kRemove, and flutter::PointerData::kUp.

Referenced by PointerTraceHACK().

402  {
403  switch (phase) {
404  case fuchsia::ui::input::PointerEventPhase::ADD:
406  case fuchsia::ui::input::PointerEventPhase::HOVER:
408  case fuchsia::ui::input::PointerEventPhase::DOWN:
410  case fuchsia::ui::input::PointerEventPhase::MOVE:
412  case fuchsia::ui::input::PointerEventPhase::UP:
414  case fuchsia::ui::input::PointerEventPhase::REMOVE:
416  case fuchsia::ui::input::PointerEventPhase::CANCEL:
418  default:
420  }
421 }
FlutterPointerPhase phase
Definition: fl_view.cc:78

◆ GetKindFromPointerType()

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

Definition at line 423 of file platform_view.cc.

References flutter::PointerData::kMouse, and flutter::PointerData::kTouch.

Referenced by PointerTraceHACK().

424  {
425  switch (type) {
426  case fuchsia::ui::input::PointerEventType::TOUCH:
428  case fuchsia::ui::input::PointerEventType::MOUSE:
430  default:
432  }
433 }

◆ MakeDataFileMapping()

static flutter::MappingCallback flutter_runner::MakeDataFileMapping ( const char *  absolute_path,
bool  executable = false 
)
static

Definition at line 146 of file component.cc.

References flutter::Settings::advisory_script_entrypoint, flutter::Settings::advisory_script_uri, flutter::Settings::application_kernel_list_asset, flutter::Settings::assets_dir, CreateFMLTaskRunner(), CurrentMessageLoopAddAfterTaskObserver(), CurrentMessageLoopRemoveAfterTaskObserver(), flutter::Settings::dart_entrypoint_args, flutter::Settings::dart_flags, DebugLabelForURL(), flutter::Settings::disable_dart_asserts, flutter::Settings::enable_observatory, error, FML_DCHECK, FML_DLOG, FML_LOG, fml::UniqueObject< T, Traits >::get(), dart_utils::HandleException(), flutter::Settings::icu_data_path, fml::UniqueObject< T, Traits >::is_valid(), flutter::Settings::isolate_snapshot_data, flutter::Settings::isolate_snapshot_instr, flutter::Settings::log_tag, MakeFileMapping(), flutter::Settings::observatory_host, OPEN_RIGHT_READABLE, flutter_runner::Application::ParseProgramMetadata(), flutter::path, dart_utils::ReadFileToString(), dart_utils::ReadFileToStringAt(), fml::UniqueObject< T, Traits >::reset(), dart_utils::RunnerTemp::SetupComponent(), flutter::Settings::task_observer_add, flutter::Settings::task_observer_remove, flutter::Settings::trace_skia, flutter::Settings::unhandled_exception_callback, flutter::Settings::verbose_logging, flutter::Settings::vm_snapshot_data, flutter::Settings::vm_snapshot_instr, and flutter_runner::Application::~Application().

147  {
148  return [absolute_path, executable = executable](void) {
149  return MakeFileMapping(absolute_path, executable);
150  };
151 }
static std::unique_ptr< fml::FileMapping > MakeFileMapping(const char *path, bool executable)
Definition: component.cc:114

◆ MakeFileMapping()

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

Definition at line 114 of file component.cc.

References flutter::flags, OPEN_RIGHT_EXECUTABLE, and OPEN_RIGHT_READABLE.

Referenced by MakeDataFileMapping().

115  {
116  uint32_t flags = OPEN_RIGHT_READABLE;
117  if (executable) {
118  flags |= OPEN_RIGHT_EXECUTABLE;
119  }
120 
121  int fd = 0;
122  // The returned file descriptor is compatible with standard posix operations
123  // such as close, mmap, etc. We only need to treat open/open_at specially.
124  zx_status_t status = fdio_open_fd(path, flags, &fd);
125 
126  if (status != ZX_OK) {
127  return nullptr;
128  }
129 
130  using Protection = fml::FileMapping::Protection;
131 
132  std::initializer_list<Protection> protection_execute = {Protection::kRead,
133  Protection::kExecute};
134  std::initializer_list<Protection> protection_read = {Protection::kRead};
135  auto mapping = std::make_unique<fml::FileMapping>(
136  fml::UniqueFD{fd}, executable ? protection_execute : protection_read);
137 
138  if (!mapping->IsValid()) {
139  return nullptr;
140  }
141 
142  return mapping;
143 }
DEF_SWITCHES_START snapshot asset path
Definition: switches.h:32
constexpr uint32_t OPEN_RIGHT_EXECUTABLE
Definition: component.cc:50
constexpr uint32_t OPEN_RIGHT_READABLE
Definition: component.cc:47
DEF_SWITCHES_START snapshot asset Path to the directory containing the four files specified by VmSnapshotInstructions and IsolateSnapshotInstructions vm snapshot The VM instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present isolate snapshot The isolate instructions snapshot that will be memory mapped as read and executable SnapshotAssetPath must be present icu symbol Prefix for the symbols representing ICU data linked into the Flutter library dart flags
Definition: switches.h:66

◆ MakeLocalizationPlatformMessageData() [1/2]

std::vector<uint8_t> flutter_runner::MakeLocalizationPlatformMessageData ( const fuchsia::intl::Profile &  intl_profile)

◆ MakeLocalizationPlatformMessageData() [2/2]

std::vector<uint8_t> flutter_runner::MakeLocalizationPlatformMessageData ( const Profile &  intl_profile)

Definition at line 30 of file fuchsia_intl.cc.

References args, FML_LOG, and flutter::transform.

31  {
32  rapidjson::Document document;
33  auto& allocator = document.GetAllocator();
34  document.SetObject();
35  document.AddMember("method", "setLocale", allocator);
36  rapidjson::Value args(rapidjson::kArrayType);
37 
38  for (const auto& locale_id : intl_profile.locales()) {
39  UErrorCode error_code = U_ZERO_ERROR;
40  icu::Locale locale = icu::Locale::forLanguageTag(locale_id.id, error_code);
41  if (U_FAILURE(error_code)) {
42  FML_LOG(ERROR) << "Error parsing locale ID \"" << locale_id.id << "\"";
43  continue;
44  }
45  args.PushBack(rapidjson::Value().SetString(locale.getLanguage(), allocator),
46  allocator);
47 
48  auto country = locale.getCountry() != nullptr ? locale.getCountry() : "";
49  args.PushBack(rapidjson::Value().SetString(country, allocator), allocator);
50 
51  auto script = locale.getScript() != nullptr ? locale.getScript() : "";
52  args.PushBack(rapidjson::Value().SetString(script, allocator), allocator);
53 
54  std::string variant =
55  locale.getVariant() != nullptr ? locale.getVariant() : "";
56  // ICU4C capitalizes the variant for backward compatibility, even though
57  // the preferred form is lowercase. So we lowercase here.
58  std::transform(begin(variant), end(variant), begin(variant),
59  [](unsigned char c) { return std::tolower(c); });
60  args.PushBack(rapidjson::Value().SetString(variant, allocator), allocator);
61  }
62 
63  document.AddMember("args", args, allocator);
64 
65  rapidjson::StringBuffer buffer;
66  rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
67  document.Accept(writer);
68  auto data = reinterpret_cast<const uint8_t*>(buffer.GetString());
69  return std::vector<uint8_t>(data, data + buffer.GetSize());
70 }
G_BEGIN_DECLS FlValue * args
#define FML_LOG(severity)
Definition: logging.h:65

◆ MakeObservableLoop()

async::Loop * flutter_runner::MakeObservableLoop ( bool  attachToThread)

Definition at line 42 of file loop.cc.

Referenced by main(), and flutter_runner::Thread::Thread().

42  {
43  return new async::Loop(
44  &(attachToThread ? kAttachedLoopConfig : kDetachedLoopConfig));
45 }

◆ PointerTraceHACK()

◆ PrintNodeSizeError()

static void flutter_runner::PrintNodeSizeError ( uint32_t  node_id)
static

Definition at line 249 of file accessibility_bridge.cc.

References FML_LOG.

Referenced by flutter_runner::AccessibilityBridge::AddSemanticsNodeUpdate().

249  {
250  FML_LOG(ERROR) << "Semantics node with ID " << node_id
251  << " exceeded the maximum FIDL message size and may not "
252  "be delivered to the accessibility manager service.";
253 }
#define FML_LOG(severity)
Definition: logging.h:65

◆ RegisterProfilerSymbols()

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

Definition at line 138 of file runner.cc.

References FML_LOG, and dart_utils::ReadFileToString().

Referenced by flutter_runner::Runner::Runner().

139  {
140  std::string* symbols = new std::string();
141  if (dart_utils::ReadFileToString(symbols_path, symbols)) {
142  Dart_AddSymbols(dso_name, symbols->data(), symbols->size());
143  } else {
144  FML_LOG(ERROR) << "Failed to load " << symbols_path;
145  }
146 }
#define FML_LOG(severity)
Definition: logging.h:65
bool ReadFileToString(const std::string &path, std::string *result)
Definition: files.cc:56

◆ SetInterfaceErrorHandler() [1/2]

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

Definition at line 40 of file platform_view.cc.

References FML_LOG, and name.

Referenced by flutter_runner::PlatformView::PlatformView().

41  {
42  interface.set_error_handler([name](zx_status_t status) {
43  FML_LOG(ERROR) << "Interface error on: " << name;
44  });
45 }
#define FML_LOG(severity)
Definition: logging.h:65
const char * name
Definition: fuchsia.cc:50

◆ SetInterfaceErrorHandler() [2/2]

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

Definition at line 47 of file platform_view.cc.

References FML_LOG, and name.

47  {
48  binding.set_error_handler([name](zx_status_t status) {
49  FML_LOG(ERROR) << "Interface error on: " << name;
50  });
51 }
#define FML_LOG(severity)
Definition: logging.h:65
const char * name
Definition: fuchsia.cc:50

◆ SetProcessName()

static void flutter_runner::SetProcessName ( )
static

Definition at line 115 of file runner.cc.

References flutter::DartVM::IsRunningPrecompiledCode(), and name.

Referenced by flutter_runner::Runner::Runner().

115  {
116  std::stringstream stream;
117 #if defined(DART_PRODUCT)
118  stream << "io.flutter.product_runner.";
119 #else
120  stream << "io.flutter.runner.";
121 #endif
123  stream << "aot";
124  } else {
125  stream << "jit";
126  }
127  const auto name = stream.str();
128  zx::process::self()->set_property(ZX_PROP_NAME, name.c_str(), name.size());
129 }
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:199
const char * name
Definition: fuchsia.cc:50

◆ SetThreadName()

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

Definition at line 131 of file runner.cc.

Referenced by flutter_runner::Runner::Runner().

131  {
132  zx::thread::self()->set_property(ZX_PROP_NAME, thread_name.c_str(),
133  thread_name.size());
134 }

◆ TEST() [1/2]

flutter_runner::TEST ( RunnerTest  ,
TZData   
)

Definition at line 12 of file runner_unittest.cc.

12  {
13  UErrorCode err = U_ZERO_ERROR;
14  const auto version_before = std::string(icu::TimeZone::getTZDataVersion(err));
15  ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
16 
17  // This loads the tzdata. In Fuchsia, we force the data from this package
18  // to be version 2019a, so that we can test the resource load.
19  bool success = Runner::SetupICUInternal();
20  ASSERT_TRUE(success) << "failed to load timezone data";
21 
22  const auto version_after = std::string(icu::TimeZone::getTZDataVersion(err));
23  ASSERT_EQ(U_ZERO_ERROR, err) << "unicode error: " << u_errorName(err);
24 
25  EXPECT_EQ("2019a", version_after);
26 }

◆ TEST() [2/2]

flutter_runner::TEST ( RunnerTZDataTest  ,
LoadsWithoutTZDataPresent   
)

Definition at line 15 of file runner_tzdata_unittest.cc.

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

◆ UniqueFDIONSCreate()

UniqueFDIONS flutter_runner::UniqueFDIONSCreate ( )
inline

Definition at line 26 of file unique_fdio_ns.h.

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

Variable Documentation

◆ kAccessibilityChannel

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

◆ kAssetsKey

constexpr char flutter_runner::kAssetsKey[] = "assets"

Definition at line 55 of file component.cc.

◆ kDataKey

constexpr char flutter_runner::kDataKey[] = "data"

Definition at line 54 of file component.cc.

◆ kFlutterPlatformChannel

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

◆ kFlutterPlatformViewsChannel

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

◆ kKeyEventChannel

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

Definition at line 34 of file platform_view.cc.

◆ kRunnerConfigPath

constexpr char flutter_runner::kRunnerConfigPath[] = "/config/data/flutter_runner_config"

Definition at line 58 of file component.cc.

◆ kServiceRootPath

constexpr char flutter_runner::kServiceRootPath[] = "/svc"

Definition at line 57 of file component.cc.

◆ kTextInputChannel

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

◆ kTmpPath

constexpr char flutter_runner::kTmpPath[] = "/tmp"

Definition at line 56 of file component.cc.

◆ tTaskObservers

thread_local std::map<intptr_t, fit::closure> flutter_runner::tTaskObservers

Definition at line 11 of file task_observers.cc.