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

Unified Diff: services/ui/surfaces/gpu_compositor_frame_sink.cc

Issue 2543123004: Mus: Move creation of cc::Display to DisplayCompositor (Closed)
Patch Set: More cleanup 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.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/ui/surfaces/gpu_compositor_frame_sink.cc
diff --git a/services/ui/surfaces/gpu_compositor_frame_sink.cc b/services/ui/surfaces/gpu_compositor_frame_sink.cc
index b27e881e0f3bed73c1a9ccb77e535803ec734844..3a07785ee880585e7b92cc322e03d538d8085d91 100644
--- a/services/ui/surfaces/gpu_compositor_frame_sink.cc
+++ b/services/ui/surfaces/gpu_compositor_frame_sink.cc
@@ -10,33 +10,24 @@
#include "base/threading/thread_task_runner_handle.h"
#include "cc/output/compositor_frame.h"
#include "cc/output/output_surface.h"
-#include "cc/output/texture_mailbox_deleter.h"
#include "cc/quads/shared_quad_state.h"
#include "cc/quads/surface_draw_quad.h"
#include "cc/scheduler/begin_frame_source.h"
-#include "cc/surfaces/display_scheduler.h"
+#include "cc/surfaces/display.h"
#include "services/ui/surfaces/display_compositor.h"
-#include "services/ui/surfaces/display_output_surface.h"
-
-#if defined(USE_OZONE)
-#include "gpu/command_buffer/client/gles2_interface.h"
-#include "services/ui/surfaces/display_output_surface_ozone.h"
-#endif
namespace ui {
GpuCompositorFrameSink::GpuCompositorFrameSink(
DisplayCompositor* display_compositor,
const cc::FrameSinkId& frame_sink_id,
- gpu::SurfaceHandle surface_handle,
- gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
- scoped_refptr<cc::InProcessContextProvider> context_provider,
+ std::unique_ptr<cc::Display> display,
cc::mojom::MojoCompositorFrameSinkRequest request,
cc::mojom::MojoCompositorFrameSinkPrivateRequest private_request,
cc::mojom::MojoCompositorFrameSinkClientPtr client)
: frame_sink_id_(frame_sink_id),
- task_runner_(base::ThreadTaskRunnerHandle::Get()),
display_compositor_(display_compositor),
+ display_(std::move(display)),
surface_factory_(frame_sink_id_, display_compositor_->manager(), this),
client_(std::move(client)),
binding_(this, std::move(request)),
@@ -46,9 +37,9 @@ GpuCompositorFrameSink::GpuCompositorFrameSink(
display_compositor_->manager()->RegisterSurfaceFactoryClient(frame_sink_id_,
this);
- if (surface_handle != gpu::kNullSurfaceHandle) {
- InitDisplay(surface_handle, gpu_memory_buffer_manager,
- std::move(context_provider));
+ if (display_) {
+ display_->Initialize(this, display_compositor_->manager());
+ display_->SetVisible(true);
}
binding_.set_connection_error_handler(base::Bind(
@@ -123,50 +114,6 @@ void GpuCompositorFrameSink::RemoveChildFrameSink(
child_frame_sink_id);
}
-void GpuCompositorFrameSink::InitDisplay(
- gpu::SurfaceHandle surface_handle,
- gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager,
- scoped_refptr<cc::InProcessContextProvider> context_provider) {
- // TODO(rjkroege): If there is something better to do than CHECK, add it.
- CHECK(context_provider->BindToCurrentThread());
-
- std::unique_ptr<cc::SyntheticBeginFrameSource> synthetic_begin_frame_source(
- new cc::DelayBasedBeginFrameSource(
- base::MakeUnique<cc::DelayBasedTimeSource>(task_runner_.get())));
-
- std::unique_ptr<cc::OutputSurface> display_output_surface;
- if (context_provider->ContextCapabilities().surfaceless) {
-#if defined(USE_OZONE)
- display_output_surface = base::MakeUnique<DisplayOutputSurfaceOzone>(
- std::move(context_provider), surface_handle,
- synthetic_begin_frame_source.get(), gpu_memory_buffer_manager,
- GL_TEXTURE_2D, GL_RGB);
-#else
- NOTREACHED();
-#endif
- } else {
- display_output_surface = base::MakeUnique<DisplayOutputSurface>(
- std::move(context_provider), synthetic_begin_frame_source.get());
- }
-
- int max_frames_pending =
- display_output_surface->capabilities().max_frames_pending;
- DCHECK_GT(max_frames_pending, 0);
-
- std::unique_ptr<cc::DisplayScheduler> scheduler(
- new cc::DisplayScheduler(synthetic_begin_frame_source.get(),
- task_runner_.get(), max_frames_pending));
-
- display_.reset(new cc::Display(
- nullptr /* bitmap_manager */, gpu_memory_buffer_manager,
- cc::RendererSettings(), frame_sink_id_,
- std::move(synthetic_begin_frame_source),
- std::move(display_output_surface), std::move(scheduler),
- base::MakeUnique<cc::TextureMailboxDeleter>(task_runner_.get())));
- display_->Initialize(this, display_compositor_->manager());
- display_->SetVisible(true);
-}
-
void GpuCompositorFrameSink::DisplayOutputSurfaceLost() {}
void GpuCompositorFrameSink::DisplayWillDrawAndSwap(
« no previous file with comments | « services/ui/surfaces/gpu_compositor_frame_sink.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698