New issue
Advanced search Search tips

Issue 801115 link

Starred by 1 user

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Feature



Sign in to add a comment

Support posting cross-thread tasks to per-frame scheduler

Project Member Reported by altimin@chromium.org, Jan 11 2018

Issue description

At 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).
 
Cc: tzik@chromium.org
As RenderThreadImpl::current() can return the instance only from the main thread, how can we implement RenderThreadImpl::GetMainThreadScheduler() ?
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
Components: Blink>Scheduling
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?
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.
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
Labels: -Type-Bug Type-Feature

Sign in to add a comment