New issue
Advanced search Search tips

Issue 892527 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Oct 18
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux , Android , Windows , Chrome , Mac
Pri: 2
Type: Bug , Feature



Sign in to add a comment

Terminate AnimationWorklet's backing thread when no one uses it

Project Member Reported by nhiroki@chromium.org, Oct 5

Issue description

WorkerBackingThread for AnimationWorklet is shared by multiple AnimationWorkletGlobalScopes in the same renderer process. The backing thread is created when the first global scope is created, and kept as a singleton object by AnimationWorkletThread until the renderer process gets destroyed.

This model worked well before because AnimationWorklet used the compositor thread as the backing thread. However, after worker thread migration ( issue 731727 ), AnimationWorklet started running on a general worker thread and its backing thread is terminatable before the renderer process gets destroyed. To cut memory consumption, we should no sooner terminate the thread than all global scopes on the thread are closed.

Probably we can do the same thing with AudioWorklet. AudioWorklet manages its backing thread by reference counting:
https://cs.chromium.org/chromium/src/third_party/blink/renderer/modules/webaudio/audio_worklet_thread.cc?sq=package:chromium&dr=CSs&g=0&l=26

(This issue was found in  issue 892006 )
 
Labels: Type-Feature
Cc: majidvp@chromium.org yigu@chromium.org
Labels: Hotlist-Experimental Hotlist-AnimationWorklet
Owner: smcgruer@chromium.org
Status: Assigned (was: Available)
I will be taking care of this this sprint whilst doing the PaintWorkletGlobalScope unification work.
Project Member

Comment 4 by bugdroid1@chromium.org, Oct 18

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

commit c5c01f7ed3136f9d143f43dc46dc2131abc23fe7
Author: Stephen McGruer <smcgruer@chromium.org>
Date: Thu Oct 18 18:48:39 2018

[AnimationWorklet] Properly setup and teardown the backing thread

This CL adds refcounting around the backing thread for AnimationWorklet,
such that the backing thread is actually torn down when all
AnimationWorkletThread objects are destroyed.

Bug:  892527 
Change-Id: I750b63c74146a4a4dc7b3b1ebda0e66b269b13dc
Reviewed-on: https://chromium-review.googlesource.com/c/1286772
Reviewed-by: Ian Kilpatrick <ikilpatrick@chromium.org>
Reviewed-by: Majid Valipour <majidvp@chromium.org>
Reviewed-by: Yi Gu <yigu@chromium.org>
Commit-Queue: Stephen McGruer <smcgruer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600842}
[modify] https://crrev.com/c5c01f7ed3136f9d143f43dc46dc2131abc23fe7/third_party/blink/renderer/modules/animationworklet/animation_worklet.cc
[modify] https://crrev.com/c5c01f7ed3136f9d143f43dc46dc2131abc23fe7/third_party/blink/renderer/modules/animationworklet/animation_worklet_global_scope_test.cc
[modify] https://crrev.com/c5c01f7ed3136f9d143f43dc46dc2131abc23fe7/third_party/blink/renderer/modules/animationworklet/animation_worklet_thread.cc
[modify] https://crrev.com/c5c01f7ed3136f9d143f43dc46dc2131abc23fe7/third_party/blink/renderer/modules/animationworklet/animation_worklet_thread.h
[modify] https://crrev.com/c5c01f7ed3136f9d143f43dc46dc2131abc23fe7/third_party/blink/renderer/modules/animationworklet/animation_worklet_thread_test.cc

Status: Fixed (was: Assigned)

Sign in to add a comment