Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(130)

Issue 1322853005: cc: Implement shared worker contexts. (Closed)

Created:
5 years, 3 months ago by reveman
Modified:
5 years, 3 months ago
CC:
cc-bugs_chromium.org, chromium-reviews, danakj+watch_chromium.org, darin-cc_chromium.org, jam, jbauman+watch_chromium.org, kalyank, mkwst+moarreviews-renderer_chromium.org, mlamouri+watch-content_chromium.org, piman+watch_chromium.org, sievers+watch_chromium.org, Ian Vollick
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

cc: Implement shared worker contexts. This moves the responsibility to call BindToCurrentThread/SetupLock out of cc::OutputSurface and to the maintainer of the (possibly) shared context. Worker contexts can now be explicitly destroyed on the thread they are bound to. Destroying a context is similar to losing it. It is not required by a user of the context to check if it has been lost/destroyed. BUG=523411 CQ_INCLUDE_TRYBOTS=tryserver.blink:linux_blink_rel

Patch Set 1 #

Patch Set 2 : #

Total comments: 5
Unified diffs Side-by-side diffs Delta from patch set Stats (+209 lines, -68 lines) Patch
M cc/output/context_provider.h View 3 chunks +9 lines, -5 lines 0 comments Download
M cc/output/output_surface.cc View 1 chunk +0 lines, -6 lines 0 comments Download
M cc/raster/tile_task_worker_pool_unittest.cc View 1 chunk +3 lines, -2 lines 0 comments Download
M cc/test/fake_output_surface.h View 3 chunks +10 lines, -8 lines 0 comments Download
M cc/test/test_context_provider.h View 1 chunk +3 lines, -0 lines 0 comments Download
M cc/test/test_context_provider.cc View 2 chunks +14 lines, -3 lines 0 comments Download
M cc/trees/layer_tree_host_impl.cc View 1 chunk +1 line, -1 line 0 comments Download
M cc/trees/layer_tree_host_impl_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download
M cc/trees/layer_tree_host_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M content/browser/android/in_process/synchronous_compositor_factory_impl.h View 2 chunks +3 lines, -0 lines 0 comments Download
M content/browser/android/in_process/synchronous_compositor_factory_impl.cc View 1 3 chunks +35 lines, -3 lines 0 comments Download
M content/browser/compositor/gpu_process_transport_factory.cc View 2 chunks +5 lines, -1 line 0 comments Download
M content/common/gpu/client/command_buffer_proxy_impl.h View 2 chunks +4 lines, -0 lines 0 comments Download
M content/common/gpu/client/command_buffer_proxy_impl.cc View 1 chunk +11 lines, -4 lines 4 comments Download
M content/common/gpu/client/context_provider_command_buffer.h View 1 2 chunks +9 lines, -0 lines 0 comments Download
M content/common/gpu/client/context_provider_command_buffer.cc View 1 4 chunks +23 lines, -10 lines 1 comment Download
M content/renderer/render_thread_impl.h View 2 chunks +4 lines, -0 lines 0 comments Download
M content/renderer/render_thread_impl.cc View 1 2 chunks +25 lines, -0 lines 0 comments Download
M content/renderer/render_widget.cc View 1 chunk +3 lines, -4 lines 0 comments Download
M ui/compositor/test/in_process_context_factory.h View 2 chunks +3 lines, -1 line 0 comments Download
M ui/compositor/test/in_process_context_factory.cc View 1 2 chunks +24 lines, -7 lines 0 comments Download
M ui/compositor/test/in_process_context_provider.h View 2 chunks +10 lines, -8 lines 0 comments Download
M ui/compositor/test/in_process_context_provider.cc View 1 1 chunk +7 lines, -3 lines 0 comments Download

Messages

Total messages: 16 (6 generated)
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1322853005/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1322853005/1
5 years, 3 months ago (2015-09-08 20:18:24 UTC) #2
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: mac_chromium_rel_ng on tryserver.chromium.mac (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.mac/builders/mac_chromium_rel_ng/builds/110133)
5 years, 3 months ago (2015-09-08 20:55:13 UTC) #4
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1322853005/20001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1322853005/20001
5 years, 3 months ago (2015-09-08 21:55:08 UTC) #6
commit-bot: I haz the power
Dry run: Try jobs failed on following builders: linux_blink_rel on tryserver.blink (JOB_FAILED, http://build.chromium.org/p/tryserver.blink/builders/linux_blink_rel/builds/76754)
5 years, 3 months ago (2015-09-08 22:49:28 UTC) #8
reveman
V2 of shared worker contexts. I think I now prefer this approach as it keeps ...
5 years, 3 months ago (2015-09-08 23:21:26 UTC) #10
Ken Russell (switch to Gerrit)
Apologies for not keeping up with the reviews to date. https://codereview.chromium.org/1322853005/diff/20001/content/common/gpu/client/command_buffer_proxy_impl.cc File content/common/gpu/client/command_buffer_proxy_impl.cc (right): https://codereview.chromium.org/1322853005/diff/20001/content/common/gpu/client/command_buffer_proxy_impl.cc#newcode55 ...
5 years, 3 months ago (2015-09-09 06:09:11 UTC) #12
reveman
https://codereview.chromium.org/1322853005/diff/20001/content/common/gpu/client/command_buffer_proxy_impl.cc File content/common/gpu/client/command_buffer_proxy_impl.cc (right): https://codereview.chromium.org/1322853005/diff/20001/content/common/gpu/client/command_buffer_proxy_impl.cc#newcode55 content/common/gpu/client/command_buffer_proxy_impl.cc:55: channel_->DestroyCommandBuffer(this); On 2015/09/09 at 06:09:11, Ken Russell wrote: > ...
5 years, 3 months ago (2015-09-09 13:45:24 UTC) #13
piman
I think there are still problems. I'm still not excited about the Destroy() primitive being ...
5 years, 3 months ago (2015-09-09 19:14:23 UTC) #14
reveman
On 2015/09/09 at 19:14:23, piman wrote: > I think there are still problems. > > ...
5 years, 3 months ago (2015-09-09 20:46:18 UTC) #15
piman
5 years, 3 months ago (2015-09-09 20:59:36 UTC) #16
Message was sent while issue was closed.
On Wed, Sep 9, 2015 at 1:46 PM, <reveman@chromium.org> wrote:

> On 2015/09/09 at 19:14:23, piman wrote:
>
>> I think there are still problems.
>>
>
> I'm still not excited about the Destroy() primitive being exposed at the
>>
> ContextProvider level. The correct use cases are extremely restricted if
> you
> want to avoid leaks and races - it either has to be the only context in its
> share group, or it needs to be already lost (along with other contexts in
> teh
> share group), or the caller has to be the last user - and this is not
> something
> we can easily DCHECK for.
>
> Ok, got it. Leaking resources in the share group is definitely a problem
> with
> the current patch. Thanks for explaining.
>
>
> I still don't understand why it's hard to ensure tasks are done before
>>
> resetting the context on the compositor thread. We actually already do that
> AFAICT, in LayerTreeHostImpl::InitializeRenderer and ~LayerTreeHostImpl:
> CleanUpTileManager will wait for all tasks before we reset output_surface_
> (which should drop its reference to the ContextProvider).
>
> Synchronizing tasks and usage is not a problem and already happening as you
> pointed out. The problem is when to create a new shared worker context.
> When you
> said synchronizing I thought you meant synchronizing all users (all
> compositors
> + media/ in the near future) of the worker context so we can destroy the
> old
> context and create a new one and that's what seem complicated to me.
> However, I
> don't think that's necessary.


Right, contexts can co-exist, and giving the new context to new systems can
be "pipelined", provided we have the guarantee that contexts are deleted on
their correct thread.
As you point out, what is needed though is to detect the lost state in the
place where we need to decide whether to recreate one or not (i.e. the main
thread). For the shared context, I think it's ok to grab the context lock
while querying.


> I think we just need to do whatever it takes to
> make ContextProvider RefCounted instead of RefCountedThreadSafe. I'll look
> at
> what's need for this.


Ok, just beware that we probably use the RefCountedThreadSafe property to
post tasks before we make the BindToCurrentThread
(before BindToCurrentThread is called, it's safe to destroy the
ContextProvider on any thread - for better or worse).


> Guessing all OutputSurfaces will need to be destroyed on
> the same thread they were created on, which probably means adding an
> OutputSurface::DetachFromClient function to destroy the non-worker context
> on
> the compositor thread.
>
> I'll let you know when I have something new to review.
>
> https://codereview.chromium.org/1322853005/
>

To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698