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 23c4cbd818916f0f8586f6be37f7d3157ba92522..200277905dc6844acae0e877e2c1f0787a9384b5 100644 |
--- a/content/browser/compositor/gpu_process_transport_factory.cc |
+++ b/content/browser/compositor/gpu_process_transport_factory.cc |
@@ -436,16 +436,18 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
} |
} |
- std::unique_ptr<cc::SyntheticBeginFrameSource> begin_frame_source; |
+ cc::SyntheticBeginFrameSource* synthetic_begin_frame_source; |
if (!compositor->GetRendererSettings().disable_display_vsync) { |
- begin_frame_source.reset(new cc::DelayBasedBeginFrameSource( |
+ synthetic_begin_frame_source = new cc::DelayBasedBeginFrameSource( |
base::MakeUnique<cc::DelayBasedTimeSource>( |
- compositor->task_runner().get()))); |
+ compositor->task_runner().get())); |
} else { |
- begin_frame_source.reset(new cc::BackToBackBeginFrameSource( |
+ synthetic_begin_frame_source = new cc::BackToBackBeginFrameSource( |
base::MakeUnique<cc::DelayBasedTimeSource>( |
- compositor->task_runner().get()))); |
+ compositor->task_runner().get())); |
} |
+ std::unique_ptr<cc::BeginFrameSource> begin_frame_source( |
+ synthetic_begin_frame_source); |
BrowserCompositorOutputSurface::UpdateVSyncParametersCallback vsync_callback = |
base::Bind(&ui::Compositor::SetDisplayVSyncParameters, compositor); |
@@ -510,10 +512,11 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
context_provider, vsync_callback, std::move(validator)); |
} else { |
#if defined(USE_AURA) |
+ std::unique_ptr<MusBrowserCompositorOutputSurface> mus_output_surface; |
if (compositor->window()) { |
// TODO(mfomitchev): Remove this clause once we complete the switch |
// to Aura-Mus. |
- display_output_surface = |
+ mus_output_surface = |
base::MakeUnique<MusBrowserCompositorOutputSurface>( |
compositor->window(), context_provider, |
GetGpuMemoryBufferManager(), vsync_callback, |
@@ -522,12 +525,18 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
aura::WindowTreeHost* host = |
aura::WindowTreeHost::GetForAcceleratedWidget( |
compositor->widget()); |
- display_output_surface = |
+ mus_output_surface = |
base::MakeUnique<MusBrowserCompositorOutputSurface>( |
host->window(), context_provider, |
GetGpuMemoryBufferManager(), vsync_callback, |
std::move(validator)); |
} |
+ // We use the ExternalBeginFrameSource provided by the output surface |
+ // instead of our own synthetic one. |
+ begin_frame_source.reset(new cc::DelegatingBeginFrameSource( |
+ mus_output_surface->GetBeginFrameSource())); |
+ synthetic_begin_frame_source = nullptr; |
+ display_output_surface = std::move(mus_output_surface); |
#else |
NOTREACHED(); |
#endif |
@@ -537,7 +546,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
} |
data->display_output_surface = display_output_surface.get(); |
- data->begin_frame_source = begin_frame_source.get(); |
+ if (synthetic_begin_frame_source) |
+ data->begin_frame_source = synthetic_begin_frame_source; |
if (data->reflector) |
data->reflector->OnSourceSurfaceReady(data->display_output_surface); |
@@ -547,7 +557,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( |
#endif |
std::unique_ptr<cc::DisplayScheduler> scheduler(new cc::DisplayScheduler( |
- begin_frame_source.get(), compositor->task_runner().get(), |
+ compositor->task_runner().get(), |
display_output_surface->capabilities().max_frames_pending)); |
// The Display owns and uses the |display_output_surface| created above. |