Index: services/ui/ws/frame_generator.cc |
diff --git a/services/ui/ws/frame_generator.cc b/services/ui/ws/frame_generator.cc |
index 4ab9589b8636c8dfeb4fd9c71a78377224b46d89..87e1a2cdf97eab0b75957dd1da974857c8a43a01 100644 |
--- a/services/ui/ws/frame_generator.cc |
+++ b/services/ui/ws/frame_generator.cc |
@@ -11,7 +11,7 @@ |
#include "cc/quads/shared_quad_state.h" |
#include "cc/quads/surface_draw_quad.h" |
#include "gpu/ipc/client/gpu_channel_host.h" |
-#include "services/ui/surfaces/display_compositor.h" |
+#include "services/ui/surfaces/compositor_frame_sink.h" |
#include "services/ui/ws/frame_generator_delegate.h" |
#include "services/ui/ws/server_window.h" |
#include "services/ui/ws/server_window_surface.h" |
@@ -21,10 +21,11 @@ namespace ui { |
namespace ws { |
-FrameGenerator::FrameGenerator(FrameGeneratorDelegate* delegate, |
- scoped_refptr<SurfacesState> surfaces_state) |
+FrameGenerator::FrameGenerator( |
+ FrameGeneratorDelegate* delegate, |
+ scoped_refptr<surfaces::DisplayCompositor> display_compositor) |
: delegate_(delegate), |
- surfaces_state_(surfaces_state), |
+ display_compositor_(display_compositor), |
draw_timer_(false, false), |
weak_factory_(this) { |
DCHECK(delegate_); |
@@ -32,17 +33,17 @@ FrameGenerator::FrameGenerator(FrameGeneratorDelegate* delegate, |
FrameGenerator::~FrameGenerator() { |
// Invalidate WeakPtrs now to avoid callbacks back into the |
- // FrameGenerator during destruction of |display_compositor_|. |
+ // FrameGenerator during destruction of |compositor_frame_sink_|. |
weak_factory_.InvalidateWeakPtrs(); |
- display_compositor_.reset(); |
+ compositor_frame_sink_.reset(); |
} |
void FrameGenerator::OnGpuChannelEstablished( |
scoped_refptr<gpu::GpuChannelHost> channel) { |
if (widget_ != gfx::kNullAcceleratedWidget) { |
- display_compositor_.reset( |
- new DisplayCompositor(base::ThreadTaskRunnerHandle::Get(), widget_, |
- std::move(channel), surfaces_state_)); |
+ compositor_frame_sink_.reset(new surfaces::CompositorFrameSink( |
+ base::ThreadTaskRunnerHandle::Get(), widget_, std::move(channel), |
+ display_compositor_)); |
} else { |
gpu_channel_ = std::move(channel); |
} |
@@ -57,16 +58,16 @@ void FrameGenerator::OnAcceleratedWidgetAvailable( |
gfx::AcceleratedWidget widget) { |
widget_ = widget; |
if (gpu_channel_ && widget != gfx::kNullAcceleratedWidget) { |
- display_compositor_.reset( |
- new DisplayCompositor(base::ThreadTaskRunnerHandle::Get(), widget_, |
- std::move(gpu_channel_), surfaces_state_)); |
+ compositor_frame_sink_.reset(new surfaces::CompositorFrameSink( |
+ base::ThreadTaskRunnerHandle::Get(), widget_, std::move(gpu_channel_), |
+ display_compositor_)); |
} |
} |
void FrameGenerator::RequestCopyOfOutput( |
std::unique_ptr<cc::CopyOutputRequest> output_request) { |
- if (display_compositor_) |
- display_compositor_->RequestCopyOfOutput(std::move(output_request)); |
+ if (compositor_frame_sink_) |
+ compositor_frame_sink_->RequestCopyOfOutput(std::move(output_request)); |
} |
void FrameGenerator::WantToDraw() { |
@@ -96,9 +97,9 @@ void FrameGenerator::Draw() { |
// is submitted 'soon'. |
} |
} |
- if (display_compositor_) { |
+ if (compositor_frame_sink_) { |
frame_pending_ = true; |
- display_compositor_->SubmitCompositorFrame( |
+ compositor_frame_sink_->SubmitCompositorFrame( |
std::move(frame), |
base::Bind(&FrameGenerator::DidDraw, weak_factory_.GetWeakPtr())); |
} |
@@ -108,8 +109,8 @@ void FrameGenerator::Draw() { |
void FrameGenerator::DidDraw() { |
frame_pending_ = false; |
delegate_->OnCompositorFrameDrawn(); |
- if (!dirty_rect_.IsEmpty()) |
- WantToDraw(); |
+ // if (!dirty_rect_.IsEmpty()) |
+ WantToDraw(); |
} |
cc::CompositorFrame FrameGenerator::GenerateCompositorFrame( |
@@ -120,8 +121,8 @@ cc::CompositorFrame FrameGenerator::GenerateCompositorFrame( |
gfx::Transform()); |
bool may_contain_video = false; |
- DrawWindowTree(render_pass.get(), delegate_->GetRootWindow(), gfx::Vector2d(), |
- 1.0f, &may_contain_video); |
+ DrawWindowTree(render_pass.get(), delegate_->GetActiveRootWindow(), |
+ gfx::Vector2d(), 1.0f, &may_contain_video); |
std::unique_ptr<cc::DelegatedFrameData> frame_data( |
new cc::DelegatedFrameData); |
@@ -167,14 +168,9 @@ void FrameGenerator::DrawWindowTree( |
const gfx::Rect absolute_bounds = |
window->bounds() + parent_to_root_origin_offset; |
- const ServerWindow::Windows& children = window->children(); |
const float combined_opacity = opacity * window->opacity(); |
- for (ServerWindow* child : base::Reversed(children)) { |
- DrawWindowTree(pass, child, absolute_bounds.OffsetFromOrigin(), |
- combined_opacity, may_contain_video); |
- } |
- if (!window->surface_manager() || !window->surface_manager()->ShouldDraw()) |
+ if (!window->surface_manager()) |
return; |
ServerWindowSurface* underlay_surface = |
@@ -206,29 +202,29 @@ void FrameGenerator::DrawWindowTree( |
if (default_surface->may_contain_video()) |
*may_contain_video = true; |
} |
- if (underlay_surface) { |
- const gfx::Rect underlay_absolute_bounds = |
- absolute_bounds - window->underlay_offset(); |
- gfx::Transform quad_to_target_transform; |
- quad_to_target_transform.Translate(underlay_absolute_bounds.x(), |
- underlay_absolute_bounds.y()); |
- cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
- const gfx::Rect bounds_at_origin( |
- underlay_surface->last_submitted_frame_size()); |
- sqs->SetAll(quad_to_target_transform, |
- bounds_at_origin.size() /* layer_bounds */, |
- bounds_at_origin /* visible_layer_bounds */, |
- bounds_at_origin /* clip_rect */, false /* is_clipped */, |
- combined_opacity, SkXfermode::kSrcOver_Mode, |
- 0 /* sorting-context_id */); |
- |
- auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
- quad->SetAll(sqs, bounds_at_origin /* rect */, |
- gfx::Rect() /* opaque_rect */, |
- bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
- underlay_surface->id()); |
- DCHECK(!underlay_surface->may_contain_video()); |
- } |
+ //if (underlay_surface) { |
+ // const gfx::Rect underlay_absolute_bounds = |
+ // absolute_bounds - window->underlay_offset(); |
+ // gfx::Transform quad_to_target_transform; |
+ // quad_to_target_transform.Translate(underlay_absolute_bounds.x(), |
+ // underlay_absolute_bounds.y()); |
+ // cc::SharedQuadState* sqs = pass->CreateAndAppendSharedQuadState(); |
+ // const gfx::Rect bounds_at_origin( |
+ // underlay_surface->last_submitted_frame_size()); |
+ // sqs->SetAll(quad_to_target_transform, |
+ // bounds_at_origin.size() /* layer_bounds */, |
+ // bounds_at_origin /* visible_layer_bounds */, |
+ // bounds_at_origin /* clip_rect */, false /* is_clipped */, |
+ // combined_opacity, SkXfermode::kSrcOver_Mode, |
+ // 0 /* sorting-context_id */); |
+ |
+ // auto* quad = pass->CreateAndAppendDrawQuad<cc::SurfaceDrawQuad>(); |
+ // quad->SetAll(sqs, bounds_at_origin /* rect */, |
+ // gfx::Rect() /* opaque_rect */, |
+ // bounds_at_origin /* visible_rect */, true /* needs_blending*/, |
+ // underlay_surface->id()); |
+ // DCHECK(!underlay_surface->may_contain_video()); |
+ //} |
} |
} // namespace ws |