From 8d557b505e0074aa8447f5123ccae8bfed43c6d0 Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Tue, 24 Jan 2017 08:11:25 -0800 Subject: [PATCH] call wr_profiler_set_enabled() on compositor thread r=nical --- gfx/layers/wr/WebRenderBridgeParent.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gfx/layers/wr/WebRenderBridgeParent.cpp b/gfx/layers/wr/WebRenderBridgeParent.cpp index 95d5e45de263..d410d3cdbb27 100644 --- a/gfx/layers/wr/WebRenderBridgeParent.cpp +++ b/gfx/layers/wr/WebRenderBridgeParent.cpp @@ -801,7 +801,17 @@ WebRenderBridgeParent::SetWebRenderProfilerEnabled(bool aEnabled) if (MOZ_USE_RENDER_THREAD) { mApi->SetProfilerEnabled(aEnabled); } else { - wr_profiler_set_enabled(mWRWindowState, aEnabled); + if (CompositorThreadHolder::IsInCompositorThread()) { + wr_profiler_set_enabled(mWRWindowState, aEnabled); + } else { + bool enabled = aEnabled; + WrWindowState* state = mWRWindowState; + RefPtr runnable = + NS_NewRunnableFunction([state, enabled]() { + wr_profiler_set_enabled(state, enabled); + }); + CompositorThreadHolder::Loop()->PostTask(runnable.forget()); + } } } }