|
|
Chromium Code Reviews|
Created:
5 years, 9 months ago by vignatti (out of this project) Modified:
5 years, 9 months ago CC:
chromium-reviews, kalyank, ozone-reviews_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionSimplify FakeGpuProcess* video accelerator tests
Make DispatchToGpuPlatformSupportTask and DispatchToGpuPlatformSupportHostTask
statics, removing the weak ptrs (and failing DCHECKS in that code) altogether.
BUG=447798
Committed: https://crrev.com/72b1eacd439fcb0bcf45ae7de2d8a9f578804ac6
Cr-Commit-Position: refs/heads/master@{#321212}
Patch Set 1 #
Total comments: 5
Patch Set 2 : DispatchToGpuPlatformSupportTask & DispatchToGpuPlatformSupportHostTask static #Messages
Total messages: 15 (3 generated)
tiago.vignatti@intel.com changed reviewers: + dnicoara@chromium.org, spang@chromium.org
tiago.vignatti@intel.com changed required reviewers: + spang@chromium.org
dnicoara and spang, PTAL.
https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... File ui/ozone/public/ozone_gpu_test_helper.cc (right): https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... ui/ozone/public/ozone_gpu_test_helper.cc:85: ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender); Grr, this is where the actual issue is. Can't use a weak_ptr on multiple threads. Off the top of my head I want to say that the DispatchToGpuPlatformSupport*() methods could just be static functions. Perhaps that's enough, though one thing that worries me is that OnChannelDestroyed() is never called when the FakeGpuProcess* objects go away. Perhaps that will be needed as well.
https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... File ui/ozone/public/ozone_gpu_test_helper.cc (right): https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... ui/ozone/public/ozone_gpu_test_helper.cc:85: ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender); On 2015/03/17 18:15:16, dnicoara wrote: > Grr, this is where the actual issue is. Can't use a weak_ptr on multiple > threads. oh, I thought this snip was correct? > Off the top of my head I want to say that the DispatchToGpuPlatformSupport*() > methods could just be static functions. > > Perhaps that's enough, though one thing that worries me is that > OnChannelDestroyed() is never called when the FakeGpuProcess* objects go away. > Perhaps that will be needed as well. hmm I think we can call OnChannelDestroyed at ~FakeGpuProcess but I don't think for the video tests there are observers or handlers installed at the moment. So there wouldn't be any effect on doing this.
https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... File ui/ozone/public/ozone_gpu_test_helper.cc (right): https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... ui/ozone/public/ozone_gpu_test_helper.cc:85: ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender); On 2015/03/17 18:59:05, vignatti wrote: > On 2015/03/17 18:15:16, dnicoara wrote: > > Grr, this is where the actual issue is. Can't use a weak_ptr on multiple > > threads. > > oh, I thought this snip was correct? No, this is actually where this is very very wrong. The |sender| is going to be called on the |gpu_task_runner_|. Since it is created on the main thread, the weak_ptr is only guaranteed to work correctly on the main thread. > > > > Off the top of my head I want to say that the DispatchToGpuPlatformSupport*() > > methods could just be static functions. > > > > Perhaps that's enough, though one thing that worries me is that > > OnChannelDestroyed() is never called when the FakeGpuProcess* objects go away. > > Perhaps that will be needed as well. > > hmm I think we can call OnChannelDestroyed at ~FakeGpuProcess but I don't think > for the video tests there are observers or handlers installed at the moment. So > there wouldn't be any effect on doing this. I don't think it would matter for the video tests either. Just wanted to point it out in case there are other issues.
https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... File ui/ozone/public/ozone_gpu_test_helper.cc (right): https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... ui/ozone/public/ozone_gpu_test_helper.cc:85: ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender); On 2015/03/17 21:28:56, dnicoara wrote: > On 2015/03/17 18:59:05, vignatti wrote: > > On 2015/03/17 18:15:16, dnicoara wrote: > > > Grr, this is where the actual issue is. Can't use a weak_ptr on multiple > > > threads. > > > > oh, I thought this snip was correct? > > No, this is actually where this is very very wrong. The |sender| is going to be > called on the |gpu_task_runner_|. Since it is created on the main thread, the > weak_ptr is only guaranteed to work correctly on the main thread. I actually think that the way you used weak_ptr here is fine for the purpose wanted: https://code.google.com/p/chromium/codesearch#chromium/src/base/memory/weak_p... i.e., we bound weak_ptr to be used solely through |gpu_task_runner_|, so there's no problem with that. We don't use that in the main thread. Or am I missing something?
https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... File ui/ozone/public/ozone_gpu_test_helper.cc (right): https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... ui/ozone/public/ozone_gpu_test_helper.cc:85: ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender); On 2015/03/18 15:38:29, vignatti wrote: > On 2015/03/17 21:28:56, dnicoara wrote: > > On 2015/03/17 18:59:05, vignatti wrote: > > > On 2015/03/17 18:15:16, dnicoara wrote: > > > > Grr, this is where the actual issue is. Can't use a weak_ptr on multiple > > > > threads. > > > > > > oh, I thought this snip was correct? > > > > No, this is actually where this is very very wrong. The |sender| is going to > be > > called on the |gpu_task_runner_|. Since it is created on the main thread, the > > weak_ptr is only guaranteed to work correctly on the main thread. > > I actually think that the way you used weak_ptr here is fine for the purpose > wanted: > > https://code.google.com/p/chromium/codesearch#chromium/src/base/memory/weak_p... > > i.e., we bound weak_ptr to be used solely through |gpu_task_runner_|, so there's > no problem with that. We don't use that in the main thread. Or am I missing > something? You're right, I'm getting confused by the code :( Though we still can't do this by posting a task to invalidate the weak ptrs and wait since |gpu_task_runner == ui_task_runner| should be supported. I'm tempted to say we might need another object to act as the sender and take the weak_ptr to that. Then in the dtor we could post a task with DeletePointer(...). spang@ what do you think?
On 2015/03/18 17:19:28, dnicoara wrote: > https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... > File ui/ozone/public/ozone_gpu_test_helper.cc (right): > > https://codereview.chromium.org/1017673003/diff/1/ui/ozone/public/ozone_gpu_t... > ui/ozone/public/ozone_gpu_test_helper.cc:85: > ->OnChannelEstablished(kGpuProcessHostId, gpu_task_runner_, sender); > On 2015/03/18 15:38:29, vignatti wrote: > > On 2015/03/17 21:28:56, dnicoara wrote: > > > On 2015/03/17 18:59:05, vignatti wrote: > > > > On 2015/03/17 18:15:16, dnicoara wrote: > > > > > Grr, this is where the actual issue is. Can't use a weak_ptr on multiple > > > > > threads. > > > > > > > > oh, I thought this snip was correct? > > > > > > No, this is actually where this is very very wrong. The |sender| is going to > > be > > > called on the |gpu_task_runner_|. Since it is created on the main thread, > the > > > weak_ptr is only guaranteed to work correctly on the main thread. > > > > I actually think that the way you used weak_ptr here is fine for the purpose > > wanted: > > > > > https://code.google.com/p/chromium/codesearch#chromium/src/base/memory/weak_p... > > > > i.e., we bound weak_ptr to be used solely through |gpu_task_runner_|, so > there's > > no problem with that. We don't use that in the main thread. Or am I missing > > something? > > You're right, I'm getting confused by the code :( > > Though we still can't do this by posting a task to invalidate the weak ptrs and > wait since |gpu_task_runner == ui_task_runner| should be supported. > > I'm tempted to say we might need another object to act as the sender and take > the weak_ptr to that. Then in the dtor we could post a task with > DeletePointer(...). spang@ what do you think? This usage is definitely haywire. We should make DispatchToGpuPlatformSupportTask & DispatchToGpuPlatformSupportHostTask static and remove the weak ptrs altogether.
On 2015/03/18 17:48:53, spang wrote: > This usage is definitely haywire. We should make > DispatchToGpuPlatformSupportTask & DispatchToGpuPlatformSupportHostTask static > and remove the weak ptrs altogether. I think this idea made everything much simpler after all. PTAL in #2. Thanks.
lgtm
The CQ bit was checked by tiago.vignatti@intel.com
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1017673003/20001
Message was sent while issue was closed.
Committed patchset #2 (id:20001)
Message was sent while issue was closed.
Patchset 2 (id:??) landed as https://crrev.com/72b1eacd439fcb0bcf45ae7de2d8a9f578804ac6 Cr-Commit-Position: refs/heads/master@{#321212} |
