Restore thread safety to GpuChannelHost.
commit7951bfe3854423b11bee1d40bf83843b64f082ad
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Thu, 13 Jun 2013 01:43:34 +0000 (13 01:43 +0000)
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Thu, 13 Jun 2013 01:43:34 +0000 (13 01:43 +0000)
tree45ece678eb129d1b9dfc24f0bb205d73a6f8355f
parent4d90d439351de6a038b7e6e75f17e4ab31aa7056
Restore thread safety to GpuChannelHost.

RefCountedThreadSafe + SupportsWeakPtr is generally a bad combo.
This changes how thread safety is handled in GpuChannelHost:
- Shared data/state set by the IO thread is moved onto the MessageFilter,
  protected by a lock.
- MessageFilter doesn't need to post tasks to the GpuChannelHost on the main
  thread.
- Most of the GpuChannelHost fields are constant, the remaining ones are atomic
  or protected by a lock.

It also includes various cleanup:
- Reduced the scope of some locks. In particular we mostly avoid taking locks
  while sending messages.
- Removed GpuChannelHostFactory::IsIOThread which isn't used.
- Simplifies channel state. We always are "connected" until we are "lost".

A behavior change is that the "lost" state is set directly on the IO thread, as
soon as we receive the channel error. This makes recreation logic less dependent
on precise task order.

BUG=242826
R=apatrick@chromium.org

Review URL: https://codereview.chromium.org/16228004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@205992 0039d316-1c4b-4281-b951-d872f2087c98
content/browser/gpu/browser_gpu_channel_host_factory.cc
content/browser/gpu/browser_gpu_channel_host_factory.h
content/common/gpu/client/gpu_channel_host.cc
content/common/gpu/client/gpu_channel_host.h
content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
content/renderer/media/pepper_platform_video_decoder_impl.cc
content/renderer/pepper/pepper_platform_context_3d_impl.cc
content/renderer/render_thread_impl.cc
content/renderer/render_thread_impl.h