Chromium Code Reviews| Index: content/browser/compositor/gpu_process_transport_factory.cc |
| diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc |
| index 7d1cf0c2d283a6620d1de210bc8fc8348d66ee4d..53f3ac021f80fd3d7ef67845dc0f79619aa518a9 100644 |
| --- a/content/browser/compositor/gpu_process_transport_factory.cc |
| +++ b/content/browser/compositor/gpu_process_transport_factory.cc |
| @@ -157,6 +157,15 @@ bool IsCALayersDisabledFromCommandLine() { |
| } |
| #endif |
| +void UpdateVSyncParameters(base::WeakPtr<ui::Compositor> compositor, |
| + base::TimeTicks timebase, |
| + base::TimeDelta interval) { |
| + if (!compositor) |
|
danakj
2016/11/30 23:49:05
How does the compositor be gone but the output sur
stanisc
2016/12/01 00:16:27
Honestly I don't know. Why was it WeakPtr<Composit
danakj
2016/12/01 00:26:34
EstablishedGpuChannel is called from the GpuChanne
stanisc
2016/12/02 19:50:43
OK, I've replaced this with a DCHECK. I think I st
|
| + return; |
| + |
| + compositor->SetDisplayVSyncParameters(timebase, interval); |
| +} |
| + |
| } // namespace |
| namespace content { |
| @@ -447,13 +456,15 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| compositor->task_runner().get()))); |
| } |
| + BrowserCompositorOutputSurface::UpdateVSyncParametersCallback vsync_callback = |
| + base::Bind(&UpdateVSyncParameters, compositor); |
| + |
| std::unique_ptr<BrowserCompositorOutputSurface> display_output_surface; |
| #if defined(ENABLE_VULKAN) |
| std::unique_ptr<VulkanBrowserCompositorOutputSurface> vulkan_surface; |
| if (vulkan_context_provider) { |
| vulkan_surface.reset(new VulkanBrowserCompositorOutputSurface( |
| - vulkan_context_provider, compositor->vsync_manager(), |
| - begin_frame_source.get())); |
| + vulkan_context_provider, vsync_callback)); |
| if (!vulkan_surface->Initialize(compositor.get()->widget())) { |
| vulkan_surface->Destroy(); |
| vulkan_surface.reset(); |
| @@ -467,8 +478,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| if (!create_gpu_output_surface) { |
| display_output_surface = |
| base::MakeUnique<SoftwareBrowserCompositorOutputSurface>( |
| - CreateSoftwareOutputDevice(compositor.get()), |
| - compositor->vsync_manager(), begin_frame_source.get(), |
| + CreateSoftwareOutputDevice(compositor.get()), vsync_callback, |
| compositor->task_runner()); |
| } else { |
| DCHECK(context_provider); |
| @@ -476,22 +486,20 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| if (data->surface_handle == gpu::kNullSurfaceHandle) { |
| display_output_surface = |
| base::MakeUnique<OffscreenBrowserCompositorOutputSurface>( |
| - context_provider, compositor->vsync_manager(), |
| - begin_frame_source.get(), |
| + context_provider, vsync_callback, |
| std::unique_ptr< |
| display_compositor::CompositorOverlayCandidateValidator>()); |
| } else if (capabilities.surfaceless) { |
| #if defined(OS_MACOSX) |
| display_output_surface = base::MakeUnique<GpuOutputSurfaceMac>( |
| compositor->widget(), context_provider, data->surface_handle, |
| - compositor->vsync_manager(), begin_frame_source.get(), |
| + vsync_callback, |
| CreateOverlayCandidateValidator(compositor->widget()), |
| GetGpuMemoryBufferManager()); |
| #else |
| display_output_surface = |
| base::MakeUnique<GpuSurfacelessBrowserCompositorOutputSurface>( |
| - context_provider, data->surface_handle, |
| - compositor->vsync_manager(), begin_frame_source.get(), |
| + context_provider, data->surface_handle, vsync_callback, |
| CreateOverlayCandidateValidator(compositor->widget()), |
| GL_TEXTURE_2D, GL_RGB, ui::DisplaySnapshot::PrimaryFormat(), |
| GetGpuMemoryBufferManager()); |
| @@ -508,8 +516,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| if (!use_mus) { |
| display_output_surface = |
| base::MakeUnique<GpuBrowserCompositorOutputSurface>( |
| - context_provider, compositor->vsync_manager(), |
| - begin_frame_source.get(), std::move(validator)); |
| + context_provider, vsync_callback, std::move(validator)); |
| } else { |
| #if defined(USE_AURA) |
| if (compositor->window()) { |
| @@ -518,8 +525,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| display_output_surface = |
| base::MakeUnique<MusBrowserCompositorOutputSurface>( |
| compositor->window(), context_provider, |
| - GetGpuMemoryBufferManager(), compositor->vsync_manager(), |
| - begin_frame_source.get(), std::move(validator)); |
| + GetGpuMemoryBufferManager(), vsync_callback, |
| + std::move(validator)); |
| } else { |
| aura::WindowTreeHost* host = |
| aura::WindowTreeHost::GetForAcceleratedWidget( |
| @@ -527,8 +534,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
| display_output_surface = |
| base::MakeUnique<MusBrowserCompositorOutputSurface>( |
| host->window(), context_provider, |
| - GetGpuMemoryBufferManager(), compositor->vsync_manager(), |
| - begin_frame_source.get(), std::move(validator)); |
| + GetGpuMemoryBufferManager(), vsync_callback, |
| + std::move(validator)); |
| } |
| #else |
| NOTREACHED(); |
| @@ -614,6 +621,7 @@ void GpuProcessTransportFactory::RemoveCompositor(ui::Compositor* compositor) { |
| if (data->surface_handle) |
| gpu::GpuSurfaceTracker::Get()->RemoveSurface(data->surface_handle); |
| #endif |
| + |
| per_compositor_data_.erase(it); |
| if (per_compositor_data_.empty()) { |
| // Destroying the GLHelper may cause some async actions to be cancelled, |