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

Unified Diff: ui/compositor/test/in_process_context_factory.cc

Issue 2565783002: Moves ownership of the cc::Display's BeginFrameSource out of Display. (Closed)
Patch Set: rebase. Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/compositor/test/in_process_context_factory.cc
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index a6a88a2410942938e63fe8194132f171b1855694..2dfc4f6e6c45c034189866bb79dafb653e2cb3d4 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -119,6 +119,7 @@ class DirectOutputSurface : public cc::OutputSurface {
struct InProcessContextFactory::PerCompositorData {
gpu::SurfaceHandle surface_handle = gpu::kNullSurfaceHandle;
+ std::unique_ptr<cc::BeginFrameSource> begin_frame_source;
std::unique_ptr<cc::Display> display;
};
@@ -200,15 +201,18 @@ void InProcessContextFactory::CreateCompositorFrameSink(
base::MakeUnique<cc::DelayBasedTimeSource>(
compositor->task_runner().get())));
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));
data->display = base::MakeUnique<cc::Display>(
&shared_bitmap_manager_, &gpu_memory_buffer_manager_,
compositor->GetRendererSettings(), compositor->frame_sink_id(),
- std::move(begin_frame_source), std::move(display_output_surface),
+ begin_frame_source.get(), std::move(display_output_surface),
std::move(scheduler), base::MakeUnique<cc::TextureMailboxDeleter>(
compositor->task_runner().get()));
+ // Note that we are careful not to destroy a prior |data->begin_frame_source|
+ // until we have reset |data->display|.
+ data->begin_frame_source = std::move(begin_frame_source);
auto* display = per_compositor_data_[compositor.get()]->display.get();
auto compositor_frame_sink = base::MakeUnique<cc::DirectCompositorFrameSink>(
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698