| 
    
      
  | 
  
 Chromium Code Reviews| 
         Created: 
          6 years, 3 months ago by weiliangc Modified: 
          
          
          6 years, 3 months ago CC: 
          
          
          chromium-reviews, Ian Vollick, sievers+watch_chromium.org, jbauman+watch_chromium.org, kalyank, piman+watch_chromium.org, danakj+watch_chromium.org, cc-bugs_chromium.org Base URL: 
          
          
          
          https://chromium.googlesource.com/chromium/src.git@compositorScheduler Project: 
          
          chromium Visibility: 
          
          
          
        Public.  | 
      
        
  DescriptionUse RunLoop to wait for readback on compositor unittest
In layer unittest ReadPixel loops multiple times to wait to a readback.
This causes flake on cros valgrind bot. Instead use RunLoop to wait for
readback.
The flake is exposed if ui::Compositor uses Scheduler (CL 535733002)
BUG=403528
Committed: https://crrev.com/cb9e0df0797ec7d2c894b95570b66553d3bfa661
Cr-Commit-Position: refs/heads/master@{#295972}
   
  Patch Set 1 #
      Total comments: 6
      
     
  
  Patch Set 2 : address review comments #
      Total comments: 2
      
     
  
  Patch Set 3 : Quit directly #Patch Set 4 : back to track trunk #Messages
    Total messages: 16 (4 generated)
     
  
  
 weiliangc@chromium.org changed reviewers: + danakj@chromium.org, enne@chromium.org 
 Fix for ui::Compositor using Scheduler cros valgrind bot flake. Out for comment, not for commit. Will merge with enne's patch before commit. 
 https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest.cc File ui/compositor/layer_unittest.cc (right): https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest... ui/compositor/layer_unittest.cc:136: return ReadPixels(bitmap, gfx::Rect(GetCompositor()->size())); remove return https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest... ui/compositor/layer_unittest.cc:190: DCHECK(run_loop_->running()); what if the result comes before the wait starts, this looks like a race and it's not important. https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest... ui/compositor/layer_unittest.cc:196: void WaitForReadback() { run_loop_->Run(); } can you verify that Run() will exit if you called the QuitClosure() before calling Run() otherwise the race is bad, and you need to check if the callback already happened and skip Run() 
 https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest.cc File ui/compositor/layer_unittest.cc (right): https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest... ui/compositor/layer_unittest.cc:136: return ReadPixels(bitmap, gfx::Rect(GetCompositor()->size())); On 2014/09/19 20:52:26, danakj wrote: > remove return Done. https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest... ui/compositor/layer_unittest.cc:190: DCHECK(run_loop_->running()); On 2014/09/19 20:52:26, danakj wrote: > what if the result comes before the wait starts, this looks like a race and it's > not important. Make sense. Removed. https://codereview.chromium.org/587863002/diff/1/ui/compositor/layer_unittest... ui/compositor/layer_unittest.cc:196: void WaitForReadback() { run_loop_->Run(); } On 2014/09/19 20:52:26, danakj wrote: > can you verify that Run() will exit if you called the QuitClosure() before > calling Run() otherwise the race is bad, and you need to check if the callback > already happened and skip Run() RunLoop's comment on its Quit and QuitClose function says: - calling Quit before Run will just cause Run to exit immediately - QuitClosure calls Quit safely, has no effect if RunLoop is gone How much trust can I put into these comments? 
 Why is this (NotForCommit)? https://codereview.chromium.org/587863002/diff/20001/ui/compositor/layer_unit... File ui/compositor/layer_unittest.cc (right): https://codereview.chromium.org/587863002/diff/20001/ui/compositor/layer_unit... ui/compositor/layer_unittest.cc:191: base::MessageLoop::current()->PostTask(FROM_HERE, you could just QuitClosure().Run() instead of posttasking it. but even better just run_loop_.Quit(); :) 
 On 2014/09/19 22:51:15, danakj wrote:
> Why is this (NotForCommit)?
> 
\BecauseWeSmart{}
(Just typed a long response then realized this CL is pretty independent...)
          
 https://codereview.chromium.org/587863002/diff/20001/ui/compositor/layer_unit... File ui/compositor/layer_unittest.cc (right): https://codereview.chromium.org/587863002/diff/20001/ui/compositor/layer_unit... ui/compositor/layer_unittest.cc:191: base::MessageLoop::current()->PostTask(FROM_HERE, On 2014/09/19 22:51:15, danakj wrote: > you could just QuitClosure().Run() instead of posttasking it. > > but even better just run_loop_.Quit(); :) LGTM once you Quit() more directly here. 
 On 2014/09/19 23:36:17, danakj wrote: > https://codereview.chromium.org/587863002/diff/20001/ui/compositor/layer_unit... > File ui/compositor/layer_unittest.cc (right): > > https://codereview.chromium.org/587863002/diff/20001/ui/compositor/layer_unit... > ui/compositor/layer_unittest.cc:191: > base::MessageLoop::current()->PostTask(FROM_HERE, > On 2014/09/19 22:51:15, danakj wrote: > > you could just QuitClosure().Run() instead of posttasking it. > > > > but even better just run_loop_.Quit(); :) > > LGTM once you Quit() more directly here. Track trunk, will submit after some green trybots. 
 The CQ bit was checked by weiliangc@chromium.org 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/587863002/60001 
 The CQ bit was unchecked by commit-bot@chromium.org 
 Try jobs failed on following builders: android_chromium_gn_compile_dbg on tryserver.chromium.linux (http://build.chromium.org/p/tryserver.chromium.linux/builders/android_chromiu...) 
 The CQ bit was checked by danakj@chromium.org 
 CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/587863002/60001 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Committed patchset #4 (id:60001) as 907a55f1b26028558f3a6e4542f5b7fe2bae545a 
 
            
              
                Message was sent while issue was closed.
              
            
             
          
        Patchset 4 (id:??) landed as https://crrev.com/cb9e0df0797ec7d2c894b95570b66553d3bfa661 Cr-Commit-Position: refs/heads/master@{#295972}  | 
    
