| 
    
      
  | 
  
 Chromium Code Reviews
        
  DescriptionUse MainThread on EmptyFrameScheduler
The dummy Frame on Workers has EmptyFrameScheduler, and it returns a
WebTaskRunner for the current thread. However, since all Frame should
belong to the main thread, the resulting WebTaskRunner should run on
the main thread even when the task runner is requested on a non-main
thread.
This CL ensures EmptyFrameScheduler to use the main thread task runner.
Committed: https://crrev.com/8e40d35a47b2bbdf70d9a4d13c3978678a5d9628
Cr-Commit-Position: refs/heads/master@{#436265}
   
  Patch Set 1 #Patch Set 2 : +DCHECK #Patch Set 3 : fix #Messages
    Total messages: 33 (20 generated)
     
  
  
 The CQ bit was checked by tzik@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 Description was changed from ========== Use MainThread on EmptyFrameScheduler BUG= ========== to ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. As the result, TaskRunnerHelper::get() on the dummy Document returns non-main thread, OTOH, its ExecutionContext::postTask posts the task to the main thread, which is inconsistent. This CL forces EmptyFrameScheduler to return the main thread task runner as a workaround. ========== 
 tzik@chromium.org changed reviewers: + nhiroki@chromium.org, yhirano@chromium.org 
 PTAL 
 > OTOH, its ExecutionContext::postTask posts the task to the main thread What is "its ExecutionContext::postTask"? 
 On 2016/12/05 06:26:45, yhirano wrote: > > OTOH, its ExecutionContext::postTask posts the task to the main thread > > What is "its ExecutionContext::postTask"? I meant Document::postTask() that overrides ExecutionContext::postTask(). 
 Can you provide a concrete example/callpath when a task is accidentally posted to a worker's thread? 
 Are you saying that EmptyFrameScheduler is always attached to an object belonging to the main thread? If so, Can you add DCHECK(isMainThread()) in the EmptyFrameScheduler constructor? 
 On 2016/12/05 06:37:34, nhiroki wrote: > Can you provide a concrete example/callpath when a task is accidentally posted > to a worker's thread? Here is not-yet-landed failing case: https://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium... The call path is: WorkerThreadableLoader::start() WorkerLoaderProxy::postTaskToLoader() WebEmbeddedWorkerImpl::postTaskToLoader() Where postTaskToLoader() calls Document::postTask(). 
 The CQ bit was checked by tzik@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 On 2016/12/05 07:03:23, yhirano wrote: > Are you saying that EmptyFrameScheduler is always attached to an object > belonging to the main thread? If so, Can you add DCHECK(isMainThread()) in the > EmptyFrameScheduler constructor? Yes. IIUC, all of Page, Frame and Document are always on the main thread. > Can you add DCHECK(isMainThread()) in the > EmptyFrameScheduler constructor? Done 
 The CQ bit was checked by tzik@chromium.org to run a CQ dry run 
 Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 lgtm 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Dry run: This issue passed the CQ dry run. 
 code LGTM, but Modifying the issue description would be helpful. 
 Description was changed from ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. As the result, TaskRunnerHelper::get() on the dummy Document returns non-main thread, OTOH, its ExecutionContext::postTask posts the task to the main thread, which is inconsistent. This CL forces EmptyFrameScheduler to return the main thread task runner as a workaround. ========== to ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. subject: Use MainThread on EmptyFrameScheduler ========== 
 The CQ bit was checked by tzik@chromium.org 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 The CQ bit was unchecked by tzik@chromium.org 
 Description was changed from ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. subject: Use MainThread on EmptyFrameScheduler ========== to ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. ========== 
 The CQ bit was checked by tzik@chromium.org 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or... 
 CQ is committing da patch.
Bot data: {"patchset_id": 40001, "attempt_start_ts": 1480939581573250,
"parent_rev": "4497961c272ebf60cc5cffb1dbbb1bf167c697d8", "commit_rev":
"7b1d9cdfcf1a2b9471f1cdbd116a2970fb962757"}
          
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. ========== to ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Committed patchset #3 (id:40001) 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Description was changed from ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. ========== to ========== Use MainThread on EmptyFrameScheduler The dummy Frame on Workers has EmptyFrameScheduler, and it returns a WebTaskRunner for the current thread. However, since all Frame should belong to the main thread, the resulting WebTaskRunner should run on the main thread even when the task runner is requested on a non-main thread. This CL ensures EmptyFrameScheduler to use the main thread task runner. Committed: https://crrev.com/8e40d35a47b2bbdf70d9a4d13c3978678a5d9628 Cr-Commit-Position: refs/heads/master@{#436265} ========== 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Patchset 3 (id:??) landed as https://crrev.com/8e40d35a47b2bbdf70d9a4d13c3978678a5d9628 Cr-Commit-Position: refs/heads/master@{#436265}  | 
    
