Flutter Engine
The Flutter Engine
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
SkSpinlock.cpp
Go to the documentation of this file.
1/*
2 * Copyright 2015 Google Inc.
3 *
4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file.
6 */
7
9
12
13#if 0
15 #include <execinfo.h>
16 #include <stdio.h>
17
18 static void debug_trace() {
19 void* stack[64];
20 int len = backtrace(stack, std::size(stack));
21
22 // As you might imagine, we can't use an SkSpinlock here...
23 static SkMutex lock;
24 {
25 SkAutoMutexExclusive locked(lock);
26 fprintf(stderr, "\n");
27 backtrace_symbols_fd(stack, len, 2/*stderr*/);
28 fprintf(stderr, "\n");
29 }
30 }
31#else
32 static void debug_trace() {}
33#endif
34
35// Renamed from "pause" to avoid conflict with function defined in unistd.h
36#if SK_CPU_SSE_LEVEL >= SK_CPU_SSE_LEVEL_SSE2
37 #include <emmintrin.h>
38 static void do_pause() { _mm_pause(); }
39#else
40 static void do_pause() { /*spin*/ }
41#endif
42
43void SkSpinlock::contendedAcquire() {
45
46 // To act as a mutex, we need an acquire barrier when we acquire the lock.
48 while (fLocked.exchange(true, std::memory_order_acquire)) {
49 do_pause();
50 }
52}
static void do_pause()
Definition: SkSpinlock.cpp:38
static void debug_trace()
Definition: SkSpinlock.cpp:32
#define SK_POTENTIALLY_BLOCKING_REGION_END
#define SK_POTENTIALLY_BLOCKING_REGION_BEGIN
it will be possible to load the file into Perfetto s trace viewer 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:259