New issue
Advanced search Search tips

Issue 879181 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Sep 24
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Need a way to assert that CPU heavy tasks are allowed

Project Member Reported by etiennep@chromium.org, Aug 30

Issue description

Context CL: https://chromium-review.googlesource.com/c/chromium/src/+/1191185

Use case: An expensive function wants to make sure it's not running on the UI thread so the expensive operations don't block that thread  (or any important thread that should not be stalled).
AssertBlockingAllowed() is not meant for this use case: it assumes that the expensive operation is off-CPU.

I suggest we implement a new assertion, something like AssertExpensiveWorkAllowed(), which fails on special threads (UI, IO).
 
Status: Assigned (was: Untriaged)
SGTM, let's just make sure the name isn't confusing (i.e. one may wonder whether a MayBlock() task is "expensive").

AssertLongIntensiveWorkAllowed()?
Project Member

Comment 2 by bugdroid1@chromium.org, Sep 21

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1

commit 5b5cddb4d27e27e49efc5ad29dfcb725d93742e1
Author: Etienne Pierre-Doray <etiennep@chromium.org>
Date: Fri Sep 21 15:28:07 2018

[TaskScheduler]: Implement AssertLongCPUWorkAllowed.

Use case: An expensive function wants to make sure it's not running on the UI
thread so the expensive operations don't block that thread.
This assertion fails on threads other than scheduler workers.

Bug:  879181 
Cq-Include-Trybots: luci.chromium.try:ios-simulator-cronet;luci.chromium.try:ios-simulator-full-configs
Change-Id: I2a7ec2442c2020da4d68605c2476a01d25a45a33
Reviewed-on: https://chromium-review.googlesource.com/1221787
Reviewed-by: François Doray <fdoray@chromium.org>
Reviewed-by: Camille Lamy <clamy@chromium.org>
Reviewed-by: Eugene But <eugenebut@chromium.org>
Reviewed-by: Gabriel Charette <gab@chromium.org>
Commit-Queue: Etienne Pierre-Doray <etiennep@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593191}
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/base/threading/thread_restrictions.cc
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/base/threading/thread_restrictions.h
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/base/threading/thread_restrictions_unittest.cc
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/content/browser/browser_main_loop.cc
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/content/browser/browser_process_sub_thread.cc
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/ios/web/app/web_main_loop.mm
[modify] https://crrev.com/5b5cddb4d27e27e49efc5ad29dfcb725d93742e1/ios/web/web_thread_impl.cc

Status: Fixed (was: Assigned)

Sign in to add a comment