Flutter Engine
fml Namespace Reference

Namespaces

 benchmarking
 
 icu
 
 internal
 
 jni
 
 paths
 
 state
 
 testing
 
 tracing
 

Classes

class  AsciiTrie
 A trie for looking for ASCII prefixes. More...
 
class  AtomicObject
 
class  AutoResetWaitableEvent
 
class  BasicTaskRunner
 An interface over the ability to schedule tasks on a TaskRunner. More...
 
class  BitConverter
 
class  CFRef
 
class  ChronoTimestampProvider
 
class  CommandLine
 
class  ConcurrentMessageLoop
 
class  ConcurrentTaskRunner
 
class  CountDownLatch
 
class  DataMapping
 
struct  DebugTaskRunnerChecker
 
struct  DebugThreadChecker
 
class  DelayedTask
 
class  FileMapping
 
class  LogMessage
 
class  LogMessageVoidify
 
struct  LogSettings
 
class  MallocMapping
 A Mapping like NonOwnedMapping, but uses Free as its release proc. More...
 
class  ManualResetWaitableEvent
 
class  Mapping
 
class  MessageLoop
 
class  MessageLoopAndroid
 
class  MessageLoopDarwin
 
class  MessageLoopFuchsia
 
class  MessageLoopImpl
 
class  MessageLoopLinux
 
class  MessageLoopTaskQueues
 
class  MessageLoopWin
 
class  NativeLibrary
 
class  NonOwnedMapping
 
class  PlatformSemaphore
 
class  RasterThreadMerger
 
class  RefCountedThreadSafe
 
class  RefPtr
 
class  scoped_nsobject
 
class  scoped_nsobject< id >
 
class  scoped_nsobject< NSAutoreleasePool >
 
class  scoped_nsprotocol
 
class  ScopedBlock
 
class  ScopedCleanupClosure
 Wraps a closure that is invoked in the destructor unless released by the caller. More...
 
class  ScopedSetLogSettings
 
class  ScopedTemporaryDirectory
 
class  Semaphore
 A traditional counting semaphore. Waits decrement the counter and Signal increments it. More...
 
class  SharedLock
 
class  SharedMutex
 
class  SharedMutexPosix
 
class  SharedMutexStd
 
class  SharedThreadMerger
 
class  Status
 
class  SymbolMapping
 
class  SyncSwitch
 
class  TaskQueueEntry
 
class  TaskQueueId
 
class  TaskRunner
 
class  TaskRunnerAffineWeakPtr
 
class  TaskRunnerAffineWeakPtrFactory
 
class  TaskRunnerChecker
 
class  TaskSource
 
class  Thread
 
class  ThreadChecker
 
class  ThreadLocalUniquePtr
 
class  TimeDelta
 
class  TimePoint
 
class  TimestampProvider
 
class  UniqueLock
 
struct  UniqueLooperTraits
 
class  UniqueObject
 
class  Wakeable
 
class  WeakPtr
 
class  WeakPtrFactory
 

Typedefs

typedef AsciiTrie::TrieNode TrieNode
 
typedef AsciiTrie::TrieNodePtr TrieNodePtr
 
using Base32DecodeConverter = BitConverter< 5, 8, 16 >
 
using Base32EncodeConverter = BitConverter< 8, 5, 16 >
 
using closure = std::function< void()>
 
using DelayedTaskQueue = std::priority_queue< DelayedTask, std::deque< DelayedTask >, std::greater< DelayedTask > >
 
using FileVisitor = std::function< bool(const fml::UniqueFD &directory, const std::string &filename)>
 
typedef int LogSeverity
 
using WideStringConverter = std::wstring_convert< std::codecvt_utf8_utf16< wchar_t >, wchar_t >
 
typedef void * RasterThreadMergerId
 
using Utf16StringConverter = std::wstring_convert< std::codecvt_utf8_utf16< char16_t >, char16_t >
 
using Milliseconds = std::chrono::duration< double, std::milli >
 
using UniqueFD = UniqueObject< int, internal::os_unix::UniqueFDTraits >
 
using UniqueDir = UniqueObject< DIR *, internal::os_unix::UniqueDirTraits >
 

Enumerations

enum  FilePermission {
  FilePermission::kRead,
  FilePermission::kWrite,
  FilePermission::kReadWrite
}
 
enum  FlushType {
  FlushType::kSingle,
  FlushType::kAll
}
 
enum  OwnershipPolicy {
  OwnershipPolicy::Assume,
  OwnershipPolicy::Retain
}
 
enum  RasterThreadStatus {
  RasterThreadStatus::kRemainsMerged,
  RasterThreadStatus::kRemainsUnmerged,
  RasterThreadStatus::kUnmergedNow
}
 
enum  StatusCode {
  StatusCode::kOk,
  StatusCode::kCancelled,
  StatusCode::kUnknown,
  StatusCode::kInvalidArgument,
  StatusCode::kDeadlineExceeded,
  StatusCode::kNotFound,
  StatusCode::kAlreadyExists,
  StatusCode::kPermissionDenied,
  StatusCode::kResourceExhausted,
  StatusCode::kFailedPrecondition,
  StatusCode::kAborted,
  StatusCode::kOutOfRange,
  StatusCode::kUnimplemented,
  StatusCode::kInternal,
  StatusCode::kUnavailable,
  StatusCode::kDataLoss,
  StatusCode::kUnauthenticated
}
 
enum  TaskSourceGrade {
  TaskSourceGrade::kUserInteraction,
  TaskSourceGrade::kDartMicroTasks,
  TaskSourceGrade::kUnspecified
}
 

Functions

static std::string DemangleSymbolName (const std::string &mangled)
 
static std::string GetSymbolName (void *symbol)
 
std::string BacktraceHere (size_t offset)
 
static std::string SignalNameToString (int signal)
 
static void ToggleSignalHandlers (bool set)
 
static void SignalHandler (int signal)
 
void InstallCrashHandler ()
 
bool IsCrashHandlingSupported ()
 
std::pair< bool, std::string > Base32Encode (std::string_view input)
 
std::pair< bool, std::string > Base32Decode (const std::string &input)
 
std::vector< std::string > CommandLineToArgv (const CommandLine &command_line)
 
template<typename InputIterator >
CommandLine CommandLineFromIteratorsFindFirstPositionalArg (InputIterator first, InputIterator last, InputIterator *first_positional_arg)
 
template<typename InputIterator >
CommandLine CommandLineFromIterators (InputIterator first, InputIterator last)
 
template<typename InputIterator >
CommandLine CommandLineFromIteratorsWithArgv0 (const std::string &argv0, InputIterator first, InputIterator last)
 
CommandLine CommandLineFromArgcArgv (int argc, const char *const *argv)
 
template<typename StringType >
CommandLine CommandLineFromInitializerList (std::initializer_list< StringType > argv)
 
template<typename T , class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T ByteSwap (T n)
 Flips the endianness of the given value. The given value must be an integral type of size 1, 2, 4, or 8. More...
 
template<typename T , class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T BigEndianToArch (T n)
 Convert a known big endian value to match the endianness of the current architecture. This is effectively a cross platform ntohl/ntohs (as network byte order is always Big Endian). The given value must be an integral type of size 1, 2, 4, or 8. More...
 
template<typename T , class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T LittleEndianToArch (T n)
 Convert a known little endian value to match the endianness of the current architecture. The given value must be an integral type of size 1, 2, 4, or 8. More...
 
static fml::UniqueFD CreateDirectory (const fml::UniqueFD &base_directory, const std::vector< std::string > &components, FilePermission permission, size_t index)
 
fml::UniqueFD CreateDirectory (const fml::UniqueFD &base_directory, const std::vector< std::string > &components, FilePermission permission)
 
bool VisitFilesRecursively (const fml::UniqueFD &directory, const FileVisitor &visitor)
 
fml::UniqueFD OpenFileReadOnly (const fml::UniqueFD &base_directory, const char *path)
 
fml::UniqueFD OpenDirectoryReadOnly (const fml::UniqueFD &base_directory, const char *path)
 
bool RemoveFilesInDirectory (const fml::UniqueFD &directory)
 
bool RemoveDirectoryRecursively (const fml::UniqueFD &parent, const char *directory_name)
 
std::string CreateTemporaryDirectory ()
 
fml::UniqueFD OpenFile (const char *path, bool create_if_necessary, FilePermission permission)
 This can open a directory on POSIX, but not on Windows. More...
 
fml::UniqueFD OpenFile (const fml::UniqueFD &base_directory, const char *path, bool create_if_necessary, FilePermission permission)
 This can open a directory on POSIX, but not on Windows. More...
 
fml::UniqueFD OpenDirectory (const char *path, bool create_if_necessary, FilePermission permission)
 
fml::UniqueFD OpenDirectory (const fml::UniqueFD &base_directory, const char *path, bool create_if_necessary, FilePermission permission)
 
fml::UniqueFD Duplicate (fml::UniqueFD::element_type descriptor)
 
bool IsDirectory (const fml::UniqueFD &directory)
 
bool IsDirectory (const fml::UniqueFD &base_directory, const char *path)
 
bool IsFile (const std::string &path)
 
bool TruncateFile (const fml::UniqueFD &file, size_t size)
 
bool FileExists (const fml::UniqueFD &base_directory, const char *path)
 
bool UnlinkDirectory (const char *path)
 
bool UnlinkDirectory (const fml::UniqueFD &base_directory, const char *path)
 
bool UnlinkFile (const char *path)
 
bool UnlinkFile (const fml::UniqueFD &base_directory, const char *path)
 
bool WriteAtomically (const fml::UniqueFD &base_directory, const char *file_name, const Mapping &mapping)
 
bool VisitFiles (const fml::UniqueFD &directory, const FileVisitor &visitor)
 
template<class Type >
constexpr void HashCombineSeed (std::size_t &seed, Type arg)
 
template<class Type , class... Rest>
constexpr void HashCombineSeed (std::size_t &seed, Type arg, Rest... other_args)
 
constexpr std::size_t HashCombine ()
 
template<class... Type>
constexpr std::size_t HashCombine (Type... args)
 
std::string HexEncode (std::string_view input)
 
void SetLogSettings (const LogSettings &settings)
 
LogSettings GetLogSettings ()
 
int GetMinLogLevel ()
 
int GetVlogVerbosity ()
 
bool ShouldCreateLogMessage (LogSeverity severity)
 
void KillProcess ()
 
template<typename T >
internal::CopyableLambda< T > MakeCopyable (T lambda)
 
 TEST (MallocMapping, EmptyContructor)
 
 TEST (MallocMapping, NotEmptyContructor)
 
 TEST (MallocMapping, MoveConstructor)
 
 TEST (MallocMapping, Copy)
 
 TEST (MallocMapping, Release)
 
 TEST (MallocMapping, IsDontNeedSafe)
 
template<typename T >
RefPtr< T > AdoptRef (T *ptr)
 
template<typename T >
RefPtr< T > Ref (T *ptr)
 
template<typename T , typename... Args>
RefPtr< T > MakeRefCounted (Args &&... args)
 
static ALooper * AcquireLooperForThread ()
 
bool IsPlatformVersionAtLeast (size_t major, size_t minor=0, size_t patch=0)
 
template<class C >
void swap (scoped_nsprotocol< C > &p1, scoped_nsprotocol< C > &p2)
 
template<class C >
bool operator== (C p1, const scoped_nsprotocol< C > &p2)
 
template<class C >
bool operator!= (C p1, const scoped_nsprotocol< C > &p2)
 
NSRange RangeForCharacterAtIndex (NSString *text, NSUInteger index)
 
NSRange RangeForCharactersInRange (NSString *text, NSRange range)
 
void ExecuteAfterTaskObservers ()
 
void CurrentMessageLoopAddAfterTaskObserver (intptr_t key, fit::closure observer)
 
void CurrentMessageLoopRemoveAfterTaskObserver (intptr_t key)
 
bool TimerRearm (int fd, fml::TimePoint time_point)
 Rearms the timer to expire at the given time point. More...
 
bool TimerDrain (int fd)
 
static int ToPosixAccessFlags (FilePermission permission)
 
static int ToPosixCreateModeFlags (FilePermission permission)
 
static int ToPosixProtectionFlags (std::initializer_list< FileMapping::Protection > protection_flags)
 
static bool IsWritable (std::initializer_list< FileMapping::Protection > protection_flags)
 
char * strdup (const char *str1)
 
std::string GetLastErrorMessage ()
 
static std::string GetFullHandlePath (const fml::UniqueFD &handle)
 
static bool IsAbsolutePath (const char *path)
 
static std::string GetAbsolutePath (const fml::UniqueFD &base_directory, const char *subpath)
 
static std::wstring GetTemporaryDirectoryPath ()
 
static DWORD GetDesiredAccessFlags (FilePermission permission)
 
static DWORD GetShareFlags (FilePermission permission)
 
static DWORD GetFileAttributesForUtf8Path (const char *absolute_path)
 
static DWORD GetFileAttributesForUtf8Path (const fml::UniqueFD &base_directory, const char *path)
 
static bool IsWritable (std::initializer_list< FileMapping::Protection > protection_flags)
 
static bool IsExecutable (std::initializer_list< FileMapping::Protection > protection_flags)
 
std::string WideStringToUtf8 (const std::wstring_view str)
 
std::wstring Utf8ToWideString (const std::string_view str)
 
template<typename T , std::size_t N>
constexpr std::size_t size (T(&array)[N])
 
std::string Utf16ToUtf8 (const std::u16string_view string)
 
std::u16string Utf8ToUtf16 (const std::string_view string)
 
 TEST (CountDownLatchTest, CanWaitOnZero)
 
 TEST (CountDownLatchTest, CanWait)
 
template<typename ConditionFn >
bool WaitWithTimeoutImpl (std::unique_lock< std::mutex > *locker, std::condition_variable *cv, ConditionFn condition, TimeDelta timeout)
 
void SetThreadName (const std::string &name)
 
fml::TimePoint ChronoTicksSinceEpoch ()
 
template<typename T >
Milliseconds RefreshRateToFrameBudget (T refresh_rate)
 
template<typename Clock , typename Duration >
static int64_t NanosSinceEpoch (std::chrono::time_point< Clock, Duration > time_point)
 
template<class T , class Traits >
void swap (const UniqueObject< T, Traits > &a, const UniqueObject< T, Traits > &b)
 
template<class T , class Traits >
bool operator== (const T &value, const UniqueObject< T, Traits > &object)
 
template<class T , class Traits >
bool operator!= (const T &value, const UniqueObject< T, Traits > &object)
 

Variables

static std::string kKUnknownFrameName = "Unknown"
 
static size_t kKnownSignalHandlers []
 
static std::string kKUnknownFrameName = "Unknown"
 
static constexpr char kEncoding [] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
 
static constexpr signed char kDecodeMap []
 
static constexpr int kDecodeMapSize
 
static constexpr char kEncoding [] = "0123456789abcdef"
 
constexpr LogSeverity LOG_INFO = 0
 
constexpr LogSeverity LOG_WARNING = 1
 
constexpr LogSeverity LOG_ERROR = 2
 
constexpr LogSeverity LOG_FATAL = 3
 
constexpr LogSeverity LOG_NUM_SEVERITIES = 4
 
const LogSeverity LOG_DFATAL = LOG_FATAL
 
FML_THREAD_LOCAL ThreadLocalUniquePtr< MessageLooptls_message_loop
 
FML_THREAD_LOCAL ThreadLocalUniquePtr< TaskSourceGradeHolder > tls_task_source_grade
 
static const TaskQueueId _kUnmerged = TaskQueueId(TaskQueueId::kUnmerged)
 
static constexpr int kClockType = CLOCK_MONOTONIC
 
static constexpr CFTimeInterval kDistantFuture = 1.0e10
 
thread_local std::map< intptr_t, fit::closure > tTaskObservers
 
static constexpr int kClockType = CLOCK_MONOTONIC
 
constexpr Milliseconds kDefaultFrameBudget = Milliseconds(1s) / 60
 

Typedef Documentation

◆ Base32DecodeConverter

using fml::Base32DecodeConverter = typedef BitConverter<5, 8, 16>

Definition at line 49 of file base32.h.

◆ Base32EncodeConverter

using fml::Base32EncodeConverter = typedef BitConverter<8, 5, 16>

Definition at line 50 of file base32.h.

◆ closure

using fml::closure = typedef std::function<void()>

Definition at line 14 of file closure.h.

◆ DelayedTaskQueue

using fml::DelayedTaskQueue = typedef std::priority_queue<DelayedTask, std::deque<DelayedTask>, std::greater<DelayedTask> >

Definition at line 44 of file delayed_task.h.

◆ FileVisitor

using fml::FileVisitor = typedef std::function<bool(const fml::UniqueFD& directory, const std::string& filename)>

Signature of a callback on a file in directory with filename (relative to directory). The returned bool should be false if and only if further traversal should be stopped. For example, a file-search visitor may return false when the file is found so no more visiting is needed.

Definition at line 98 of file file.h.

◆ LogSeverity

typedef int fml::LogSeverity

Definition at line 10 of file log_level.h.

◆ Milliseconds

using fml::Milliseconds = typedef std::chrono::duration<double, std::milli>

Definition at line 18 of file time_delta.h.

◆ RasterThreadMergerId

Definition at line 17 of file shared_thread_merger.h.

◆ TrieNode

Definition at line 10 of file ascii_trie.cc.

◆ TrieNodePtr

Definition at line 11 of file ascii_trie.cc.

◆ UniqueDir

Definition at line 101 of file unique_fd.h.

◆ UniqueFD

Definition at line 100 of file unique_fd.h.

◆ Utf16StringConverter

using fml::Utf16StringConverter = typedef std::wstring_convert<std::codecvt_utf8_utf16<char16_t>, char16_t>

Definition at line 23 of file string_conversion.cc.

◆ WideStringConverter

using fml::WideStringConverter = typedef std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>, wchar_t>

Definition at line 14 of file wstring_conversion.cc.

Enumeration Type Documentation

◆ FilePermission

enum fml::FilePermission
strong
Enumerator
kRead 
kWrite 
kReadWrite 

Definition at line 24 of file file.h.

◆ FlushType

enum fml::FlushType
strong
Enumerator
kSingle 
kAll 

Definition at line 54 of file message_loop_task_queues.h.

54  {
55  kSingle,
56  kAll,
57 };

◆ OwnershipPolicy

enum fml::OwnershipPolicy
strong
Enumerator
Assume 
Retain 

Definition at line 17 of file scoped_block.h.

17  {
18  // The scoped object takes ownership of an object by taking over an existing
19  // ownership claim.
20  Assume,
21 
22  // The scoped object will retain the object and any initial ownership is
23  // not changed.
24  Retain,
25 };

◆ RasterThreadStatus

Enumerator
kRemainsMerged 
kRemainsUnmerged 
kUnmergedNow 

Definition at line 20 of file raster_thread_merger.h.

◆ StatusCode

◆ TaskSourceGrade

enum fml::TaskSourceGrade
strong

Categories of work dispatched to MessageLoopTaskQueues dispatcher. By specifying the TaskSourceGrade, you indicate the task's importance to the dispatcher.

Enumerator
kUserInteraction 

This TaskSourceGrade indicates that a task is critical to user interaction.

kDartMicroTasks 

This TaskSourceGrade indicates that a task corresponds to servicing a dart micro task. These aren't critical to user interaction.

kUnspecified 

The absence of a specialized TaskSourceGrade.

Definition at line 15 of file task_source_grade.h.

15  {
16  /// This `TaskSourceGrade` indicates that a task is critical to user
17  /// interaction.
19  /// This `TaskSourceGrade` indicates that a task corresponds to servicing a
20  /// dart micro task. These aren't critical to user interaction.
22  /// The absence of a specialized `TaskSourceGrade`.
24 };
The absence of a specialized TaskSourceGrade.

Function Documentation

◆ AcquireLooperForThread()

static ALooper* fml::AcquireLooperForThread ( )
static

Definition at line 16 of file message_loop_android.cc.

References flutter::data, FML_CHECK, FML_DCHECK, fml::UniqueObject< T, Traits >::get(), result, fml::MessageLoopImpl::RunExpiredTasksNow(), TFD_CLOEXEC, TFD_NONBLOCK, TimerDrain(), timerfd_create(), and TimerRearm().

16  {
17  ALooper* looper = ALooper_forThread();
18 
19  if (looper == nullptr) {
20  // No looper has been configured for the current thread. Create one and
21  // return the same.
22  looper = ALooper_prepare(0);
23  }
24 
25  // The thread already has a looper. Acquire a reference to the same and return
26  // it.
27  ALooper_acquire(looper);
28  return looper;
29 }

◆ AdoptRef()

template<typename T >
RefPtr< T > fml::AdoptRef ( T *  ptr)
inline

Definition at line 221 of file ref_ptr.h.

Referenced by flutter_runner::testing::FakePlatformMessageResponse::Create(), fml::NativeLibrary::Create(), FLUTTER_ASSERT_NOT_ARC::MockPlatformMessageResponse::Create(), fml::NativeLibrary::CreateForCurrentProcess(), and fml::NativeLibrary::CreateWithHandle().

221  {
222 #ifndef NDEBUG
223  ptr->Adopt();
224 #endif
225  return RefPtr<T>(ptr, RefPtr<T>::ADOPT);
226 }

◆ BacktraceHere()

std::string fml::BacktraceHere ( size_t  offset = 0)

Definition at line 58 of file backtrace.cc.

References GetSymbolName().

Referenced by SignalHandler(), and fml::testing::TEST().

58  {
59  constexpr size_t kMaxFrames = 256;
60  void* symbols[kMaxFrames];
61  const auto available_frames = ::backtrace(symbols, kMaxFrames);
62  if (available_frames <= 0) {
63  return "";
64  }
65 
66  std::stringstream stream;
67  for (int i = 1 + offset; i < available_frames; ++i) {
68  stream << "Frame " << i - 1 - offset << ": " << symbols[i] << " "
69  << GetSymbolName(symbols[i]) << std::endl;
70  }
71  return stream.str();
72 }
static std::string GetSymbolName(void *symbol)
Definition: backtrace.cc:49

◆ Base32Decode()

std::pair< bool, std::string > fml::Base32Decode ( const std::string &  input)

Definition at line 54 of file base32.cc.

References fml::BitConverter< from_length, to_length, buffer_length >::Append(), fml::BitConverter< from_length, to_length, buffer_length >::CanExtract(), fml::BitConverter< from_length, to_length, buffer_length >::Extract(), fml::BitConverter< from_length, to_length, buffer_length >::Peek(), and result.

Referenced by flutter::ParseBase32(), and TEST().

54  {
55  std::string result;
56  Base32DecodeConverter converter;
57  for (char c : input) {
58  int map_index = c - '2';
59  if (map_index < 0 || map_index >= kDecodeMapSize ||
60  kDecodeMap[map_index] == -1) {
61  return {false, result};
62  }
63  converter.Append(kDecodeMap[map_index]);
64  if (converter.CanExtract()) {
65  result.push_back(converter.Extract());
66  }
67  }
68  if (converter.Peek() != 0) {
69  // The padding should always be zero. Return false if not.
70  return {false, result};
71  }
72  return {true, result};
73 }
BitConverter< 5, 8, 16 > Base32DecodeConverter
Definition: base32.h:49
static constexpr int kDecodeMapSize
Definition: base32.cc:51
static constexpr signed char kDecodeMap[]
Definition: base32.cc:45
GAsyncResult * result

◆ Base32Encode()

std::pair< bool, std::string > fml::Base32Encode ( std::string_view  input)

Definition at line 14 of file base32.cc.

References fml::BitConverter< from_length, to_length, buffer_length >::Append(), fml::BitConverter< from_length, to_length, buffer_length >::BitsAvailable(), fml::BitConverter< from_length, to_length, buffer_length >::CanAppend(), fml::BitConverter< from_length, to_length, buffer_length >::CanExtract(), fml::BitConverter< from_length, to_length, buffer_length >::Extract(), and fml::BitConverter< from_length, to_length, buffer_length >::Peek().

Referenced by flutter::Shell::RegisterImageDecoder(), and TEST().

14  {
15  if (input.empty()) {
16  return {true, ""};
17  }
18 
19  if (input.size() > std::numeric_limits<size_t>::max() / 8) {
20  return {false, ""};
21  }
22 
23  std::string output;
24  const size_t encoded_length = (input.size() * 8 + 4) / 5;
25  output.reserve(encoded_length);
26 
27  Base32EncodeConverter converter;
28  converter.Append(static_cast<uint8_t>(input[0]));
29  size_t next_byte_index = 1;
30 
31  while (converter.CanExtract()) {
32  output.push_back(kEncoding[converter.Extract()]);
33  if (converter.CanAppend() && next_byte_index < input.size()) {
34  converter.Append(static_cast<uint8_t>(input[next_byte_index++]));
35  }
36  }
37 
38  if (converter.BitsAvailable() > 0) {
39  output.push_back(kEncoding[converter.Peek()]);
40  }
41 
42  return {true, output};
43 }
BitConverter< 8, 5, 16 > Base32EncodeConverter
Definition: base32.h:50
static constexpr char kEncoding[]
Definition: base32.cc:12

◆ BigEndianToArch()

template<typename T , class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T fml::BigEndianToArch ( n)

Convert a known big endian value to match the endianness of the current architecture. This is effectively a cross platform ntohl/ntohs (as network byte order is always Big Endian). The given value must be an integral type of size 1, 2, 4, or 8.

Definition at line 51 of file endianness.h.

Referenced by fml::testing::TEST().

51  {
52 #if FML_ARCH_CPU_LITTLE_ENDIAN
53  return ByteSwap<T>(n);
54 #else
55  return n;
56 #endif
57 }

◆ ByteSwap()

template<typename T , class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T fml::ByteSwap ( n)

Flips the endianness of the given value. The given value must be an integral type of size 1, 2, 4, or 8.

Definition at line 32 of file endianness.h.

References FML_BYTESWAP_16, FML_BYTESWAP_32, and FML_BYTESWAP_64.

32  {
33  if constexpr (sizeof(T) == 1) {
34  return n;
35  } else if constexpr (sizeof(T) == 2) {
36  return (T)FML_BYTESWAP_16((uint16_t)n);
37  } else if constexpr (sizeof(T) == 4) {
38  return (T)FML_BYTESWAP_32((uint32_t)n);
39  } else if constexpr (sizeof(T) == 8) {
40  return (T)FML_BYTESWAP_64((uint64_t)n);
41  } else {
42  static_assert(!sizeof(T), "Unsupported size");
43  }
44 }
#define FML_BYTESWAP_32(n)
Definition: endianness.h:18
#define FML_BYTESWAP_16(n)
Definition: endianness.h:17
#define FML_BYTESWAP_64(n)
Definition: endianness.h:19

◆ ChronoTicksSinceEpoch()

fml::TimePoint fml::ChronoTicksSinceEpoch ( )

Definition at line 21 of file chrono_timestamp_provider.cc.

References fml::ChronoTimestampProvider::Instance(), and fml::ChronoTimestampProvider::Now().

Referenced by fml::testing::CountRemainingTasks(), fml::ChronoTimestampProvider::Instance(), fml::testing::TEST(), and TEST().

21  {
22  return ChronoTimestampProvider::Instance().Now();
23 }

◆ CommandLineFromArgcArgv()

CommandLine fml::CommandLineFromArgcArgv ( int  argc,
const char *const *  argv 
)
inline

Definition at line 225 of file command_line.h.

References CommandLineFromIterators().

Referenced by FlutterEngineInitialize(), GetTestTimeoutFromArgs(), main(), and benchmarking::Main().

225  {
226  return CommandLineFromIterators(argv, argv + argc);
227 }
char ** argv
Definition: library.h:9
CommandLine CommandLineFromIterators(InputIterator first, InputIterator last)
Definition: command_line.h:203

◆ CommandLineFromInitializerList()

template<typename StringType >
CommandLine fml::CommandLineFromInitializerList ( std::initializer_list< StringType >  argv)
inline

Definition at line 232 of file command_line.h.

References CommandLineFromIterators(), and CommandLineToArgv().

Referenced by flutter::testing::TEST().

233  {
234  return CommandLineFromIterators(argv.begin(), argv.end());
235 }
char ** argv
Definition: library.h:9
CommandLine CommandLineFromIterators(InputIterator first, InputIterator last)
Definition: command_line.h:203

◆ CommandLineFromIterators()

template<typename InputIterator >
CommandLine fml::CommandLineFromIterators ( InputIterator  first,
InputIterator  last 
)
inline

Definition at line 203 of file command_line.h.

Referenced by CommandLineFromArgcArgv(), CommandLineFromInitializerList(), flutter::CommandLineFromNSProcessInfo(), flutter::FlutterMain::GetSettings(), and dart_runner::IsTestProgram().

204  {
205  return CommandLineFromIteratorsFindFirstPositionalArg<InputIterator>(
206  first, last, nullptr);
207 }

◆ CommandLineFromIteratorsFindFirstPositionalArg()

template<typename InputIterator >
CommandLine fml::CommandLineFromIteratorsFindFirstPositionalArg ( InputIterator  first,
InputIterator  last,
InputIterator *  first_positional_arg 
)
inline

Definition at line 181 of file command_line.h.

References fml::internal::CommandLineBuilder::Build(), and fml::internal::CommandLineBuilder::ProcessArg().

184  {
185  if (first_positional_arg) {
186  *first_positional_arg = last;
187  }
188  internal::CommandLineBuilder builder;
189  for (auto it = first; it < last; ++it) {
190  if (builder.ProcessArg(*it)) {
191  if (first_positional_arg) {
192  *first_positional_arg = it;
193  }
194  }
195  }
196  return builder.Build();
197 }

◆ CommandLineFromIteratorsWithArgv0()

template<typename InputIterator >
CommandLine fml::CommandLineFromIteratorsWithArgv0 ( const std::string &  argv0,
InputIterator  first,
InputIterator  last 
)
inline

Definition at line 213 of file command_line.h.

References fml::internal::CommandLineBuilder::Build(), and fml::internal::CommandLineBuilder::ProcessArg().

215  {
216  internal::CommandLineBuilder builder;
217  builder.ProcessArg(argv0);
218  for (auto it = first; it < last; ++it) {
219  builder.ProcessArg(*it);
220  }
221  return builder.Build();
222 }

◆ CommandLineToArgv()

std::vector< std::string > fml::CommandLineToArgv ( const CommandLine command_line)

Definition at line 141 of file command_line.cc.

References argv, fml::CommandLine::argv0(), fml::CommandLine::has_argv0(), fml::CommandLine::options(), fml::CommandLine::positional_args(), and size().

Referenced by CommandLineFromInitializerList().

141  {
142  if (!command_line.has_argv0()) {
143  return std::vector<std::string>();
144  }
145 
146  std::vector<std::string> argv;
147  const std::vector<CommandLine::Option>& options = command_line.options();
148  const std::vector<std::string>& positional_args =
149  command_line.positional_args();
150  // Reserve space for argv[0], options, maybe a "--" (if needed), and the
151  // positional arguments.
152  argv.reserve(1u + options.size() + 1u + positional_args.size());
153 
154  argv.push_back(command_line.argv0());
155  for (const auto& option : options) {
156  if (option.value.empty()) {
157  argv.push_back("--" + option.name);
158  } else {
159  argv.push_back("--" + option.name + "=" + option.value);
160  }
161  }
162 
163  if (!positional_args.empty()) {
164  // Insert a "--" if necessary.
165  if (positional_args[0].size() >= 2u && positional_args[0][0] == '-' &&
166  positional_args[0][1] == '-') {
167  argv.push_back("--");
168  }
169 
170  argv.insert(argv.end(), positional_args.begin(), positional_args.end());
171  }
172 
173  return argv;
174 }
char ** argv
Definition: library.h:9
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:226

◆ CreateDirectory() [1/2]

static fml::UniqueFD fml::CreateDirectory ( const fml::UniqueFD base_directory,
const std::vector< std::string > &  components,
FilePermission  permission,
size_t  index 
)
static

Definition at line 12 of file file.cc.

References FML_DCHECK, and OpenDirectory().

Referenced by CreateDirectory(), GetFileAttributesForUtf8Path(), TEST(), and flutter::testing::TEST_F().

15  {
16  FML_DCHECK(index <= components.size());
17 
18  const char* file_path = components[index].c_str();
19 
20  auto directory = OpenDirectory(base_directory, file_path, true, permission);
21 
22  if (!directory.is_valid()) {
23  return {};
24  }
25 
26  if (index == components.size() - 1) {
27  return directory;
28  }
29 
30  return CreateDirectory(directory, components, permission, index + 1);
31 }
#define FML_DCHECK(condition)
Definition: logging.h:86
#define CreateDirectory
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition: file_posix.cc:96

◆ CreateDirectory() [2/2]

fml::UniqueFD fml::CreateDirectory ( const fml::UniqueFD base_directory,
const std::vector< std::string > &  components,
FilePermission  permission 
)

Definition at line 33 of file file.cc.

References CreateDirectory(), and IsDirectory().

35  {
36  if (!IsDirectory(base_directory)) {
37  return {};
38  }
39 
40  if (components.empty()) {
41  return {};
42  }
43 
44  return CreateDirectory(base_directory, components, permission, 0);
45 }
#define CreateDirectory
bool IsDirectory(const fml::UniqueFD &directory)
Definition: file_posix.cc:126

◆ CreateTemporaryDirectory()

std::string fml::CreateTemporaryDirectory ( )

Definition at line 24 of file file_posix.cc.

References result.

Referenced by GetFileAttributesForUtf8Path(), and TEST().

24  {
25  char directory_name[] = "/tmp/flutter_XXXXXXXX";
26  auto* result = ::mkdtemp(directory_name);
27  if (result == nullptr) {
28  return "";
29  }
30  return {result};
31 }
GAsyncResult * result

◆ CurrentMessageLoopAddAfterTaskObserver()

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

Definition at line 19 of file task_observers.cc.

References key.

Referenced by flutter_runner::ComponentV1::Create(), and flutter_runner::ComponentV2::Create().

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

◆ CurrentMessageLoopRemoveAfterTaskObserver()

void fml::CurrentMessageLoopRemoveAfterTaskObserver ( intptr_t  key)

Definition at line 26 of file task_observers.cc.

Referenced by flutter_runner::ComponentV1::Create(), and flutter_runner::ComponentV2::Create().

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

◆ DemangleSymbolName()

static std::string fml::DemangleSymbolName ( const std::string &  mangled)
static

Definition at line 27 of file backtrace.cc.

References kKUnknownFrameName, and length.

Referenced by GetSymbolName().

27  {
28  if (mangled == kKUnknownFrameName) {
29  return kKUnknownFrameName;
30  }
31 
32  int status = 0;
33  size_t length = 0;
34  char* demangled = __cxxabiv1::__cxa_demangle(
35  mangled.data(), // mangled name
36  nullptr, // output buffer (malloc-ed if nullptr)
37  &length, // demangled length
38  &status);
39 
40  if (demangled == nullptr || status != 0) {
41  return mangled;
42  }
43 
44  auto demangled_string = std::string{demangled, length};
45  free(demangled);
46  return demangled_string;
47 }
static std::string kKUnknownFrameName
Definition: backtrace.cc:25
size_t length

◆ Duplicate()

◆ ExecuteAfterTaskObservers()

void fml::ExecuteAfterTaskObservers ( )

Definition at line 13 of file task_observers.cc.

References callback.

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

◆ FileExists()

bool fml::FileExists ( const fml::UniqueFD base_directory,
const char *  path 
)

Definition at line 182 of file file_posix.cc.

References fml::UniqueObject< T, Traits >::get(), fml::UniqueObject< T, Traits >::is_valid(), and flutter::path.

Referenced by GetFileAttributesForUtf8Path(), OpenDirectory(), OpenFile(), impeller::testing::ArchivistFixture::TearDown(), and TEST().

182  {
183  if (!base_directory.is_valid()) {
184  return false;
185  }
186 
187  return ::faccessat(base_directory.get(), path, F_OK, 0) == 0;
188 }
const T & get() const
Definition: unique_object.h:87
bool is_valid() const
Definition: unique_object.h:89
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

◆ GetAbsolutePath()

static std::string fml::GetAbsolutePath ( const fml::UniqueFD base_directory,
const char *  subpath 
)
static

Definition at line 50 of file file_win.cc.

References GetFullHandlePath(), IsAbsolutePath(), and flutter::path.

Referenced by GetFileAttributesForUtf8Path().

51  {
52  std::string path;
53  if (IsAbsolutePath(subpath)) {
54  path = subpath;
55  } else {
56  std::stringstream stream;
57  stream << GetFullHandlePath(base_directory) << "\\" << subpath;
58  path = stream.str();
59  }
60  std::replace(path.begin(), path.end(), '/', '\\');
61  return path;
62 }
static std::string GetFullHandlePath(const fml::UniqueFD &handle)
Definition: file_win.cc:27
static bool IsAbsolutePath(const char *path)
Definition: file_win.cc:37
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

◆ GetDesiredAccessFlags()

static DWORD fml::GetDesiredAccessFlags ( FilePermission  permission)
static

Definition at line 73 of file file_win.cc.

References kRead, kReadWrite, and kWrite.

Referenced by GetFileAttributesForUtf8Path().

73  {
74  switch (permission) {
75  case FilePermission::kRead:
76  return GENERIC_READ;
77  case FilePermission::kWrite:
78  return GENERIC_WRITE;
79  case FilePermission::kReadWrite:
80  return GENERIC_READ | GENERIC_WRITE;
81  }
82  return GENERIC_READ;
83 }

◆ GetFileAttributesForUtf8Path() [1/2]

static DWORD fml::GetFileAttributesForUtf8Path ( const char *  absolute_path)
static

Definition at line 97 of file file_win.cc.

References GetFileAttributes, and Utf8ToWideString().

Referenced by GetFileAttributesForUtf8Path().

97  {
98  return ::GetFileAttributes(Utf8ToWideString(absolute_path).c_str());
99 }
#define GetFileAttributes
std::wstring Utf8ToWideString(const std::string_view str)

◆ GetFileAttributesForUtf8Path() [2/2]

static DWORD fml::GetFileAttributesForUtf8Path ( const fml::UniqueFD base_directory,
const char *  path 
)
static

Definition at line 101 of file file_win.cc.

References CreateDirectory(), CreateFile, CreateTemporaryDirectory(), DeleteFile, Duplicate(), FALSE, FileExists(), FindFirstFile, FindNextFile, flags, FML_DLOG, fml::UniqueObject< T, Traits >::get(), GetAbsolutePath(), GetDesiredAccessFlags(), GetFileAttributesForUtf8Path(), GetFullHandlePath(), GetLastError(), GetLastErrorMessage(), fml::Mapping::GetMapping(), GetShareFlags(), fml::Mapping::GetSize(), GetTemporaryDirectoryPath(), INVALID_HANDLE_VALUE, IsDirectory(), IsFile(), fml::FileMapping::kRead, kReadWrite, fml::FileMapping::kWrite, OpenDirectory(), OpenFile(), flutter::path, RemoveDirectory, size(), TruncateFile(), UnlinkDirectory(), UnlinkFile(), Utf8ToWideString(), VisitFiles(), WideStringToUtf8(), and WriteAtomically().

102  {
103  std::string full_path = GetAbsolutePath(base_directory, path);
104  return GetFileAttributesForUtf8Path(full_path.c_str());
105 }
static DWORD GetFileAttributesForUtf8Path(const fml::UniqueFD &base_directory, const char *path)
Definition: file_win.cc:101
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
static std::string GetAbsolutePath(const fml::UniqueFD &base_directory, const char *subpath)
Definition: file_win.cc:50

◆ GetFullHandlePath()

static std::string fml::GetFullHandlePath ( const fml::UniqueFD handle)
static

Definition at line 27 of file file_win.cc.

References buffer, fml::UniqueObject< T, Traits >::get(), MAX_PATH, and WideStringToUtf8().

Referenced by GetAbsolutePath(), and GetFileAttributesForUtf8Path().

27  {
28  wchar_t buffer[MAX_PATH] = {0};
29  const DWORD buffer_size = ::GetFinalPathNameByHandle(
30  handle.get(), buffer, MAX_PATH, FILE_NAME_NORMALIZED);
31  if (buffer_size == 0) {
32  return {};
33  }
34  return WideStringToUtf8({buffer, buffer_size});
35 }
const T & get() const
Definition: unique_object.h:87
std::string WideStringToUtf8(const std::wstring_view str)
unsigned long DWORD
Definition: windows_types.h:22
static const uint8_t buffer[]
#define MAX_PATH

◆ GetLastErrorMessage()

std::string fml::GetLastErrorMessage ( )

Definition at line 15 of file errors_win.cc.

References buffer, flags, GetLastError(), message, size(), and WideStringToUtf8().

Referenced by GetFileAttributesForUtf8Path().

15  {
16  DWORD last_error = ::GetLastError();
17  if (last_error == 0) {
18  return {};
19  }
20 
21  const DWORD flags = FORMAT_MESSAGE_ALLOCATE_BUFFER |
22  FORMAT_MESSAGE_FROM_SYSTEM |
23  FORMAT_MESSAGE_IGNORE_INSERTS;
24 
25  wchar_t* buffer = nullptr;
26  size_t size = ::FormatMessage(
27  flags, // dwFlags
28  NULL, // lpSource
29  last_error, // dwMessageId
30  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // dwLanguageId
31  (LPWSTR)&buffer, // lpBuffer
32  0, // nSize
33  NULL // Arguments
34  );
35 
36  std::wstring message(buffer, size);
37 
38  ::LocalFree(buffer);
39 
40  std::wstringstream stream;
41  stream << message << " (" << last_error << ").";
42 
43  return WideStringToUtf8(stream.str());
44 }
Win32Message message
FlutterSemanticsFlag flags
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:226
std::string WideStringToUtf8(const std::wstring_view str)
unsigned long DWORD
Definition: windows_types.h:22
static const uint8_t buffer[]
WINBASEAPI _Check_return_ _Post_equals_last_error_ DWORD WINAPI GetLastError(VOID)

◆ GetLogSettings()

LogSettings fml::GetLogSettings ( )

Definition at line 43 of file log_settings.cc.

References fml::state::g_log_settings.

Referenced by fml::ScopedSetLogSettings::ScopedSetLogSettings().

43  {
44  return state::g_log_settings;
45 }
LogSettings g_log_settings

◆ GetMinLogLevel()

int fml::GetMinLogLevel ( )

Definition at line 47 of file log_settings.cc.

References fml::state::g_log_settings, and LOG_FATAL.

Referenced by GetVlogVerbosity(), and ShouldCreateLogMessage().

47  {
48  return std::min(state::g_log_settings.min_log_level, LOG_FATAL);
49 }
LogSettings g_log_settings
constexpr LogSeverity LOG_FATAL
Definition: log_level.h:16

◆ GetShareFlags()

static DWORD fml::GetShareFlags ( FilePermission  permission)
static

Definition at line 85 of file file_win.cc.

References kRead, kReadWrite, and kWrite.

Referenced by GetFileAttributesForUtf8Path().

85  {
86  switch (permission) {
87  case FilePermission::kRead:
88  return FILE_SHARE_READ;
89  case FilePermission::kWrite:
90  return FILE_SHARE_WRITE;
91  case FilePermission::kReadWrite:
92  return FILE_SHARE_READ | FILE_SHARE_WRITE;
93  }
94  return FILE_SHARE_READ;
95 }

◆ GetSymbolName()

static std::string fml::GetSymbolName ( void *  symbol)
static

Definition at line 49 of file backtrace.cc.

References DemangleSymbolName(), kKUnknownFrameName, and flutter::name.

Referenced by BacktraceHere().

49  {
50  char name[1024];
51  if (!absl::Symbolize(symbol, name, sizeof(name))) {
52  return kKUnknownFrameName;
53  }
54 
55  return DemangleSymbolName({name});
56 }
static std::string DemangleSymbolName(const std::string &mangled)
Definition: backtrace.cc:27
static std::string kKUnknownFrameName
Definition: backtrace.cc:25
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32

◆ GetTemporaryDirectoryPath()

static std::wstring fml::GetTemporaryDirectoryPath ( )
static

Definition at line 64 of file file_win.cc.

References MAX_PATH.

Referenced by GetFileAttributesForUtf8Path().

64  {
65  wchar_t wchar_path[MAX_PATH];
66  auto result_size = ::GetTempPath(MAX_PATH, wchar_path);
67  if (result_size > 0) {
68  return {wchar_path, result_size};
69  }
70  return {};
71 }
#define MAX_PATH

◆ GetVlogVerbosity()

int fml::GetVlogVerbosity ( )

Definition at line 134 of file logging.cc.

References GetMinLogLevel(), and LOG_INFO.

Referenced by fml::LogMessage::stream().

134  {
135  return std::max(-1, LOG_INFO - GetMinLogLevel());
136 }
int GetMinLogLevel()
Definition: log_settings.cc:47
constexpr LogSeverity LOG_INFO
Definition: log_level.h:13

◆ HashCombine() [1/2]

◆ HashCombine() [2/2]

template<class... Type>
constexpr std::size_t fml::HashCombine ( Type...  args)

Definition at line 30 of file hash_combine.h.

References args, HashCombine(), and HashCombineSeed().

30  {
31  std::size_t seed = HashCombine();
32  HashCombineSeed(seed, args...);
33  return seed;
34 }
constexpr std::size_t HashCombine(Type... args)
Definition: hash_combine.h:30
G_BEGIN_DECLS FlValue * args
constexpr void HashCombineSeed(std::size_t &seed, Type arg, Rest... other_args)
Definition: hash_combine.h:18

◆ HashCombineSeed() [1/2]

template<class Type >
constexpr void fml::HashCombineSeed ( std::size_t &  seed,
Type  arg 
)

Definition at line 13 of file hash_combine.h.

Referenced by flutter::RasterCacheKeyID::GetHash(), impeller::VertexDescriptor::GetHash(), impeller::PipelineDescriptor::GetHash(), HashCombine(), and HashCombineSeed().

13  {
14  seed ^= std::hash<Type>{}(arg) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
15 }

◆ HashCombineSeed() [2/2]

template<class Type , class... Rest>
constexpr void fml::HashCombineSeed ( std::size_t &  seed,
Type  arg,
Rest...  other_args 
)

Definition at line 18 of file hash_combine.h.

References HashCombineSeed().

20  {
21  HashCombineSeed(seed, arg);
22  HashCombineSeed(seed, other_args...);
23 }
constexpr void HashCombineSeed(std::size_t &seed, Type arg, Rest... other_args)
Definition: hash_combine.h:18

◆ HexEncode()

std::string fml::HexEncode ( std::string_view  input)

Definition at line 13 of file hex_codec.cc.

References result.

Referenced by flutter::PersistentCache::SkKeyToFilePath(), and TEST().

13  {
14  std::string result;
15  result.reserve(input.size() * 2);
16  for (char c : input) {
17  uint8_t b = static_cast<uint8_t>(c);
18  result.push_back(kEncoding[b >> 4]);
19  result.push_back(kEncoding[b & 0xF]);
20  }
21  return result;
22 }
GAsyncResult * result
static constexpr char kEncoding[]
Definition: hex_codec.cc:11

◆ InstallCrashHandler()

void fml::InstallCrashHandler ( )

Definition at line 134 of file backtrace.cc.

References fml::paths::GetExecutablePath(), and ToggleSignalHandlers().

Referenced by main(), benchmarking::Main(), and impeller::compiler::Main().

134  {
135 #if FML_OS_WIN
136  if (!IsDebuggerPresent()) {
137  _CrtSetReportMode(_CRT_ASSERT, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG);
138  _CrtSetReportFile(_CRT_ASSERT, _CRTDBG_FILE_STDERR);
139  }
140 #endif
141  auto exe_path = fml::paths::GetExecutablePath();
142  if (exe_path.first) {
143  absl::InitializeSymbolizer(exe_path.second.c_str());
144  }
145  ToggleSignalHandlers(true);
146 }
static void ToggleSignalHandlers(bool set)
Definition: backtrace.cc:123
std::pair< bool, std::string > GetExecutablePath()

◆ IsAbsolutePath()

static bool fml::IsAbsolutePath ( const char *  path)
static

Definition at line 37 of file file_win.cc.

References FALSE, and Utf8ToWideString().

Referenced by GetAbsolutePath().

37  {
38  if (path == nullptr || strlen(path) == 0) {
39  return false;
40  }
41 
42  auto wpath = Utf8ToWideString({path});
43  if (wpath.empty()) {
44  return false;
45  }
46 
47  return ::PathIsRelative(wpath.c_str()) == FALSE;
48 }
std::wstring Utf8ToWideString(const std::string_view str)
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
return FALSE

◆ IsCrashHandlingSupported()

bool fml::IsCrashHandlingSupported ( )

Definition at line 148 of file backtrace.cc.

Referenced by fml::testing::TEST().

148  {
149  return true;
150 }

◆ IsDirectory() [1/2]

bool fml::IsDirectory ( const fml::UniqueFD directory)

Definition at line 126 of file file_posix.cc.

References fml::UniqueObject< T, Traits >::get(), and fml::UniqueObject< T, Traits >::is_valid().

Referenced by CreateDirectory(), flutter::DirectoryAssetBundle::DirectoryAssetBundle(), GetFileAttributesForUtf8Path(), IsDirectory(), flutter::PersistentCache::Purge(), RemoveFilesInDirectory(), filesystem::TEST(), and VisitFilesRecursively().

126  {
127  if (!directory.is_valid()) {
128  return false;
129  }
130 
131  struct stat stat_result = {};
132 
133  if (::fstat(directory.get(), &stat_result) != 0) {
134  return false;
135  }
136 
137  return S_ISDIR(stat_result.st_mode);
138 }
const T & get() const
Definition: unique_object.h:87
bool is_valid() const
Definition: unique_object.h:89

◆ IsDirectory() [2/2]

bool fml::IsDirectory ( const fml::UniqueFD base_directory,
const char *  path 
)

Definition at line 140 of file file_posix.cc.

References fml::UniqueObject< T, Traits >::is_valid(), IsDirectory(), and OpenFileReadOnly().

140  {
141  UniqueFD file = OpenFileReadOnly(base_directory, path);
142  return (file.is_valid() && IsDirectory(file));
143 }
UniqueObject< int, internal::os_unix::UniqueFDTraits > UniqueFD
Definition: unique_fd.h:100
bool IsDirectory(const fml::UniqueFD &directory)
Definition: file_posix.cc:126
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
fml::UniqueFD OpenFileReadOnly(const fml::UniqueFD &base_directory, const char *path)
Definition: file.cc:92

◆ IsExecutable()

static bool fml::IsExecutable ( std::initializer_list< FileMapping::Protection protection_flags)
static

Definition at line 33 of file mapping_win.cc.

References fml::FileMapping::FileMapping(), and fml::FileMapping::kExecute.

34  {
35  for (auto protection : protection_flags) {
36  if (protection == FileMapping::Protection::kExecute) {
37  return true;
38  }
39  }
40  return false;
41 }

◆ IsFile()

bool fml::IsFile ( const std::string &  path)

Definition at line 145 of file file_posix.cc.

Referenced by FlutterEngineCreateAOTData(), FlutterEngineInitialize(), GetFileAttributesForUtf8Path(), flutter::FlutterMain::GetSettings(), flutter::testing::LoadELFSplitSymbolFromFixturesIfNeccessary(), flutter::testing::LoadELFSymbolFromFixturesIfNeccessary(), impeller::MTLShaderLibraryFromFilePaths(), flutter::testing::RunDartCodeInIsolateOnUITaskRunner(), and TEST().

145  {
146  struct stat buf;
147  if (stat(path.c_str(), &buf) != 0) {
148  return false;
149  }
150 
151  return S_ISREG(buf.st_mode);
152 }
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

◆ IsPlatformVersionAtLeast()

bool fml::IsPlatformVersionAtLeast ( size_t  major,
size_t  minor = 0,
size_t  patch = 0 
)

Definition at line 11 of file platform_version.mm.

11  {
12  const NSOperatingSystemVersion version = {
13  .majorVersion = static_cast<NSInteger>(major),
14  .minorVersion = static_cast<NSInteger>(minor),
15  .patchVersion = static_cast<NSInteger>(patch),
16  };
17  return [[NSProcessInfo processInfo] isOperatingSystemAtLeastVersion:version];
18 }

◆ IsWritable() [1/2]

static bool fml::IsWritable ( std::initializer_list< FileMapping::Protection protection_flags)
static

Definition at line 23 of file mapping_win.cc.

References fml::FileMapping::kWrite.

24  {
25  for (auto protection : protection_flags) {
26  if (protection == FileMapping::Protection::kWrite) {
27  return true;
28  }
29  }
30  return false;
31 }

◆ IsWritable() [2/2]

static bool fml::IsWritable ( std::initializer_list< FileMapping::Protection protection_flags)
static

Definition at line 39 of file mapping_posix.cc.

References fml::FileMapping::kWrite, fml::Mapping::Mapping(), and fml::Mapping::~Mapping().

Referenced by fml::FileMapping::FileMapping().

40  {
41  for (auto protection : protection_flags) {
42  if (protection == FileMapping::Protection::kWrite) {
43  return true;
44  }
45  }
46  return false;
47 }

◆ KillProcess()

void fml::KillProcess ( )

◆ LittleEndianToArch()

template<typename T , class = std::enable_if_t<std::is_integral_v<T>>>
constexpr T fml::LittleEndianToArch ( n)

Convert a known little endian value to match the endianness of the current architecture. The given value must be an integral type of size 1, 2, 4, or 8.

Definition at line 63 of file endianness.h.

Referenced by fml::testing::TEST().

63  {
64 #if !FML_ARCH_CPU_LITTLE_ENDIAN
65  return ByteSwap<T>(n);
66 #else
67  return n;
68 #endif
69 }

◆ MakeCopyable()

template<typename T >
internal::CopyableLambda<T> fml::MakeCopyable ( lambda)

Definition at line 57 of file make_copyable.h.

Referenced by flutter::PlatformMessageResponseDart::Complete(), flutter::PlatformMessageResponseAndroid::Complete(), flutter::PlatformMessageResponseDarwin::Complete(), flutter::PlatformMessageResponseDart::CompleteEmpty(), flutter::PlatformMessageResponseAndroid::CompleteEmpty(), flutter::PlatformMessageResponseDarwin::CompleteEmpty(), flutter::CopyToBitmap(), flutter::Shell::Create(), flutter::ImageDecoderSkia::Decode(), flutter::Rasterizer::Draw(), flutter::EmbedderPlatformMessageResponse::EmbedderPlatformMessageResponse(), flutter::EncodeImage(), flutter_runner::Engine::Engine(), flutter::Shell::GetDartVM(), flutter::MultiFrameCodec::getNextFrame(), flutter::testing::EmbedderTestContext::GetNextSceneImage(), flutter_runner::PlatformView::HandleFlutterPlatformViewsChannelPlatformMessage(), flutter::ImageDecoderImpeller::ImageDecoderImpeller(), InferMetalPlatformViewCreationCallback(), InferOpenGLPlatformViewCreationCallback(), InferSoftwarePlatformViewCreationCallback(), InferVulkanPlatformViewCreationCallback(), flutter::GPUSurfaceMetalImpeller::IsValid(), flutter::GPUSurfaceGLImpeller::IsValid(), flutter_runner::FlatlandPlatformView::OnChildViewViewRef(), flutter::PersistentCacheStore(), flutter::PrepareKernelMappings(), flutter::Picture::RasterizeToImage(), impeller::RuntimeStagePlayground::RegisterStage(), flutter::testing::RunDartCodeInIsolate(), flutter::testing::RunDartCodeInIsolateOnUITaskRunner(), flutter::Shell::RunEngine(), flutter::testing::ShellTest::SendEnginePlatformMessage(), flutter::testing::TEST_F(), impeller::testing::TEST_P(), flutter_runner::VsyncWaiter::VsyncWaiter(), flutter_runner::Engine::~Engine(), flutter::PlatformMessageResponseDart::~PlatformMessageResponseDart(), flutter_runner::Runner::~Runner(), flutter::Shell::~Shell(), and flutter_runner::VsyncWaiter::~VsyncWaiter().

57  {
58  return internal::CopyableLambda<T>(std::move(lambda));
59 }

◆ MakeRefCounted()

template<typename T , typename... Args>
RefPtr<T> fml::MakeRefCounted ( Args &&...  args)

Definition at line 247 of file ref_ptr.h.

References args, and fml::internal::MakeRefCountedHelper< T >::MakeRefCounted().

247  {
249  std::forward<Args>(args)...);
250 }
G_BEGIN_DECLS FlValue * args
RefPtr< T > MakeRefCounted(Args &&... args)
Definition: ref_ptr.h:247

◆ NanosSinceEpoch()

template<typename Clock , typename Duration >
static int64_t fml::NanosSinceEpoch ( std::chrono::time_point< Clock, Duration >  time_point)
static

Definition at line 39 of file time_point.cc.

Referenced by fml::TimePoint::CurrentWallTime(), and fml::TimePoint::Now().

40  {
41  const auto elapsed = time_point.time_since_epoch();
42  return std::chrono::duration_cast<std::chrono::nanoseconds>(elapsed).count();
43 }

◆ OpenDirectory() [1/2]

fml::UniqueFD fml::OpenDirectory ( const char *  path,
bool  create_if_necessary,
FilePermission  permission 
)

Definition at line 96 of file file_posix.cc.

References flutter::path.

Referenced by CreateDirectory(), impeller::compiler::testing::CreateIntermediatesDirectory(), fml::paths::GetCachesDirectory(), GetFileAttributesForUtf8Path(), flutter::RunConfiguration::InferFromSettings(), impeller::Main(), OpenDirectoryReadOnly(), flutter::testing::OpenFixtureAsSkData(), flutter::testing::OpenFixturesDirectory(), flutter::PersistentCache::Purge(), flutter::Shell::RegisterImageDecoder(), RemoveDirectoryRecursively(), flutter::RunTester(), fml::ScopedTemporaryDirectory::ScopedTemporaryDirectory(), flutter::ServiceProtocolFailureError(), flutter::StartupAndShutdownShell(), TEST(), and flutter::testing::TEST_F().

98  {
99  return OpenDirectory(fml::UniqueFD{AT_FDCWD}, path, create_if_necessary,
100  permission);
101 }
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition: file_posix.cc:96
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

◆ OpenDirectory() [2/2]

fml::UniqueFD fml::OpenDirectory ( const fml::UniqueFD base_directory,
const char *  path,
bool  create_if_necessary,
FilePermission  permission 
)

Definition at line 103 of file file_posix.cc.

References FileExists(), FML_HANDLE_EINTR, fml::UniqueObject< T, Traits >::get(), flutter::path, and ToPosixCreateModeFlags().

106  {
107  if (path == nullptr) {
108  return {};
109  }
110 
111  if (create_if_necessary && !FileExists(base_directory, path)) {
112  if (::mkdirat(base_directory.get(), path,
113  ToPosixCreateModeFlags(permission) | S_IXUSR) != 0) {
114  return {};
115  }
116  }
117 
119  ::openat(base_directory.get(), path, O_RDONLY | O_DIRECTORY))};
120 }
static int ToPosixCreateModeFlags(FilePermission permission)
Definition: file_posix.cc:49
const T & get() const
Definition: unique_object.h:87
#define FML_HANDLE_EINTR(x)
Definition: eintr_wrapper.h:20
bool FileExists(const fml::UniqueFD &base_directory, const char *path)
Definition: file_posix.cc:182
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

◆ OpenDirectoryReadOnly()

fml::UniqueFD fml::OpenDirectoryReadOnly ( const fml::UniqueFD base_directory,
const char *  path 
)

Helper method that calls OpenDirectory with create_if_necessary = false and permission = kRead.

Definition at line 97 of file file.cc.

References kRead, and OpenDirectory().

Referenced by flutter::PersistentCache::LoadSkSLs(), flutter::PersistentCache::Purge(), RemoveFilesInDirectory(), impeller::compiler::Switches::Switches(), flutter::testing::TEST_F(), and VisitFilesRecursively().

98  {
99  return OpenDirectory(base_directory, path, false, FilePermission::kRead);
100 }
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition: file_posix.cc:96
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

◆ OpenFile() [1/2]

fml::UniqueFD fml::OpenFile ( const char *  path,
bool  create_if_necessary,
FilePermission  permission 
)

This can open a directory on POSIX, but not on Windows.

Definition at line 65 of file file_posix.cc.

References flutter::path.

Referenced by fml::FileMapping::CreateReadExecute(), fml::FileMapping::CreateReadOnly(), flutter::DirectoryAssetBundle::DirectoryAssetBundle(), GetFileAttributesForUtf8Path(), flutter::DartVM::GetVMLaunchCount(), flutter::GetVMServiceAssetsArchiveCallback(), OpenFileReadOnly(), flutter::testing::OpenFixture(), flutter::testing::RunDartCodeInIsolateOnUITaskRunner(), flutter::RunTester(), flutter::ServiceProtocolFailureError(), fml::icu::ICUContext::SetupMapping(), TEST(), and WriteAtomically().

67  {
68  return OpenFile(fml::UniqueFD{AT_FDCWD}, path, create_if_necessary,
69  permission);
70 }
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
Definition: file_posix.cc:65
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

◆ OpenFile() [2/2]

fml::UniqueFD fml::OpenFile ( const fml::UniqueFD base_directory,
const char *  path,
bool  create_if_necessary,
FilePermission  permission 
)

This can open a directory on POSIX, but not on Windows.

Definition at line 72 of file file_posix.cc.

References FileExists(), flags, FML_HANDLE_EINTR, fml::UniqueObject< T, Traits >::get(), flutter::mode, flutter::path, ToPosixAccessFlags(), ToPosixCreateModeFlags(), and TRACE_EVENT0.

75  {
76  TRACE_EVENT0("flutter", "fml::OpenFile");
77  if (path == nullptr) {
78  return {};
79  }
80 
81  int flags = 0;
82  int mode = 0;
83 
84  if (create_if_necessary && !FileExists(base_directory, path)) {
85  flags = ToPosixAccessFlags(permission) | O_CREAT | O_TRUNC;
86  mode = ToPosixCreateModeFlags(permission);
87  } else {
88  flags = ToPosixAccessFlags(permission);
89  mode = 0; // Not creating since it already exists.
90  }
91 
92  return fml::UniqueFD{
93  FML_HANDLE_EINTR(::openat(base_directory.get(), path, flags, mode))};
94 }
static int ToPosixCreateModeFlags(FilePermission permission)
Definition: file_posix.cc:49
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:90
const T & get() const
Definition: unique_object.h:87
FlutterSemanticsFlag flags
#define FML_HANDLE_EINTR(x)
Definition: eintr_wrapper.h:20
bool FileExists(const fml::UniqueFD &base_directory, const char *path)
Definition: file_posix.cc:182
static int ToPosixAccessFlags(FilePermission permission)
Definition: file_posix.cc:33
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
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:194

◆ OpenFileReadOnly()

fml::UniqueFD fml::OpenFileReadOnly ( const fml::UniqueFD base_directory,
const char *  path 
)

Helper method that calls OpenFile with create_if_necessary = false and permission = kRead.

This can open a directory on POSIX, but not on Windows.

Definition at line 92 of file file.cc.

References kRead, and OpenFile().

Referenced by flutter::DirectoryAssetBundle::DirectoryAssetBundle(), IsDirectory(), flutter::PersistentCache::LoadSkSLs(), and flutter::testing::TEST_F().

93  {
94  return OpenFile(base_directory, path, false, FilePermission::kRead);
95 }
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
Definition: file_posix.cc:65
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

◆ operator!=() [1/2]

template<class C >
bool fml::operator!= ( p1,
const scoped_nsprotocol< C > &  p2 
)

Definition at line 108 of file scoped_nsobject.h.

References fml::scoped_nsprotocol< NST >::get().

108  {
109  return p1 != p2.get();
110 }

◆ operator!=() [2/2]

template<class T , class Traits >
bool fml::operator!= ( const T &  value,
const UniqueObject< T, Traits > &  object 
)

Definition at line 131 of file unique_object.h.

131  {
132  return !(value == object.get());
133 }
uint8_t value

◆ operator==() [1/2]

template<class C >
bool fml::operator== ( p1,
const scoped_nsprotocol< C > &  p2 
)

Definition at line 103 of file scoped_nsobject.h.

References fml::scoped_nsprotocol< NST >::get().

103  {
104  return p1 == p2.get();
105 }

◆ operator==() [2/2]

template<class T , class Traits >
bool fml::operator== ( const T &  value,
const UniqueObject< T, Traits > &  object 
)

Definition at line 126 of file unique_object.h.

126  {
127  return value == object.get();
128 }
uint8_t value

◆ RangeForCharacterAtIndex()

NSRange fml::RangeForCharacterAtIndex ( NSString *  text,
NSUInteger  index 
)

Definition at line 9 of file string_range_sanitization.mm.

Referenced by TEST().

9  {
10  if (text == nil || index > text.length) {
11  return NSMakeRange(NSNotFound, 0);
12  }
13  if (index < text.length) {
14  return [text rangeOfComposedCharacterSequenceAtIndex:index];
15  }
16  return NSMakeRange(index, 0);
17 }
std::u16string text

◆ RangeForCharactersInRange()

NSRange fml::RangeForCharactersInRange ( NSString *  text,
NSRange  range 
)

Definition at line 19 of file string_range_sanitization.mm.

Referenced by TEST().

19  {
20  if (text == nil || range.location + range.length > text.length) {
21  return NSMakeRange(NSNotFound, 0);
22  }
23  NSRange sanitizedRange = [text rangeOfComposedCharacterSequencesForRange:range];
24  // We don't want to override the length, we just want to make sure we don't
25  // select into the middle of a multi-byte character. Taking the
26  // `sanitizedRange`'s length will end up altering the actual selection.
27  return NSMakeRange(sanitizedRange.location, range.length);
28 }
std::u16string text

◆ Ref()

template<typename T >
RefPtr<T> fml::Ref ( T *  ptr)
inline

Definition at line 236 of file ref_ptr.h.

Referenced by flutter::UnrefQueue< T >::Unref().

236  {
237  return RefPtr<T>(ptr);
238 }

◆ RefreshRateToFrameBudget()

template<typename T >
Milliseconds fml::RefreshRateToFrameBudget ( refresh_rate)

Definition at line 24 of file time_delta.h.

Referenced by flutter::Shell::GetDartVM(), and flutter::testing::TEST().

24  {
25  return Milliseconds(1s) / refresh_rate;
26 }
std::chrono::duration< double, std::milli > Milliseconds
Definition: time_delta.h:18

◆ RemoveDirectoryRecursively()

bool fml::RemoveDirectoryRecursively ( const fml::UniqueFD parent,
const char *  directory_name 
)

Helper method to recursively remove files and subdirectories inside the directory. The directory itself will also be removed.

Return true if and only if all files have been successfully removed.

Definition at line 120 of file file.cc.

References flutter::dir, kReadWrite, OpenDirectory(), RemoveFilesInDirectory(), and UnlinkDirectory().

Referenced by flutter::PersistentCache::Purge().

121  {
122  auto dir = fml::OpenDirectory(parent, directory_name, false,
124  return RemoveFilesInDirectory(dir) && UnlinkDirectory(parent, directory_name);
125 }
bool RemoveFilesInDirectory(const fml::UniqueFD &directory)
Definition: file.cc:102
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition: switches.h:117
fml::UniqueFD OpenDirectory(const char *path, bool create_if_necessary, FilePermission permission)
Definition: file_posix.cc:96
bool UnlinkDirectory(const char *path)
Definition: file_posix.cc:162

◆ RemoveFilesInDirectory()

bool fml::RemoveFilesInDirectory ( const fml::UniqueFD directory)

Helper method to recursively remove files and subdirectories inside the directory. The directory itself will not be removed.

Return true if and only if all files have been successfully removed.

Definition at line 102 of file file.cc.

References IsDirectory(), OpenDirectoryReadOnly(), UnlinkDirectory(), UnlinkFile(), and VisitFiles().

Referenced by RemoveDirectoryRecursively(), flutter::testing::TEST_F(), and fml::ScopedTemporaryDirectory::~ScopedTemporaryDirectory().

102  {
103  fml::FileVisitor recursive_cleanup = [&recursive_cleanup](
104  const fml::UniqueFD& directory,
105  const std::string& filename) {
106  bool removed;
107  if (fml::IsDirectory(directory, filename.c_str())) {
108  fml::UniqueFD sub_dir =
109  OpenDirectoryReadOnly(directory, filename.c_str());
110  removed = VisitFiles(sub_dir, recursive_cleanup) &&
111  fml::UnlinkDirectory(directory, filename.c_str());
112  } else {
113  removed = fml::UnlinkFile(directory, filename.c_str());
114  }
115  return removed;
116  };
117  return VisitFiles(directory, recursive_cleanup);
118 }
std::function< bool(const fml::UniqueFD &directory, const std::string &filename)> FileVisitor
Definition: file.h:98
bool VisitFiles(const fml::UniqueFD &directory, const FileVisitor &visitor)
Definition: file_posix.cc:235
bool IsDirectory(const fml::UniqueFD &directory)
Definition: file_posix.cc:126
fml::UniqueFD OpenDirectoryReadOnly(const fml::UniqueFD &base_directory, const char *path)
Definition: file.cc:97
bool UnlinkFile(const char *path)
Definition: file_posix.cc:170
bool UnlinkDirectory(const char *path)
Definition: file_posix.cc:162

◆ SetLogSettings()

void fml::SetLogSettings ( const LogSettings settings)

Definition at line 29 of file log_settings.cc.

References fml::state::g_log_settings, LOG_FATAL, and fml::LogSettings::min_log_level.

Referenced by fml::ScopedSetLogSettings::ScopedSetLogSettings(), fml::testing::TEST(), and fml::ScopedSetLogSettings::~ScopedSetLogSettings().

29  {
30  // Validate the new settings as we set them.
32  std::min(LOG_FATAL, settings.min_log_level);
33 #if defined(OS_FUCHSIA)
34  // Syslog should accept all logs, since filtering by severity is done by fml.
35  fx_logger_t* logger = fx_log_get_logger();
36  if (logger) {
37  fx_logger_set_min_severity(logger,
38  std::numeric_limits<fx_log_severity_t>::min());
39  }
40 #endif
41 }
LogSettings g_log_settings
LogSeverity min_log_level
Definition: log_settings.h:25
constexpr LogSeverity LOG_FATAL
Definition: log_level.h:16

◆ SetThreadName()

void fml::SetThreadName ( const std::string &  name)

Definition at line 39 of file thread.cc.

References FML_DLOG.

Referenced by fml::Thread::SetCurrentThreadName().

39  {
40  if (name == "") {
41  return;
42  }
43 #if defined(FML_OS_MACOSX)
44  pthread_setname_np(name.c_str());
45 #elif defined(FML_OS_LINUX) || defined(FML_OS_ANDROID)
46  pthread_setname_np(pthread_self(), name.c_str());
47 #elif defined(FML_OS_WIN)
48  THREADNAME_INFO info;
49  info.dwType = 0x1000;
50  info.szName = name.c_str();
51  info.dwThreadID = GetCurrentThreadId();
52  info.dwFlags = 0;
53  __try {
54  RaiseException(kVCThreadNameException, 0, sizeof(info) / sizeof(DWORD),
55  reinterpret_cast<DWORD_PTR*>(&info));
56  } __except (EXCEPTION_CONTINUE_EXECUTION) {
57  }
58 #elif defined(OS_FUCHSIA)
59  zx::thread::self()->set_property(ZX_PROP_NAME, name.c_str(), name.size());
60 #else
61  FML_DLOG(INFO) << "Could not set the thread name to '" << name
62  << "' on this platform.";
63 #endif
64 }
DEF_SWITCHES_START aot vmservice shared library name
Definition: switches.h:32
unsigned long DWORD
Definition: windows_types.h:22
#define FML_DLOG(severity)
Definition: logging.h:85

◆ ShouldCreateLogMessage()

bool fml::ShouldCreateLogMessage ( LogSeverity  severity)

Definition at line 138 of file logging.cc.

References GetMinLogLevel().

Referenced by fml::LogMessage::stream().

138  {
139  return severity >= GetMinLogLevel();
140 }
int GetMinLogLevel()
Definition: log_settings.cc:47

◆ SignalHandler()

static void fml::SignalHandler ( int  signal)
static

Definition at line 109 of file backtrace.cc.

References BacktraceHere(), FML_LOG, SignalNameToString(), and ToggleSignalHandlers().

Referenced by ToggleSignalHandlers().

109  {
110  // We are a crash signal handler. This can only happen once. Since we don't
111  // want to catch crashes while we are generating the crash reports, disable
112  // all set signal handlers to their default values before reporting the crash
113  // and re-raising the signal.
114  ToggleSignalHandlers(false);
115 
116  FML_LOG(ERROR) << "Caught signal " << SignalNameToString(signal)
117  << " during program execution." << std::endl
118  << BacktraceHere(3);
119 
120  ::raise(signal);
121 }
std::string BacktraceHere(size_t offset)
Definition: backtrace.cc:58
#define FML_LOG(severity)
Definition: logging.h:65
static void ToggleSignalHandlers(bool set)
Definition: backtrace.cc:123
static std::string SignalNameToString(int signal)
Definition: backtrace.cc:85

◆ SignalNameToString()

static std::string fml::SignalNameToString ( int  signal)
static

Definition at line 85 of file backtrace.cc.

References ToggleSignalHandlers().

Referenced by SignalHandler().

85  {
86  switch (signal) {
87  case SIGABRT:
88  return "SIGABRT";
89  case SIGFPE:
90  return "SIGFPE";
91  case SIGBUS:
92  return "SIGBUS";
93  case SIGSEGV:
94  return "SIGSEGV";
95  case SIGSYS:
96  return "SIGSYS";
97  case SIGPIPE:
98  return "SIGPIPE";
99  case SIGALRM:
100  return "SIGALRM";
101  case SIGTERM:
102  return "SIGTERM";
103  };
104  return std::to_string(signal);
105 }

◆ size()

◆ strdup()

char * fml::strdup ( const char *  str1)

Definition at line 11 of file posix_wrappers_posix.cc.

Referenced by dart_runner::CreateServiceIsolate(), flutter::DartIsolate::Shutdown(), and flutter::WriteServerErrorResponse().

11  {
12  return ::strdup(str1);
13 }
char * strdup(const char *str1)

◆ swap() [1/2]

◆ swap() [2/2]

template<class T , class Traits >
void fml::swap ( const UniqueObject< T, Traits > &  a,
const UniqueObject< T, Traits > &  b 
)

Definition at line 121 of file unique_object.h.

References fml::UniqueObject< T, Traits >::swap().

Referenced by fml::UniqueObject< fdio_ns_t *, UniqueFDIONSTraits >::swap().

121  {
122  a.swap(b);
123 }

◆ TEST() [1/8]

fml::TEST ( MallocMapping  ,
EmptyContructor   
)

Definition at line 10 of file mapping_unittests.cc.

References fml::MallocMapping::GetMapping(), and fml::MallocMapping::GetSize().

10  {
11  MallocMapping mapping;
12  ASSERT_EQ(nullptr, mapping.GetMapping());
13  ASSERT_EQ(0u, mapping.GetSize());
14 }

◆ TEST() [2/8]

fml::TEST ( MallocMapping  ,
NotEmptyContructor   
)

Definition at line 16 of file mapping_unittests.cc.

References fml::MallocMapping::GetMapping(), fml::MallocMapping::GetSize(), and length.

16  {
17  size_t length = 10;
18  MallocMapping mapping(reinterpret_cast<uint8_t*>(malloc(length)), length);
19  ASSERT_NE(nullptr, mapping.GetMapping());
20  ASSERT_EQ(length, mapping.GetSize());
21 }
size_t length

◆ TEST() [3/8]

fml::TEST ( CountDownLatchTest  ,
CanWaitOnZero   
)

Definition at line 16 of file count_down_latch_unittests.cc.

References fml::CountDownLatch::Wait().

16  {
17  CountDownLatch latch(0);
18  latch.Wait();
19 }

◆ TEST() [4/8]

fml::TEST ( CountDownLatchTest  ,
CanWait   
)

Definition at line 21 of file count_down_latch_unittests.cc.

References fml::CountDownLatch::CountDown(), fml::Thread::GetTaskRunner(), and fml::CountDownLatch::Wait().

21  {
22  fml::Thread thread("test_thread");
23  const size_t count = 100;
24  size_t current_count = 0;
25  CountDownLatch latch(count);
26  auto decrement_latch_on_thread = [runner = thread.GetTaskRunner(), &latch,
27  &current_count]() {
28  runner->PostTask([&latch, &current_count]() {
29  std::this_thread::sleep_for(std::chrono::microseconds(100));
30  current_count++;
31  latch.CountDown();
32  });
33  };
34  for (size_t i = 0; i < count; ++i) {
35  decrement_latch_on_thread();
36  }
37  latch.Wait();
38  ASSERT_EQ(current_count, count);
39 }

◆ TEST() [5/8]

fml::TEST ( MallocMapping  ,
MoveConstructor   
)

Definition at line 23 of file mapping_unittests.cc.

References fml::MallocMapping::GetMapping(), fml::MallocMapping::GetSize(), and length.

23  {
24  size_t length = 10;
25  MallocMapping mapping(reinterpret_cast<uint8_t*>(malloc(length)), length);
26  MallocMapping moved = std::move(mapping);
27 
28  ASSERT_EQ(nullptr,
29  mapping.GetMapping()); // NOLINT(clang-analyzer-cplusplus.Move)
30  ASSERT_EQ(0u, mapping.GetSize());
31  ASSERT_NE(nullptr, moved.GetMapping());
32  ASSERT_EQ(length, moved.GetSize());
33 }
size_t length

◆ TEST() [6/8]

fml::TEST ( MallocMapping  ,
Copy   
)

Definition at line 35 of file mapping_unittests.cc.

References fml::MallocMapping::Copy(), fml::MallocMapping::GetMapping(), fml::MallocMapping::GetSize(), and length.

35  {
36  size_t length = 10;
37  MallocMapping mapping(reinterpret_cast<uint8_t*>(malloc(length)), length);
38  memset(const_cast<uint8_t*>(mapping.GetMapping()), 0xac, mapping.GetSize());
39  MallocMapping copied =
40  MallocMapping::Copy(mapping.GetMapping(), mapping.GetSize());
41 
42  ASSERT_NE(mapping.GetMapping(), copied.GetMapping());
43  ASSERT_EQ(mapping.GetSize(), copied.GetSize());
44  ASSERT_EQ(
45  0, memcmp(mapping.GetMapping(), copied.GetMapping(), mapping.GetSize()));
46 }
size_t length

◆ TEST() [7/8]

fml::TEST ( MallocMapping  ,
Release   
)

Definition at line 48 of file mapping_unittests.cc.

References fml::MallocMapping::GetMapping(), fml::MallocMapping::GetSize(), length, and fml::MallocMapping::Release().

48  {
49  size_t length = 10;
50  MallocMapping mapping(reinterpret_cast<uint8_t*>(malloc(length)), length);
51  free(const_cast<uint8_t*>(mapping.Release()));
52  ASSERT_EQ(nullptr, mapping.GetMapping());
53  ASSERT_EQ(0u, mapping.GetSize());
54 }
size_t length

◆ TEST() [8/8]

fml::TEST ( MallocMapping  ,
IsDontNeedSafe   
)

Definition at line 56 of file mapping_unittests.cc.

References fml::MallocMapping::GetMapping(), fml::MallocMapping::IsDontNeedSafe(), and length.

56  {
57  size_t length = 10;
58  MallocMapping mapping(reinterpret_cast<uint8_t*>(malloc(length)), length);
59  ASSERT_NE(nullptr, mapping.GetMapping());
60  ASSERT_FALSE(mapping.IsDontNeedSafe());
61 }
size_t length

◆ TimerDrain()

bool fml::TimerDrain ( int  fd)

Drains the timer FD and returns true if it has expired. This may be false in case the timer read is non-blocking and this routine was called before the timer expiry.

Definition at line 58 of file timerfd.cc.

References FML_HANDLE_EINTR, and size().

Referenced by AcquireLooperForThread().

58  {
59  // 8 bytes must be read from a signaled timer file descriptor when signaled.
60  uint64_t fire_count = 0;
61  ssize_t size = FML_HANDLE_EINTR(::read(fd, &fire_count, sizeof(uint64_t)));
62  if (size != sizeof(uint64_t)) {
63  return false;
64  }
65  return fire_count > 0;
66 }
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:226
#define FML_HANDLE_EINTR(x)
Definition: eintr_wrapper.h:20

◆ TimerRearm()

bool fml::TimerRearm ( int  fd,
fml::TimePoint  time_point 
)

Rearms the timer to expire at the given time point.

Definition at line 37 of file timerfd.cc.

References FML_DLOG, NSEC_PER_SEC, result, TFD_TIMER_ABSTIME, timerfd_settime(), fml::TimePoint::ToEpochDelta(), and fml::TimeDelta::ToNanoseconds().

Referenced by AcquireLooperForThread().

37  {
38  uint64_t nano_secs = time_point.ToEpochDelta().ToNanoseconds();
39 
40  // "0" will disarm the timer, desired behavior is to immediately
41  // trigger the timer.
42  if (nano_secs < 1) {
43  nano_secs = 1;
44  }
45 
46  struct itimerspec spec = {};
47  spec.it_value.tv_sec = static_cast<time_t>(nano_secs / NSEC_PER_SEC);
48  spec.it_value.tv_nsec = nano_secs % NSEC_PER_SEC;
49  spec.it_interval = spec.it_value; // single expiry.
50 
51  int result = ::timerfd_settime(fd, TFD_TIMER_ABSTIME, &spec, nullptr);
52  if (result != 0) {
53  FML_DLOG(ERROR) << "timerfd_settime err:" << strerror(errno);
54  }
55  return result == 0;
56 }
int timerfd_settime(int ufc, int flags, const struct itimerspec *utmr, struct itimerspec *otmr)
Definition: timerfd.cc:22
#define NSEC_PER_SEC
Definition: timerfd.cc:34
GAsyncResult * result
TimeDelta ToEpochDelta() const
Definition: time_point.h:52
constexpr int64_t ToNanoseconds() const
Definition: time_delta.h:61
#define FML_DLOG(severity)
Definition: logging.h:85
#define TFD_TIMER_ABSTIME
Definition: timerfd.h:29

◆ ToggleSignalHandlers()

static void fml::ToggleSignalHandlers ( bool  set)
static

Definition at line 123 of file backtrace.cc.

References FML_LOG, kKnownSignalHandlers, and SignalHandler().

Referenced by InstallCrashHandler(), SignalHandler(), and SignalNameToString().

123  {
124  for (size_t i = 0; i < sizeof(kKnownSignalHandlers) / sizeof(size_t); ++i) {
125  auto signal_name = kKnownSignalHandlers[i];
126  auto handler = set ? &SignalHandler : SIG_DFL;
127 
128  if (::signal(signal_name, handler) == SIG_ERR) {
129  FML_LOG(ERROR) << "Could not attach signal handler for " << signal_name;
130  }
131  }
132 }
#define FML_LOG(severity)
Definition: logging.h:65
static void SignalHandler(int signal)
Definition: backtrace.cc:109
static size_t kKnownSignalHandlers[]
Definition: backtrace.cc:74

◆ ToPosixAccessFlags()

static int fml::ToPosixAccessFlags ( FilePermission  permission)
static

Definition at line 33 of file file_posix.cc.

References flags, kRead, kReadWrite, and kWrite.

Referenced by OpenFile().

33  {
34  int flags = 0;
35  switch (permission) {
36  case FilePermission::kRead:
37  flags |= O_RDONLY; // read only
38  break;
39  case FilePermission::kWrite:
40  flags |= O_WRONLY; // write only
41  break;
42  case FilePermission::kReadWrite:
43  flags |= O_RDWR; // read-write
44  break;
45  }
46  return flags;
47 }
FlutterSemanticsFlag flags

◆ ToPosixCreateModeFlags()

static int fml::ToPosixCreateModeFlags ( FilePermission  permission)
static

Definition at line 49 of file file_posix.cc.

References kRead, kReadWrite, kWrite, and flutter::mode.

Referenced by OpenDirectory(), and OpenFile().

49  {
50  int mode = 0;
51  switch (permission) {
52  case FilePermission::kRead:
53  mode |= S_IRUSR;
54  break;
55  case FilePermission::kWrite:
56  mode |= S_IWUSR;
57  break;
58  case FilePermission::kReadWrite:
59  mode |= S_IRUSR | S_IWUSR;
60  break;
61  }
62  return mode;
63 }
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive mode
Definition: switches.h:194

◆ ToPosixProtectionFlags()

static int fml::ToPosixProtectionFlags ( std::initializer_list< FileMapping::Protection protection_flags)
static

Definition at line 20 of file mapping_posix.cc.

References flags, fml::FileMapping::kExecute, fml::FileMapping::kRead, and fml::FileMapping::kWrite.

Referenced by fml::FileMapping::FileMapping().

21  {
22  int flags = 0;
23  for (auto protection : protection_flags) {
24  switch (protection) {
25  case FileMapping::Protection::kRead:
26  flags |= PROT_READ;
27  break;
28  case FileMapping::Protection::kWrite:
29  flags |= PROT_WRITE;
30  break;
31  case FileMapping::Protection::kExecute:
32  flags |= PROT_READ | PROT_EXEC;
33  break;
34  }
35  }
36  return flags;
37 }
FlutterSemanticsFlag flags

◆ TruncateFile()

bool fml::TruncateFile ( const fml::UniqueFD file,
size_t  size 
)

Definition at line 154 of file file_posix.cc.

References fml::UniqueObject< T, Traits >::get(), fml::UniqueObject< T, Traits >::is_valid(), and size().

Referenced by GetFileAttributesForUtf8Path(), TEST(), WriteAtomically(), and WriteStringToFile().

154  {
155  if (!file.is_valid()) {
156  return false;
157  }
158 
159  return ::ftruncate(file.get(), size) == 0;
160 }
const T & get() const
Definition: unique_object.h:87
bool is_valid() const
Definition: unique_object.h:89
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets Path to the Flutter assets directory enable service port Allow the VM service to fallback to automatic port selection if binding to a specified port fails trace Trace early application lifecycle Automatically switches to an endless trace buffer trace skia Filters out all Skia trace event categories except those that are specified in this comma separated list dump skp on shader Automatically dump the skp that triggers new shader compilations This is useful for writing custom ShaderWarmUp to reduce jank By this is not enabled to reduce the overhead purge persistent Remove all existing persistent cache This is mainly for debugging purposes such as reproducing the shader compilation jank use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:226

◆ UnlinkDirectory() [1/2]

bool fml::UnlinkDirectory ( const char *  path)

Definition at line 162 of file file_posix.cc.

References flutter::path.

Referenced by GetFileAttributesForUtf8Path(), RemoveDirectoryRecursively(), RemoveFilesInDirectory(), TEST(), and fml::ScopedTemporaryDirectory::~ScopedTemporaryDirectory().

162  {
163  return UnlinkDirectory(fml::UniqueFD{AT_FDCWD}, path);
164 }
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
bool UnlinkDirectory(const char *path)
Definition: file_posix.cc:162

◆ UnlinkDirectory() [2/2]

bool fml::UnlinkDirectory ( const fml::UniqueFD base_directory,
const char *  path 
)

Definition at line 166 of file file_posix.cc.

References fml::UniqueObject< T, Traits >::get(), and flutter::path.

166  {
167  return ::unlinkat(base_directory.get(), path, AT_REMOVEDIR) == 0;
168 }
const T & get() const
Definition: unique_object.h:87
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

◆ UnlinkFile() [1/2]

bool fml::UnlinkFile ( const char *  path)

Definition at line 170 of file file_posix.cc.

References flutter::path.

Referenced by GetFileAttributesForUtf8Path(), flutter::PersistentCache::Purge(), RemoveFilesInDirectory(), impeller::testing::ArchivistFixture::TearDown(), TEST(), and flutter::testing::TEST_F().

170  {
171  return UnlinkFile(fml::UniqueFD{AT_FDCWD}, path);
172 }
bool UnlinkFile(const char *path)
Definition: file_posix.cc:170
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

◆ UnlinkFile() [2/2]

bool fml::UnlinkFile ( const fml::UniqueFD base_directory,
const char *  path 
)

Definition at line 174 of file file_posix.cc.

References FML_DLOG, fml::UniqueObject< T, Traits >::get(), and flutter::path.

174  {
175  int code = ::unlinkat(base_directory.get(), path, 0);
176  if (code != 0) {
177  FML_DLOG(ERROR) << strerror(errno);
178  }
179  return code == 0;
180 }
const T & get() const
Definition: unique_object.h:87
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_DLOG(severity)
Definition: logging.h:85

◆ Utf16ToUtf8()

std::string fml::Utf16ToUtf8 ( const std::u16string_view  string)

Definition at line 25 of file string_conversion.cc.

References flutter::data.

Referenced by flutter::TextEditingDelta::delta_text(), flutter::TextInputModel::GetCursorOffset(), flutter::TextInputModel::GetText(), fml::jni::JavaStringToString(), flutter::TextEditingDelta::old_text(), fml::testing::TEST(), and base::UTF16ToUTF8().

25  {
26  Utf16StringConverter converter;
27  return converter.to_bytes(string.data());
28 }
std::wstring_convert< std::codecvt_utf8_utf16< char16_t >, char16_t > Utf16StringConverter
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition: switches.h:41

◆ Utf8ToUtf16()

std::u16string fml::Utf8ToUtf16 ( const std::string_view  string)

Definition at line 30 of file string_conversion.cc.

References flutter::data.

Referenced by flutter::TextInputModel::AddText(), flutter::TextInputPlugin::ComposeChangeHook(), flutter::TextInputModel::SetText(), fml::jni::StringToJavaString(), fml::testing::TEST(), flutter::TextInputPlugin::TextHook(), flutter::TextInputModel::UpdateComposingText(), and base::UTF8ToUTF16().

30  {
31  Utf16StringConverter converter;
32  return converter.from_bytes(string.data());
33 }
std::wstring_convert< std::codecvt_utf8_utf16< char16_t >, char16_t > Utf16StringConverter
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition: switches.h:41

◆ Utf8ToWideString()

std::wstring fml::Utf8ToWideString ( const std::string_view  str)

Definition at line 21 of file wstring_conversion.cc.

Referenced by GetFileAttributesForUtf8Path(), IsAbsolutePath(), flutter::PlatformHandlerWin32::SetPlainText(), and fml::testing::TEST().

21  {
22  WideStringConverter converter;
23  return converter.from_bytes(str.data());
24 }
std::wstring_convert< std::codecvt_utf8_utf16< wchar_t >, wchar_t > WideStringConverter

◆ VisitFiles()

bool fml::VisitFiles ( const fml::UniqueFD directory,
const FileVisitor visitor 
)

Call visitor on all files inside the directory non-recursively. The trivial file "." and ".." will not be visited.

Return false if and only if the visitor returns false during the traversal.

If recursive visiting is needed, call VisitFiles inside the visitor, or use our helper method VisitFilesRecursively.

See also
VisitFilesRecursively.
Note
Procedure doesn't copy all closures.

Definition at line 235 of file file_posix.cc.

References flutter::dir, FML_DLOG, fml::UniqueObject< T, Traits >::get(), fml::UniqueObject< T, Traits >::is_valid(), and fml::UniqueObject< T, Traits >::release().

Referenced by flutter::DirectoryAssetBundle::DirectoryAssetBundle(), GetFileAttributesForUtf8Path(), flutter::PersistentCache::LoadSkSLs(), flutter::PersistentCache::Purge(), RemoveFilesInDirectory(), TEST(), and VisitFilesRecursively().

235  {
236  fml::UniqueFD dup_fd(dup(directory.get()));
237  if (!dup_fd.is_valid()) {
238  FML_DLOG(ERROR) << "Can't dup the directory fd. Error: " << strerror(errno);
239  return true; // continue to visit other files
240  }
241 
242  fml::UniqueDir dir(::fdopendir(dup_fd.get()));
243  if (!dir.is_valid()) {
244  FML_DLOG(ERROR) << "Can't open the directory. Error: " << strerror(errno);
245  return true; // continue to visit other files
246  }
247 
248  // The directory fd will be closed by `closedir`.
249  (void)dup_fd.release();
250 
251  // Without `rewinddir`, `readir` will directly return NULL (end of dir is
252  // reached) after a previuos `VisitFiles` call for the same `const
253  // fml::UniqueFd& directory`.
254  rewinddir(dir.get());
255  while (dirent* ent = readdir(dir.get())) {
256  std::string filename = ent->d_name;
257  if (filename != "." && filename != "..") {
258  if (!visitor(directory, filename)) {
259  return false;
260  }
261  }
262  }
263 
264  return true;
265 }
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 observatory The hostname IP address on which the Dart Observatory should be served If not defaults to or::depending on whether ipv6 is specified disable Disable the Dart Observatory The observatory is never available in release mode Bind to the IPv6 localhost address for the Dart Observatory Ignored if observatory host is set endless trace Enable an endless trace buffer The default is a ring buffer This is useful when very old events need to viewed For during application launch Memory usage will continue to grow indefinitely however Start app with an specific route defined on the framework flutter assets dir
Definition: switches.h:117
const T & get() const
Definition: unique_object.h:87
#define FML_DLOG(severity)
Definition: logging.h:85

◆ VisitFilesRecursively()

bool fml::VisitFilesRecursively ( const fml::UniqueFD directory,
const FileVisitor visitor 
)

Recursively call visitor on all files inside the directory. Return false if and only if the visitor returns false during the traversal.

This is a helper method that wraps the general VisitFiles method. The VisitFiles is strictly more powerful as it has the access of the recursion stack to the file. For example, VisitFiles may be able to maintain a vector of directory names that lead to a file. That could be useful to compute the relative path between the root directory and the visited file.

See also
VisitFiles.
Note
Procedure doesn't copy all closures.

Definition at line 71 of file file.cc.

References FML_LOG, fml::UniqueObject< T, Traits >::is_valid(), IsDirectory(), OpenDirectoryReadOnly(), and VisitFiles().

Referenced by flutter::DirectoryAssetBundle::DirectoryAssetBundle(), flutter::PersistentCache::Purge(), TEST(), and flutter::testing::TEST_F().

72  {
73  FileVisitor recursive_visitor = [&recursive_visitor, &visitor](
74  const UniqueFD& directory,
75  const std::string& filename) {
76  if (!visitor(directory, filename)) {
77  return false;
78  }
79  if (IsDirectory(directory, filename.c_str())) {
80  UniqueFD sub_dir = OpenDirectoryReadOnly(directory, filename.c_str());
81  if (!sub_dir.is_valid()) {
82  FML_LOG(ERROR) << "Can't open sub-directory: " << filename;
83  return true;
84  }
85  return VisitFiles(sub_dir, recursive_visitor);
86  }
87  return true;
88  };
89  return VisitFiles(directory, recursive_visitor);
90 }
std::function< bool(const fml::UniqueFD &directory, const std::string &filename)> FileVisitor
Definition: file.h:98
UniqueObject< int, internal::os_unix::UniqueFDTraits > UniqueFD
Definition: unique_fd.h:100
#define FML_LOG(severity)
Definition: logging.h:65
bool VisitFiles(const fml::UniqueFD &directory, const FileVisitor &visitor)
Definition: file_posix.cc:235
bool IsDirectory(const fml::UniqueFD &directory)
Definition: file_posix.cc:126
fml::UniqueFD OpenDirectoryReadOnly(const fml::UniqueFD &base_directory, const char *path)
Definition: file.cc:97

◆ WaitWithTimeoutImpl()

template<typename ConditionFn >
bool fml::WaitWithTimeoutImpl ( std::unique_lock< std::mutex > *  locker,
std::condition_variable *  cv,
ConditionFn  condition,
TimeDelta  timeout 
)

Definition at line 20 of file waitable_event.cc.

References FML_DCHECK, fml::TimePoint::Now(), and fml::TimeDelta::ToNanoseconds().

Referenced by fml::ManualResetWaitableEvent::WaitWithTimeout().

23  {
24  FML_DCHECK(locker->owns_lock());
25 
26  if (condition()) {
27  return false;
28  }
29 
30  // We may get spurious wakeups.
31  TimeDelta wait_remaining = timeout;
32  TimePoint start = TimePoint::Now();
33  while (true) {
34  if (std::cv_status::timeout ==
35  cv->wait_for(*locker, std::chrono::nanoseconds(
36  wait_remaining.ToNanoseconds()))) {
37  return true; // Definitely timed out.
38  }
39 
40  // We may have been awoken.
41  if (condition()) {
42  return false;
43  }
44 
45  // Or the wakeup may have been spurious.
46  TimePoint now = TimePoint::Now();
47  FML_DCHECK(now >= start);
48  TimeDelta elapsed = now - start;
49  // It's possible that we may have timed out anyway.
50  if (elapsed >= timeout) {
51  return true;
52  }
53 
54  // Otherwise, recalculate the amount that we have left to wait.
55  wait_remaining = timeout - elapsed;
56  }
57 }
#define FML_DCHECK(condition)
Definition: logging.h:86

◆ WideStringToUtf8()

std::string fml::WideStringToUtf8 ( const std::wstring_view  str)

Definition at line 16 of file wstring_conversion.cc.

Referenced by GetFileAttributesForUtf8Path(), GetFullHandlePath(), GetLastErrorMessage(), flutter::PlatformHandlerWin32::GetPlainText(), flutter::ParseLanguageName(), and fml::testing::TEST().

16  {
17  WideStringConverter converter;
18  return converter.to_bytes(str.data());
19 }
std::wstring_convert< std::codecvt_utf8_utf16< wchar_t >, wchar_t > WideStringConverter

◆ WriteAtomically()

bool fml::WriteAtomically ( const fml::UniqueFD base_directory,
const char *  file_name,
const Mapping mapping 
)

Definition at line 190 of file file_posix.cc.

References FML_HANDLE_EINTR, fml::UniqueObject< T, Traits >::get(), fml::Mapping::GetMapping(), fml::Mapping::GetSize(), kReadWrite, OpenFile(), and TruncateFile().

Referenced by impeller::compiler::testing::CompilerTest::CanCompileAndReflect(), GetFileAttributesForUtf8Path(), impeller::Main(), impeller::compiler::Main(), flutter::PersistentCacheStore(), flutter::testing::CanvasProvider::Snapshot(), TEST(), flutter::testing::TEST_F(), and flutter::testing::WriteImageToDisk().

192  {
193  if (file_name == nullptr || data.GetMapping() == nullptr) {
194  return false;
195  }
196 
197  std::stringstream stream;
198  stream << file_name << ".temp";
199  const auto temp_file_name = stream.str();
200 
201  auto temp_file = OpenFile(base_directory, temp_file_name.c_str(), true,
202  FilePermission::kReadWrite);
203  if (!temp_file.is_valid()) {
204  return false;
205  }
206 
207  if (!TruncateFile(temp_file, data.GetSize())) {
208  return false;
209  }
210 
211  ssize_t remaining = data.GetSize();
212  ssize_t written = 0;
213  ssize_t offset = 0;
214 
215  while (remaining > 0) {
216  written = FML_HANDLE_EINTR(
217  ::write(temp_file.get(), data.GetMapping() + offset, remaining));
218 
219  if (written == -1) {
220  return false;
221  }
222 
223  remaining -= written;
224  offset += written;
225  }
226 
227  if (::fsync(temp_file.get()) != 0) {
228  return false;
229  }
230 
231  return ::renameat(base_directory.get(), temp_file_name.c_str(),
232  base_directory.get(), file_name) == 0;
233 }
const T & get() const
Definition: unique_object.h:87
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition: switches.h:41
#define FML_HANDLE_EINTR(x)
Definition: eintr_wrapper.h:20
fml::UniqueFD OpenFile(const char *path, bool create_if_necessary, FilePermission permission)
This can open a directory on POSIX, but not on Windows.
Definition: file_posix.cc:65
bool TruncateFile(const fml::UniqueFD &file, size_t size)
Definition: file_posix.cc:154

Variable Documentation

◆ _kUnmerged

◆ kClockType [1/2]

constexpr int fml::kClockType = CLOCK_MONOTONIC
static

Definition at line 14 of file message_loop_android.cc.

◆ kClockType [2/2]

constexpr int fml::kClockType = CLOCK_MONOTONIC
static

Definition at line 15 of file message_loop_linux.cc.

◆ kDecodeMap

constexpr signed char fml::kDecodeMap[]
static
Initial value:
= {
26, 27, 28, 29, 30, 31, -1, -1, -1, -1, -1, -1, -1, -1,
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12,
13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25}

Definition at line 45 of file base32.cc.

◆ kDecodeMapSize

constexpr int fml::kDecodeMapSize
static
Initial value:
=
sizeof(kDecodeMap) / sizeof(kDecodeMap[0])
static constexpr signed char kDecodeMap[]
Definition: base32.cc:45

Definition at line 51 of file base32.cc.

◆ kDefaultFrameBudget

constexpr Milliseconds fml::kDefaultFrameBudget = Milliseconds(1s) / 60

Definition at line 21 of file time_delta.h.

Referenced by flutter::Shell::GetDartVM().

◆ kDistantFuture

constexpr CFTimeInterval fml::kDistantFuture = 1.0e10
static

Definition at line 14 of file message_loop_darwin.mm.

◆ kEncoding [1/2]

constexpr char fml::kEncoding[] = "0123456789abcdef"
static

Definition at line 11 of file hex_codec.cc.

◆ kEncoding [2/2]

constexpr char fml::kEncoding[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"
static

Definition at line 12 of file base32.cc.

◆ kKnownSignalHandlers

size_t fml::kKnownSignalHandlers[]
static
Initial value:
= {
SIGABRT,
SIGFPE,
SIGBUS,
SIGSEGV,
SIGSYS,
SIGPIPE,
SIGALRM,
SIGTERM,
}

Definition at line 74 of file backtrace.cc.

Referenced by ToggleSignalHandlers().

◆ kKUnknownFrameName [1/2]

std::string fml::kKUnknownFrameName = "Unknown"
static

Definition at line 9 of file backtrace_stub.cc.

◆ kKUnknownFrameName [2/2]

std::string fml::kKUnknownFrameName = "Unknown"
static

Definition at line 25 of file backtrace.cc.

Referenced by DemangleSymbolName(), and GetSymbolName().

◆ LOG_DFATAL

const LogSeverity fml::LOG_DFATAL = LOG_FATAL

Definition at line 30 of file log_level.h.

◆ LOG_ERROR

constexpr LogSeverity fml::LOG_ERROR = 2

Definition at line 15 of file log_level.h.

Referenced by fml::LogMessage::~LogMessage().

◆ LOG_FATAL

constexpr LogSeverity fml::LOG_FATAL = 3

Definition at line 16 of file log_level.h.

Referenced by GetMinLogLevel(), SetLogSettings(), and fml::LogMessage::~LogMessage().

◆ LOG_INFO

◆ LOG_NUM_SEVERITIES

constexpr LogSeverity fml::LOG_NUM_SEVERITIES = 4

Definition at line 17 of file log_level.h.

◆ LOG_WARNING

constexpr LogSeverity fml::LOG_WARNING = 1

Definition at line 14 of file log_level.h.

Referenced by flutter::testing::TEST_F(), and fml::LogMessage::~LogMessage().

◆ tls_message_loop

Definition at line 17 of file message_loop.cc.

◆ tls_task_source_grade

◆ tTaskObservers

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

Definition at line 11 of file task_observers.cc.