diff options
Diffstat (limited to 'chromium/third_party/blink/renderer/platform/scheduler/common/thread.cc')
-rw-r--r-- | chromium/third_party/blink/renderer/platform/scheduler/common/thread.cc | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/chromium/third_party/blink/renderer/platform/scheduler/common/thread.cc b/chromium/third_party/blink/renderer/platform/scheduler/common/thread.cc index 013326b9a51..61bd6f9da2e 100644 --- a/chromium/third_party/blink/renderer/platform/scheduler/common/thread.cc +++ b/chromium/third_party/blink/renderer/platform/scheduler/common/thread.cc @@ -7,6 +7,7 @@ #include "base/feature_list.h" #include "base/single_thread_task_runner.h" #include "base/synchronization/waitable_event.h" +#include "base/threading/platform_thread.h" #include "build/build_config.h" #include "third_party/blink/public/common/features.h" #include "third_party/blink/public/platform/platform.h" @@ -94,16 +95,22 @@ void Thread::CreateAndSetCompositorThread() { auto compositor_thread = std::make_unique<scheduler::CompositorThread>(params); compositor_thread->Init(); - GetCompositorThread() = std::move(compositor_thread); +#if defined(OS_LINUX) || defined(OS_CHROMEOS) if (base::FeatureList::IsEnabled( features::kBlinkCompositorUseDisplayThreadPriority)) { - // Chrome OS moves tasks between control groups on thread priority changes. - // This is not possible inside the sandbox, so ask the browser to do it. - // TODO(spang): Check if we can remove this on non-Chrome OS builds. - Platform::Current()->SetDisplayThreadPriority( - GetCompositorThread()->ThreadId()); + compositor_thread->GetTaskRunner()->PostTaskAndReplyWithResult( + FROM_HERE, base::BindOnce(&base::PlatformThread::CurrentId), + base::BindOnce([](base::PlatformThreadId compositor_thread_id) { + // Chrome OS moves tasks between control groups on thread priority + // changes. This is not possible inside the sandbox, so ask the + // browser to do it. + Platform::Current()->SetDisplayThreadPriority(compositor_thread_id); + })); } +#endif + + GetCompositorThread() = std::move(compositor_thread); } Thread* Thread::Current() { |