Chromium Code Reviews| Index: content/browser/aura/gpu_process_transport_factory.cc |
| diff --git a/content/browser/aura/gpu_process_transport_factory.cc b/content/browser/aura/gpu_process_transport_factory.cc |
| index b5a8e7a4f04209a2614a81907590c00306bdf5d1..59ebd9b0d40b905a533bc9bea34dc77298313ef0 100644 |
| --- a/content/browser/aura/gpu_process_transport_factory.cc |
| +++ b/content/browser/aura/gpu_process_transport_factory.cc |
| @@ -27,6 +27,7 @@ |
| #include "content/common/gpu/client/gpu_channel_host.h" |
| #include "content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h" |
| #include "content/common/gpu/gpu_process_launch_causes.h" |
| +#include "content/public/browser/render_process_host.h" |
| #include "gpu/GLES2/gl2extchromium.h" |
| #include "third_party/khronos/GLES2/gl2.h" |
| #include "ui/compositor/compositor.h" |
| @@ -147,6 +148,13 @@ GpuProcessTransportFactory::GpuProcessTransportFactory() |
| : callback_factory_(this) { |
| output_surface_proxy_ = new BrowserCompositorOutputSurfaceProxy( |
| &output_surface_map_); |
| + if (GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) { |
| + CauseForGpuLaunch cause = CAUSE_FOR_GPU_LAUNCH_BROWSER_STARTUP; |
| + BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
| + cause, |
| + base::Bind(&GpuProcessTransportFactory::OnGpuChannelReady, |
| + callback_factory_.GetWeakPtr())); |
| + } |
| } |
| GpuProcessTransportFactory::~GpuProcessTransportFactory() { |
| @@ -285,15 +293,11 @@ ui::ContextFactory* GpuProcessTransportFactory::AsContextFactory() { |
| } |
| gfx::GLSurfaceHandle GpuProcessTransportFactory::CreateSharedSurfaceHandle() { |
| - scoped_refptr<cc::ContextProvider> provider = |
| - SharedMainThreadContextProvider(); |
| - if (!provider.get()) |
| + if (!GpuDataManagerImpl::GetInstance()->CanUseGpuBrowserCompositor()) |
|
piman
2013/12/11 01:14:03
In the rest of the patch, we're essentially assumi
no sievers
2013/12/11 01:49:24
I think on windows with SwiftShader it's possible
|
| return gfx::GLSurfaceHandle(); |
| - typedef WebGraphicsContext3DCommandBufferImpl WGC3DCBI; |
| - WGC3DCBI* context = static_cast<WGC3DCBI*>(provider->Context3d()); |
| + |
| gfx::GLSurfaceHandle handle = gfx::GLSurfaceHandle( |
| gfx::kNullPluginWindow, gfx::TEXTURE_TRANSPORT); |
| - handle.parent_gpu_process_id = context->GetGPUProcessID(); |
| handle.parent_client_id = |
| BrowserGpuChannelHostFactory::instance()->GetGpuChannelId(); |
| return handle; |
| @@ -493,10 +497,27 @@ void GpuProcessTransportFactory::OnLostMainThreadSharedContext() { |
| observer_list_, |
| OnLostResources()); |
| + // This needs to happen after we notified the observers, because until then |
| + // we want to block renderers' CreateViewCommandBuffer requests. |
| + CauseForGpuLaunch cause = |
| + CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE; |
| + BrowserGpuChannelHostFactory::instance()->EstablishGpuChannel( |
| + cause, |
| + base::Bind(&GpuProcessTransportFactory::OnGpuChannelReady, |
| + callback_factory_.GetWeakPtr())); |
| + |
| // Kill things that use the shared context before killing the shared context. |
| lost_gl_helper.reset(); |
| lost_offscreen_compositor_contexts = NULL; |
| lost_shared_main_thread_contexts = NULL; |
| } |
| +void GpuProcessTransportFactory::OnGpuChannelReady() { |
|
piman
2013/12/11 01:14:03
nit: this could be static, so you wouldn't need we
|
| + for (RenderProcessHost::iterator i(RenderProcessHost::AllHostsIterator()); |
| + !i.IsAtEnd(); |
| + i.Advance()) { |
| + i.GetCurrentValue()->OnParentGpuChannelEstablished(); |
| + } |
| +} |
| + |
| } // namespace content |