1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/threading/platform_thread_win.h"
6
7 #include <windows.h>
8
9 #include <stddef.h>
10
11 #include <string>
12
13 #include "base/debug/alias.h"
14 #include "base/debug/crash_logging.h"
15 #include "base/debug/profiler.h"
16 #include "base/feature_list.h"
17 #include "base/logging.h"
18 #include "base/memory/raw_ptr.h"
19 #include "base/metrics/histogram_macros.h"
20 #include "base/process/memory.h"
21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/utf_string_conversions.h"
23 #include "base/threading/scoped_blocking_call.h"
24 #include "base/threading/scoped_thread_priority.h"
25 #include "base/threading/thread_id_name_manager.h"
26 #include "base/threading/thread_restrictions.h"
27 #include "base/threading/threading_features.h"
28 #include "base/time/time_override.h"
29 #include "base/win/scoped_handle.h"
30 #include "base/win/windows_version.h"
31 #include "build/build_config.h"
32 #include "partition_alloc/buildflags.h"
33
34 #if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
35 #include "partition_alloc/stack/stack.h"
36 #endif
37
38 namespace base {
39
40 BASE_FEATURE(kAboveNormalCompositingBrowserWin,
41 "AboveNormalCompositingBrowserWin",
42 base::FEATURE_ENABLED_BY_DEFAULT);
43
44 namespace {
45
46 // Flag used to map Compositing ThreadType |THREAD_PRIORITY_ABOVE_NORMAL| on the
47 // UI thread for |kAboveNormalCompositingBrowserWin| Feature.
48 std::atomic<bool> g_above_normal_compositing_browser{true};
49
50 // These values are sometimes returned by ::GetThreadPriority().
51 constexpr int kWinDisplayPriority1 = 5;
52 constexpr int kWinDisplayPriority2 = 6;
53
54 // The information on how to set the thread name comes from
55 // a MSDN article: http://msdn2.microsoft.com/en-us/library/xcb2z8hs.aspx
56 const DWORD kVCThreadNameException = 0x406D1388;
57
58 typedef struct tagTHREADNAME_INFO {
59 DWORD dwType; // Must be 0x1000.
60 LPCSTR szName; // Pointer to name (in user addr space).
61 DWORD dwThreadID; // Thread ID (-1=caller thread).
62 DWORD dwFlags; // Reserved for future use, must be zero.
63 } THREADNAME_INFO;
64
65 // The SetThreadDescription API was brought in version 1607 of Windows 10.
66 typedef HRESULT(WINAPI* SetThreadDescription)(HANDLE hThread,
67 PCWSTR lpThreadDescription);
68
69 // This function has try handling, so it is separated out of its caller.
SetNameInternal(PlatformThreadId thread_id,const char * name)70 void SetNameInternal(PlatformThreadId thread_id, const char* name) {
71 THREADNAME_INFO info;
72 info.dwType = 0x1000;
73 info.szName = name;
74 info.dwThreadID = thread_id;
75 info.dwFlags = 0;
76
77 __try {
78 RaiseException(kVCThreadNameException, 0, sizeof(info) / sizeof(ULONG_PTR),
79 reinterpret_cast<ULONG_PTR*>(&info));
80 } __except (EXCEPTION_EXECUTE_HANDLER) {
81 }
82 }
83
84 struct ThreadParams {
85 raw_ptr<PlatformThread::Delegate> delegate;
86 bool joinable;
87 ThreadType thread_type;
88 MessagePumpType message_pump_type;
89 };
90
ThreadFunc(void * params)91 DWORD __stdcall ThreadFunc(void* params) {
92 ThreadParams* thread_params = static_cast<ThreadParams*>(params);
93 PlatformThread::Delegate* delegate = thread_params->delegate;
94 if (!thread_params->joinable)
95 base::DisallowSingleton();
96
97 if (thread_params->thread_type != ThreadType::kDefault)
98 internal::SetCurrentThreadType(thread_params->thread_type,
99 thread_params->message_pump_type);
100
101 // Retrieve a copy of the thread handle to use as the key in the
102 // thread name mapping.
103 PlatformThreadHandle::Handle platform_handle;
104 BOOL did_dup = DuplicateHandle(GetCurrentProcess(),
105 GetCurrentThread(),
106 GetCurrentProcess(),
107 &platform_handle,
108 0,
109 FALSE,
110 DUPLICATE_SAME_ACCESS);
111
112 #if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
113 partition_alloc::internal::StackTopRegistry::Get().NotifyThreadCreated();
114 #endif
115
116 win::ScopedHandle scoped_platform_handle;
117
118 if (did_dup) {
119 scoped_platform_handle.Set(platform_handle);
120 ThreadIdNameManager::GetInstance()->RegisterThread(
121 scoped_platform_handle.get(), PlatformThread::CurrentId());
122 }
123
124 delete thread_params;
125 delegate->ThreadMain();
126
127 if (did_dup) {
128 ThreadIdNameManager::GetInstance()->RemoveName(scoped_platform_handle.get(),
129 PlatformThread::CurrentId());
130 }
131
132 #if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
133 partition_alloc::internal::StackTopRegistry::Get().NotifyThreadDestroyed();
134 #endif
135
136 // Ensure thread priority is at least NORMAL before initiating thread
137 // destruction. Thread destruction on Windows holds the LdrLock while
138 // performing TLS destruction which causes hangs if performed at background
139 // priority (priority inversion) (see: http://crbug.com/1096203).
140 if (::GetThreadPriority(::GetCurrentThread()) < THREAD_PRIORITY_NORMAL)
141 PlatformThread::SetCurrentThreadType(ThreadType::kDefault);
142
143 return 0;
144 }
145
146 // CreateThreadInternal() matches PlatformThread::CreateWithType(), except
147 // that |out_thread_handle| may be nullptr, in which case a non-joinable thread
148 // is created.
CreateThreadInternal(size_t stack_size,PlatformThread::Delegate * delegate,PlatformThreadHandle * out_thread_handle,ThreadType thread_type,MessagePumpType message_pump_type)149 bool CreateThreadInternal(size_t stack_size,
150 PlatformThread::Delegate* delegate,
151 PlatformThreadHandle* out_thread_handle,
152 ThreadType thread_type,
153 MessagePumpType message_pump_type) {
154 unsigned int flags = 0;
155 if (stack_size > 0) {
156 flags = STACK_SIZE_PARAM_IS_A_RESERVATION;
157 #if defined(ARCH_CPU_32_BITS)
158 } else {
159 // The process stack size is increased to give spaces to |RendererMain| in
160 // |chrome/BUILD.gn|, but keep the default stack size of other threads to
161 // 1MB for the address space pressure.
162 flags = STACK_SIZE_PARAM_IS_A_RESERVATION;
163 static BOOL is_wow64 = -1;
164 if (is_wow64 == -1 && !IsWow64Process(GetCurrentProcess(), &is_wow64))
165 is_wow64 = FALSE;
166 // When is_wow64 is set that means we are running on 64-bit Windows and we
167 // get 4 GiB of address space. In that situation we can afford to use 1 MiB
168 // of address space for stacks. When running on 32-bit Windows we only get
169 // 2 GiB of address space so we need to conserve. Typically stack usage on
170 // these threads is only about 100 KiB.
171 if (is_wow64)
172 stack_size = 1024 * 1024;
173 else
174 stack_size = 512 * 1024;
175 #endif
176 }
177
178 ThreadParams* params = new ThreadParams;
179 params->delegate = delegate;
180 params->joinable = out_thread_handle != nullptr;
181 params->thread_type = thread_type;
182 params->message_pump_type = message_pump_type;
183
184 // Using CreateThread here vs _beginthreadex makes thread creation a bit
185 // faster and doesn't require the loader lock to be available. Our code will
186 // have to work running on CreateThread() threads anyway, since we run code on
187 // the Windows thread pool, etc. For some background on the difference:
188 // http://www.microsoft.com/msj/1099/win32/win321099.aspx
189 void* thread_handle =
190 ::CreateThread(nullptr, stack_size, ThreadFunc, params, flags, nullptr);
191
192 if (!thread_handle) {
193 DWORD last_error = ::GetLastError();
194
195 switch (last_error) {
196 case ERROR_NOT_ENOUGH_MEMORY:
197 case ERROR_OUTOFMEMORY:
198 case ERROR_COMMITMENT_LIMIT:
199 case ERROR_COMMITMENT_MINIMUM:
200 TerminateBecauseOutOfMemory(stack_size);
201
202 default:
203 static auto* last_error_crash_key = debug::AllocateCrashKeyString(
204 "create_thread_last_error", debug::CrashKeySize::Size32);
205 debug::SetCrashKeyString(last_error_crash_key,
206 base::NumberToString(last_error));
207 break;
208 }
209
210 delete params;
211 return false;
212 }
213
214 if (out_thread_handle)
215 *out_thread_handle = PlatformThreadHandle(thread_handle);
216 else
217 CloseHandle(thread_handle);
218 return true;
219 }
220
221 } // namespace
222
223 namespace internal {
224
AssertMemoryPriority(HANDLE thread,int memory_priority)225 void AssertMemoryPriority(HANDLE thread, int memory_priority) {
226 #if DCHECK_IS_ON()
227 static const auto get_thread_information_fn =
228 reinterpret_cast<decltype(&::GetThreadInformation)>(::GetProcAddress(
229 ::GetModuleHandle(L"Kernel32.dll"), "GetThreadInformation"));
230
231 DCHECK(get_thread_information_fn);
232
233 MEMORY_PRIORITY_INFORMATION memory_priority_information = {};
234 DCHECK(get_thread_information_fn(thread, ::ThreadMemoryPriority,
235 &memory_priority_information,
236 sizeof(memory_priority_information)));
237
238 DCHECK_EQ(memory_priority,
239 static_cast<int>(memory_priority_information.MemoryPriority));
240 #endif
241 }
242
243 } // namespace internal
244
245 // static
CurrentId()246 PlatformThreadId PlatformThread::CurrentId() {
247 return ::GetCurrentThreadId();
248 }
249
250 // static
CurrentRef()251 PlatformThreadRef PlatformThread::CurrentRef() {
252 return PlatformThreadRef(::GetCurrentThreadId());
253 }
254
255 // static
CurrentHandle()256 PlatformThreadHandle PlatformThread::CurrentHandle() {
257 return PlatformThreadHandle(::GetCurrentThread());
258 }
259
260 // static
YieldCurrentThread()261 void PlatformThread::YieldCurrentThread() {
262 ::Sleep(0);
263 }
264
265 // static
Sleep(TimeDelta duration)266 void PlatformThread::Sleep(TimeDelta duration) {
267 // When measured with a high resolution clock, Sleep() sometimes returns much
268 // too early. We may need to call it repeatedly to get the desired duration.
269 // PlatformThread::Sleep doesn't support mock-time, so this always uses
270 // real-time.
271 const TimeTicks end = subtle::TimeTicksNowIgnoringOverride() + duration;
272 for (TimeTicks now = subtle::TimeTicksNowIgnoringOverride(); now < end;
273 now = subtle::TimeTicksNowIgnoringOverride()) {
274 ::Sleep(static_cast<DWORD>((end - now).InMillisecondsRoundedUp()));
275 }
276 }
277
278 // static
SetName(const std::string & name)279 void PlatformThread::SetName(const std::string& name) {
280 SetNameCommon(name);
281
282 // The SetThreadDescription API works even if no debugger is attached.
283 static auto set_thread_description_func =
284 reinterpret_cast<SetThreadDescription>(::GetProcAddress(
285 ::GetModuleHandle(L"Kernel32.dll"), "SetThreadDescription"));
286 if (set_thread_description_func) {
287 set_thread_description_func(::GetCurrentThread(),
288 base::UTF8ToWide(name).c_str());
289 }
290
291 // The debugger needs to be around to catch the name in the exception. If
292 // there isn't a debugger, we are just needlessly throwing an exception.
293 if (!::IsDebuggerPresent())
294 return;
295
296 SetNameInternal(CurrentId(), name.c_str());
297 }
298
299 // static
GetName()300 const char* PlatformThread::GetName() {
301 return ThreadIdNameManager::GetInstance()->GetName(CurrentId());
302 }
303
304 // static
CreateWithType(size_t stack_size,Delegate * delegate,PlatformThreadHandle * thread_handle,ThreadType thread_type,MessagePumpType pump_type_hint)305 bool PlatformThread::CreateWithType(size_t stack_size,
306 Delegate* delegate,
307 PlatformThreadHandle* thread_handle,
308 ThreadType thread_type,
309 MessagePumpType pump_type_hint) {
310 DCHECK(thread_handle);
311 return CreateThreadInternal(stack_size, delegate, thread_handle, thread_type,
312 pump_type_hint);
313 }
314
315 // static
CreateNonJoinable(size_t stack_size,Delegate * delegate)316 bool PlatformThread::CreateNonJoinable(size_t stack_size, Delegate* delegate) {
317 return CreateNonJoinableWithType(stack_size, delegate, ThreadType::kDefault);
318 }
319
320 // static
CreateNonJoinableWithType(size_t stack_size,Delegate * delegate,ThreadType thread_type,MessagePumpType pump_type_hint)321 bool PlatformThread::CreateNonJoinableWithType(size_t stack_size,
322 Delegate* delegate,
323 ThreadType thread_type,
324 MessagePumpType pump_type_hint) {
325 return CreateThreadInternal(stack_size, delegate, nullptr /* non-joinable */,
326 thread_type, pump_type_hint);
327 }
328
329 // static
Join(PlatformThreadHandle thread_handle)330 void PlatformThread::Join(PlatformThreadHandle thread_handle) {
331 DCHECK(thread_handle.platform_handle());
332
333 DWORD thread_id = 0;
334 thread_id = ::GetThreadId(thread_handle.platform_handle());
335 DWORD last_error = 0;
336 if (!thread_id)
337 last_error = ::GetLastError();
338
339 // Record information about the exiting thread in case joining hangs.
340 base::debug::Alias(&thread_id);
341 base::debug::Alias(&last_error);
342
343 base::internal::ScopedBlockingCallWithBaseSyncPrimitives scoped_blocking_call(
344 FROM_HERE, base::BlockingType::MAY_BLOCK);
345
346 // Wait for the thread to exit. It should already have terminated but make
347 // sure this assumption is valid.
348 CHECK_EQ(WAIT_OBJECT_0,
349 WaitForSingleObject(thread_handle.platform_handle(), INFINITE));
350 CloseHandle(thread_handle.platform_handle());
351 }
352
353 // static
Detach(PlatformThreadHandle thread_handle)354 void PlatformThread::Detach(PlatformThreadHandle thread_handle) {
355 CloseHandle(thread_handle.platform_handle());
356 }
357
358 // static
CanChangeThreadType(ThreadType from,ThreadType to)359 bool PlatformThread::CanChangeThreadType(ThreadType from, ThreadType to) {
360 return true;
361 }
362
363 namespace {
364
SetCurrentThreadPriority(ThreadType thread_type,MessagePumpType pump_type_hint)365 void SetCurrentThreadPriority(ThreadType thread_type,
366 MessagePumpType pump_type_hint) {
367 if (thread_type == ThreadType::kDisplayCritical &&
368 pump_type_hint == MessagePumpType::UI &&
369 !g_above_normal_compositing_browser) {
370 // Ignore kDisplayCritical thread type for UI thread as Windows has a
371 // priority boost mechanism. See
372 // https://docs.microsoft.com/en-us/windows/win32/procthread/priority-boosts
373 return;
374 }
375
376 PlatformThreadHandle::Handle thread_handle =
377 PlatformThread::CurrentHandle().platform_handle();
378
379 if (thread_type != ThreadType::kBackground) {
380 // Exit background mode if the new priority is not BACKGROUND. This is a
381 // no-op if not in background mode.
382 ::SetThreadPriority(thread_handle, THREAD_MODE_BACKGROUND_END);
383 // We used to DCHECK that memory priority is MEMORY_PRIORITY_NORMAL here,
384 // but found that it is not always the case (e.g. in the installer).
385 // crbug.com/1340578#c2
386 }
387
388 int desired_priority = THREAD_PRIORITY_ERROR_RETURN;
389 switch (thread_type) {
390 case ThreadType::kBackground:
391 // Using THREAD_MODE_BACKGROUND_BEGIN instead of THREAD_PRIORITY_LOWEST
392 // improves input latency and navigation time. See
393 // https://docs.google.com/document/d/16XrOwuwTwKWdgPbcKKajTmNqtB4Am8TgS9GjbzBYLc0
394 //
395 // MSDN recommends THREAD_MODE_BACKGROUND_BEGIN for threads that perform
396 // background work, as it reduces disk and memory priority in addition to
397 // CPU priority.
398 desired_priority = THREAD_MODE_BACKGROUND_BEGIN;
399 break;
400 case ThreadType::kUtility:
401 desired_priority = THREAD_PRIORITY_BELOW_NORMAL;
402 break;
403 case ThreadType::kResourceEfficient:
404 case ThreadType::kDefault:
405 desired_priority = THREAD_PRIORITY_NORMAL;
406 break;
407 case ThreadType::kDisplayCritical:
408 desired_priority = THREAD_PRIORITY_ABOVE_NORMAL;
409 break;
410 case ThreadType::kRealtimeAudio:
411 desired_priority = THREAD_PRIORITY_TIME_CRITICAL;
412 break;
413 }
414 DCHECK_NE(desired_priority, THREAD_PRIORITY_ERROR_RETURN);
415
416 [[maybe_unused]] const BOOL cpu_priority_success =
417 ::SetThreadPriority(thread_handle, desired_priority);
418 DPLOG_IF(ERROR, !cpu_priority_success)
419 << "Failed to set thread priority to " << desired_priority;
420
421 if (desired_priority == THREAD_MODE_BACKGROUND_BEGIN) {
422 // Override the memory priority.
423 MEMORY_PRIORITY_INFORMATION memory_priority{.MemoryPriority =
424 MEMORY_PRIORITY_NORMAL};
425 [[maybe_unused]] const BOOL memory_priority_success =
426 SetThreadInformation(thread_handle, ::ThreadMemoryPriority,
427 &memory_priority, sizeof(memory_priority));
428 DPLOG_IF(ERROR, !memory_priority_success)
429 << "Set thread memory priority failed.";
430 }
431
432 if (thread_type == ThreadType::kBackground) {
433 // In a background process, THREAD_MODE_BACKGROUND_BEGIN lowers the memory
434 // and I/O priorities but not the CPU priority (kernel bug?). Use
435 // THREAD_PRIORITY_LOWEST to also lower the CPU priority.
436 // https://crbug.com/901483
437 if (PlatformThread::GetCurrentThreadPriorityForTest() !=
438 ThreadPriorityForTest::kBackground) {
439 ::SetThreadPriority(thread_handle, THREAD_PRIORITY_LOWEST);
440 // We used to DCHECK that memory priority is MEMORY_PRIORITY_VERY_LOW
441 // here, but found that it is not always the case (e.g. in the installer).
442 // crbug.com/1340578#c2
443 }
444 }
445 }
446
SetCurrentThreadQualityOfService(ThreadType thread_type)447 void SetCurrentThreadQualityOfService(ThreadType thread_type) {
448 // QoS and power throttling were introduced in Win10 1709.
449 bool desire_ecoqos = false;
450 switch (thread_type) {
451 case ThreadType::kBackground:
452 case ThreadType::kUtility:
453 case ThreadType::kResourceEfficient:
454 desire_ecoqos = true;
455 break;
456 case ThreadType::kDefault:
457 case ThreadType::kDisplayCritical:
458 case ThreadType::kRealtimeAudio:
459 desire_ecoqos = false;
460 break;
461 }
462
463 THREAD_POWER_THROTTLING_STATE thread_power_throttling_state{
464 .Version = THREAD_POWER_THROTTLING_CURRENT_VERSION,
465 .ControlMask =
466 desire_ecoqos ? THREAD_POWER_THROTTLING_EXECUTION_SPEED : 0ul,
467 .StateMask =
468 desire_ecoqos ? THREAD_POWER_THROTTLING_EXECUTION_SPEED : 0ul,
469 };
470 [[maybe_unused]] const BOOL success = ::SetThreadInformation(
471 ::GetCurrentThread(), ::ThreadPowerThrottling,
472 &thread_power_throttling_state, sizeof(thread_power_throttling_state));
473 // Failure is expected on versions of Windows prior to RS3.
474 DPLOG_IF(ERROR, !success && win::GetVersion() >= win::Version::WIN10_RS3)
475 << "Failed to set EcoQoS to " << std::boolalpha << desire_ecoqos;
476 }
477
478 } // namespace
479
480 namespace internal {
481
SetCurrentThreadTypeImpl(ThreadType thread_type,MessagePumpType pump_type_hint)482 void SetCurrentThreadTypeImpl(ThreadType thread_type,
483 MessagePumpType pump_type_hint) {
484 SetCurrentThreadPriority(thread_type, pump_type_hint);
485 SetCurrentThreadQualityOfService(thread_type);
486 }
487
488 } // namespace internal
489
490 // static
GetCurrentThreadPriorityForTest()491 ThreadPriorityForTest PlatformThread::GetCurrentThreadPriorityForTest() {
492 static_assert(
493 THREAD_PRIORITY_IDLE < 0,
494 "THREAD_PRIORITY_IDLE is >= 0 and will incorrectly cause errors.");
495 static_assert(
496 THREAD_PRIORITY_LOWEST < 0,
497 "THREAD_PRIORITY_LOWEST is >= 0 and will incorrectly cause errors.");
498 static_assert(THREAD_PRIORITY_BELOW_NORMAL < 0,
499 "THREAD_PRIORITY_BELOW_NORMAL is >= 0 and will incorrectly "
500 "cause errors.");
501 static_assert(
502 THREAD_PRIORITY_NORMAL == 0,
503 "The logic below assumes that THREAD_PRIORITY_NORMAL is zero. If it is "
504 "not, ThreadPriorityForTest::kBackground may be incorrectly detected.");
505 static_assert(THREAD_PRIORITY_ABOVE_NORMAL >= 0,
506 "THREAD_PRIORITY_ABOVE_NORMAL is < 0 and will incorrectly be "
507 "translated to ThreadPriorityForTest::kBackground.");
508 static_assert(THREAD_PRIORITY_HIGHEST >= 0,
509 "THREAD_PRIORITY_HIGHEST is < 0 and will incorrectly be "
510 "translated to ThreadPriorityForTest::kBackground.");
511 static_assert(THREAD_PRIORITY_TIME_CRITICAL >= 0,
512 "THREAD_PRIORITY_TIME_CRITICAL is < 0 and will incorrectly be "
513 "translated to ThreadPriorityForTest::kBackground.");
514 static_assert(THREAD_PRIORITY_ERROR_RETURN >= 0,
515 "THREAD_PRIORITY_ERROR_RETURN is < 0 and will incorrectly be "
516 "translated to ThreadPriorityForTest::kBackground.");
517
518 const int priority =
519 ::GetThreadPriority(PlatformThread::CurrentHandle().platform_handle());
520
521 // Negative values represent a background priority. We have observed -3, -4,
522 // -6 when THREAD_MODE_BACKGROUND_* is used. THREAD_PRIORITY_IDLE,
523 // THREAD_PRIORITY_LOWEST and THREAD_PRIORITY_BELOW_NORMAL are other possible
524 // negative values.
525 if (priority < THREAD_PRIORITY_BELOW_NORMAL)
526 return ThreadPriorityForTest::kBackground;
527
528 switch (priority) {
529 case THREAD_PRIORITY_BELOW_NORMAL:
530 return ThreadPriorityForTest::kUtility;
531 case THREAD_PRIORITY_NORMAL:
532 return ThreadPriorityForTest::kNormal;
533 case kWinDisplayPriority1:
534 [[fallthrough]];
535 case kWinDisplayPriority2:
536 return ThreadPriorityForTest::kDisplay;
537 case THREAD_PRIORITY_ABOVE_NORMAL:
538 case THREAD_PRIORITY_HIGHEST:
539 return ThreadPriorityForTest::kDisplay;
540 case THREAD_PRIORITY_TIME_CRITICAL:
541 return ThreadPriorityForTest::kRealtimeAudio;
542 case THREAD_PRIORITY_ERROR_RETURN:
543 DPCHECK(false) << "::GetThreadPriority error";
544 }
545
546 NOTREACHED() << "::GetThreadPriority returned " << priority << ".";
547 }
548
InitializePlatformThreadFeatures()549 void InitializePlatformThreadFeatures() {
550 g_above_normal_compositing_browser.store(
551 FeatureList::IsEnabled(kAboveNormalCompositingBrowserWin),
552 std::memory_order_relaxed);
553 }
554
555 // static
GetDefaultThreadStackSize()556 size_t PlatformThread::GetDefaultThreadStackSize() {
557 return 0;
558 }
559
560 } // namespace base
561