Support posting cross-thread tasks to per-frame scheduler |
|||
Issue descriptionAt the moment RenderFrame::GetTaskRunner (and RenderFrame::FromRoutingID) are not thread safe, so we don't have a way to post a task to a per-frame scheduler when we have frame id. The proposed solution is to introduce GetMainThreadScheduler() function to RenderThread and GetFrameScheduler(frame_id) to RendererScheduler, both of which should be thread-safe. NB: Naive implementation of GetMainThreadScheduler with saving a raw pointer should be safe because the RendererScheduler is normally the last thing to die (and we never properly shut down blink anyway).
,
Jan 11 2018
As RenderThreadImpl::current() can return the instance only from the main thread, how can we implement RenderThreadImpl::GetMainThreadScheduler() ?
,
Jan 11 2018
Re #2: I suggest we do the same as current implementation of GetMainTaskRunner[1] and have base::LazyInstance<RendererScheduler*>::Leaky g_main_thread_scheduler; [1] https://cs.chromium.org/chromium/src/content/renderer/render_thread_impl.cc?type=cs&l=266
,
Jan 11 2018
,
Jan 12 2018
https://chromium-review.googlesource.com/c/chromium/src/+/858880 I just deprecated the current GetMainTaskRunner(). As for the NotifySubresourceStarted, there is a plan not to notify frames, but I'm not sure when the plan is finished. If this is not so urgent, how about just waiting and seeing?
,
Jan 15 2018
Re #5: I think that at some point we'll need this functionality, but it's a good idea to keep this in mind and wait till the need arises.
,
Jan 17 2018
Note that there is a workaround in ParentFrameTaskRunners [1] for getting task runner for a specific type from worker thread. [1] https://cs.chromium.org/chromium/src/third_party/WebKit/Source/core/workers/ParentFrameTaskRunners.h?type=cs&l=26
,
Aug 15
|
|||
►
Sign in to add a comment |
|||
Comment 1 by hajimehoshi@chromium.org
, Jan 11 2018