|
|
Chromium Code Reviews|
Created:
4 years, 4 months ago by sadrul Modified:
4 years, 4 months ago CC:
chromium-reviews, rjkroege, tfarina, jam, darin-cc_chromium.org, mlamouri+watch-content_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
Descriptionservices/ui: Allow injecting the IO thread task runner for gpu channel.
Instead of always creating a new thread, allow injecting the IO thread
task runner into the ui::GpuService for the gpu::GpuChannelHost it
creates. This allows chrome browser and renderer processes to inject
their existing IO thread's task runner. A new thread is created only for
other mus apps that do not have their own IO thread.
BUG=638647
Committed: https://crrev.com/75f7dde87bfea8b3eab80814e320c2c528d77224
Cr-Commit-Position: refs/heads/master@{#413583}
Patch Set 1 #
Total comments: 3
Patch Set 2 : . #
Total comments: 4
Patch Set 3 : . #Patch Set 4 : . #
Messages
Total messages: 41 (23 generated)
The CQ bit was checked by sadrul@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...
sadrul@chromium.org changed reviewers: + fsamuel@chromium.org
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... File services/ui/public/cpp/gpu_service.h (right): https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... services/ui/public/cpp/gpu_service.h:44: scoped_refptr<base::SingleThreadTaskRunner> task_runner); Can this not be passed in Initialize to avoid giving the impression that the IOThreadTaskRunner can change at any time? Also optional nit: GpuService::Initialize sounds weird because it actually creates the object rather than initialize an already constructed object. It would be nice to call this GpuService::Create, but optional I guess
The CQ bit was checked by sadrul@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...
sadrul@chromium.org changed reviewers: + sky@chromium.org
+sky@ for owner https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... File services/ui/public/cpp/gpu_service.h (right): https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... services/ui/public/cpp/gpu_service.h:44: scoped_refptr<base::SingleThreadTaskRunner> task_runner); On 2016/08/18 11:00:56, Fady Samuel wrote: > Can this not be passed in Initialize to avoid giving the impression that the > IOThreadTaskRunner can change at any time? It's not straight forward, because for the chrome browser, the GpuService is created by the views::WindowManagerConnection object. So we would have to plumb the task-runner through that to GpuService. This is cleaner. SetIOThreadTaskRunner() already has a DCHECK() to make sure the task runner cannot be changed once set. I have added some messaging to the DCHECK() to clarify that as well. > > Also optional nit: GpuService::Initialize sounds weird because it actually > creates the object rather than initialize an already constructed object. > > It would be nice to call this GpuService::Create, but optional I guess I have disliked Initialize() myself. Renamed to Create().
https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... File services/ui/public/cpp/gpu_service.h (right): https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... services/ui/public/cpp/gpu_service.h:44: scoped_refptr<base::SingleThreadTaskRunner> task_runner); On 2016/08/18 12:56:53, sadrul wrote: > On 2016/08/18 11:00:56, Fady Samuel wrote: > > Can this not be passed in Initialize to avoid giving the impression that the > > IOThreadTaskRunner can change at any time? > > It's not straight forward, because for the chrome browser, the GpuService is > created by the views::WindowManagerConnection object. So we would have to plumb > the task-runner through that to GpuService. This is cleaner. > SetIOThreadTaskRunner() already has a DCHECK() to make sure the task runner > cannot be changed once set. I have added some messaging to the DCHECK() to > clarify that as well. > > > > > Also optional nit: GpuService::Initialize sounds weird because it actually > > creates the object rather than initialize an already constructed object. > > > > It would be nice to call this GpuService::Create, but optional I guess > > I have disliked Initialize() myself. Renamed to Create(). LGTM but I still feel like this is brittle because we could accidentally create an IOThread if someone calls GetIOThreadTaskRunner() too early before SetIOThreadTaskRunner is called
On 2016/08/18 13:05:39, Fady Samuel wrote: > https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... > File services/ui/public/cpp/gpu_service.h (right): > > https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_... > services/ui/public/cpp/gpu_service.h:44: > scoped_refptr<base::SingleThreadTaskRunner> task_runner); > On 2016/08/18 12:56:53, sadrul wrote: > > On 2016/08/18 11:00:56, Fady Samuel wrote: > > > Can this not be passed in Initialize to avoid giving the impression that the > > > IOThreadTaskRunner can change at any time? > > > > It's not straight forward, because for the chrome browser, the GpuService is > > created by the views::WindowManagerConnection object. So we would have to > plumb > > the task-runner through that to GpuService. This is cleaner. > > SetIOThreadTaskRunner() already has a DCHECK() to make sure the task runner > > cannot be changed once set. I have added some messaging to the DCHECK() to > > clarify that as well. > > > > > > > > Also optional nit: GpuService::Initialize sounds weird because it actually > > > creates the object rather than initialize an already constructed object. > > > > > > It would be nice to call this GpuService::Create, but optional I guess > > > > I have disliked Initialize() myself. Renamed to Create(). > > LGTM but I still feel like this is brittle because we could accidentally create > an IOThread if someone calls GetIOThreadTaskRunner() too early before > SetIOThreadTaskRunner is called Actually, correcting myself. In that case, if GpuService::SetIOThreadTaskRunner is called later, it will DCHECK so LGTM++. This seems reasonable.
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
LGTM
The CQ bit was checked by sadrul@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 commit-bot@chromium.org
Try jobs failed on following builders: chromium_presubmit on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/chromium_presub...)
sadrul@chromium.org changed reviewers: + ben@chromium.org
+ben@ for content/renderer change
sadrul@chromium.org changed reviewers: + piman@chromium.org
+piman@ for content/renderer changes since ben@ is ooo
https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... File services/ui/public/cpp/gpu_service.cc (right): https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... services/ui/public/cpp/gpu_service.cc:59: DCHECK(!io_task_runner_) Would it make sense instead to pass the task runner explicitly to Create, and creating the thread in the constructor if the task runner is null? In particular, I'm concerned that GetIOThreadTaskRunner can be called on any thread, making the logic there unsafe.
https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... File services/ui/public/cpp/gpu_service.cc (right): https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... services/ui/public/cpp/gpu_service.cc:59: DCHECK(!io_task_runner_) On 2016/08/22 19:42:03, piman wrote: > Would it make sense instead to pass the task runner explicitly to Create, and > creating the thread in the constructor if the task runner is null? > > In particular, I'm concerned that GetIOThreadTaskRunner can be called on any > thread, making the logic there unsafe. Ah, interesting. Yes, Fady brought up the issue earlier. It's not entirely straight forward because of how GpuService is created for the chrome browser process (see https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_...). Would it make more sense if I create this thread in EstablishGpuChannel[Sync] instead?
https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... File services/ui/public/cpp/gpu_service.cc (right): https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... services/ui/public/cpp/gpu_service.cc:59: DCHECK(!io_task_runner_) On 2016/08/22 20:05:54, sadrul wrote: > On 2016/08/22 19:42:03, piman wrote: > > Would it make sense instead to pass the task runner explicitly to Create, and > > creating the thread in the constructor if the task runner is null? > > > > In particular, I'm concerned that GetIOThreadTaskRunner can be called on any > > thread, making the logic there unsafe. > > Ah, interesting. Yes, Fady brought up the issue earlier. It's not entirely > straight forward because of how GpuService is created for the chrome browser > process (see > https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_...). > Would it make more sense if I create this thread in EstablishGpuChannel[Sync] > instead? I feel like plumbing the task runner through WindowManagerConnection is easy enough, and feels (to me) cleaner than the Law-of-Demeter-cringy logic in ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted - but I guess opinions can differ on that. I think deferring creating the thread to EstablishGpuChannel* would work, but then I would prefer making GetIOThreadTaskRunner private (and even making the GpuChannelHostFactory inheritance private, but that's iffy by the style guide) - making it clear that it's only called by the GpuChannelHost, which by construction would only be after the thread is created. But in general, I prefer "obviously correct" code rather than defending with documentation.
The CQ bit was checked by sadrul@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 checked by sadrul@chromium.org to run a CQ dry run
https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... File services/ui/public/cpp/gpu_service.cc (right): https://codereview.chromium.org/2249413004/diff/20001/services/ui/public/cpp/... services/ui/public/cpp/gpu_service.cc:59: DCHECK(!io_task_runner_) On 2016/08/22 20:31:50, piman wrote: > On 2016/08/22 20:05:54, sadrul wrote: > > On 2016/08/22 19:42:03, piman wrote: > > > Would it make sense instead to pass the task runner explicitly to Create, > and > > > creating the thread in the constructor if the task runner is null? > > > > > > In particular, I'm concerned that GetIOThreadTaskRunner can be called on any > > > thread, making the logic there unsafe. > > > > Ah, interesting. Yes, Fady brought up the issue earlier. It's not entirely > > straight forward because of how GpuService is created for the chrome browser > > process (see > > > https://codereview.chromium.org/2249413004/diff/1/services/ui/public/cpp/gpu_...). > > Would it make more sense if I create this thread in EstablishGpuChannel[Sync] > > instead? > > I feel like plumbing the task runner through WindowManagerConnection is easy > enough, and feels (to me) cleaner than the Law-of-Demeter-cringy logic in > ChromeBrowserMainExtraPartsViews::MojoShellConnectionStarted - but I guess > opinions can differ on that. > > > I think deferring creating the thread to EstablishGpuChannel* would work, but > then I would prefer making GetIOThreadTaskRunner private (and even making the > GpuChannelHostFactory inheritance private, but that's iffy by the style guide) - > making it clear that it's only called by the GpuChannelHost, which by > construction would only be after the thread is created. > > But in general, I prefer "obviously correct" code rather than defending with > documentation. Agreed. And contrary to popular meme, obviously correct is the best kind of correct. Done.
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
LGTM, thanks!
The CQ bit was unchecked by commit-bot@chromium.org
Dry run: This issue passed the CQ dry run.
The CQ bit was checked by sadrul@chromium.org
The patchset sent to the CQ was uploaded after l-g-t-m from fsamuel@chromium.org, sky@chromium.org Link to the patchset: https://codereview.chromium.org/2249413004/#ps60001 (title: ".")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.or...
Message was sent while issue was closed.
Committed patchset #4 (id:60001)
Message was sent while issue was closed.
Description was changed from ========== services/ui: Allow injecting the IO thread task runner for gpu channel. Instead of always creating a new thread, allow injecting the IO thread task runner into the ui::GpuService for the gpu::GpuChannelHost it creates. This allows chrome browser and renderer processes to inject their existing IO thread's task runner. A new thread is created only for other mus apps that do not have their own IO thread. BUG=638647 ========== to ========== services/ui: Allow injecting the IO thread task runner for gpu channel. Instead of always creating a new thread, allow injecting the IO thread task runner into the ui::GpuService for the gpu::GpuChannelHost it creates. This allows chrome browser and renderer processes to inject their existing IO thread's task runner. A new thread is created only for other mus apps that do not have their own IO thread. BUG=638647 Committed: https://crrev.com/75f7dde87bfea8b3eab80814e320c2c528d77224 Cr-Commit-Position: refs/heads/master@{#413583} ==========
Message was sent while issue was closed.
Patchset 4 (id:??) landed as https://crrev.com/75f7dde87bfea8b3eab80814e320c2c528d77224 Cr-Commit-Position: refs/heads/master@{#413583} |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
