service worker: Move ServiceWorkerGlobalScopeProxy off Oilpan
The motivation is to avoid creating GarbageCollected objects in WebEmbeddedWorkerImpl so that we can start service worker on the IO thread, not on the main thread. The IO thread runs without Oilpan and thus we can't create GarbageCollected objects on the IO thread. ServiceWorkerGlobalScopeProxy was a GarbageCollected object because it contained ParentExecutionContextTaskRunners which is also a GarbageCollected object. The only usage of the task runners was to get the default task runner so we can replace it with Thread::Current()->GetTaskRunner(), which returns a non GarbageCollected task runner. After this CL, ServiceWorkerThread owns ServiceWorkerGlobalScopeProxy as a unique_ptr, not a Persistent. The ownership of these classes are as follows and there seems no cycle ownership, so that's fine IIUC. WebEmbeddedWorkerImpl --(unique_ptr)--> ServiceWorkerThread ServiceWorkerThread --(was Persistent, now unique_ptr)--> ServiceWorkerGlobalScopeProxy ServiceWorkerThread --(CrossThreadPersistent)--> ServiceWorkerGlobalScope ServiceWorkerGlobalScopeProxy --(CrossThreadPersistent)--> ServiceWorkerGlobalScope ServiceWorkerGlobalScope --(raw reference)--> ServiceWorkerGlobalScopeProxy ServiceWorkerGlobalScope --(raw ptr)--> ServiceWorkerThread Bug: 988335 Change-Id: I5c9104e73300ac14b56f7ad9b337d71c53321d02 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1725530Reviewed-by:Hiroki Nakagawa <nhiroki@chromium.org> Commit-Queue: Kenichi Ishibashi <bashi@chromium.org> Cr-Commit-Position: refs/heads/master@{#683105}
Showing
Please register or sign in to comment