Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "services/ui/ws/frame_generator.h" | 5 #include "services/ui/ws/frame_generator.h" |
| 6 | 6 |
| 7 #include "base/containers/adapters.h" | 7 #include "base/containers/adapters.h" |
| 8 #include "cc/output/compositor_frame.h" | 8 #include "cc/output/compositor_frame.h" |
| 9 #include "cc/quads/render_pass.h" | 9 #include "cc/quads/render_pass.h" |
| 10 #include "cc/quads/render_pass_draw_quad.h" | 10 #include "cc/quads/render_pass_draw_quad.h" |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 37 FrameGenerator::~FrameGenerator() { | 37 FrameGenerator::~FrameGenerator() { |
| 38 ReleaseAllSurfaceReferences(); | 38 ReleaseAllSurfaceReferences(); |
| 39 // Invalidate WeakPtrs now to avoid callbacks back into the | 39 // Invalidate WeakPtrs now to avoid callbacks back into the |
| 40 // FrameGenerator during destruction of |compositor_frame_sink_|. | 40 // FrameGenerator during destruction of |compositor_frame_sink_|. |
| 41 weak_factory_.InvalidateWeakPtrs(); | 41 weak_factory_.InvalidateWeakPtrs(); |
| 42 compositor_frame_sink_.reset(); | 42 compositor_frame_sink_.reset(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 void FrameGenerator::OnGpuChannelEstablished( | 45 void FrameGenerator::OnGpuChannelEstablished( |
| 46 scoped_refptr<gpu::GpuChannelHost> channel) { | 46 scoped_refptr<gpu::GpuChannelHost> channel) { |
| 47 if (widget_ != gfx::kNullAcceleratedWidget) { | 47 if (widget_ != gpu::kNullSurfaceHandle) { |
| 48 compositor_frame_sink_ = base::MakeUnique<surfaces::CompositorFrameSink>( | 48 compositor_frame_sink_ = base::MakeUnique<surfaces::CompositorFrameSink>( |
| 49 frame_sink_id_, base::ThreadTaskRunnerHandle::Get(), widget_, | 49 frame_sink_id_, base::ThreadTaskRunnerHandle::Get(), widget_, |
| 50 std::move(channel), display_compositor_); | 50 std::move(channel), display_compositor_); |
| 51 } else { | 51 } else { |
| 52 gpu_channel_ = std::move(channel); | 52 gpu_channel_ = std::move(channel); |
| 53 } | 53 } |
| 54 } | 54 } |
| 55 | 55 |
| 56 void FrameGenerator::RequestRedraw(const gfx::Rect& redraw_region) { | 56 void FrameGenerator::RequestRedraw(const gfx::Rect& redraw_region) { |
| 57 dirty_rect_.Union(redraw_region); | 57 dirty_rect_.Union(redraw_region); |
| 58 WantToDraw(); | 58 WantToDraw(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 void FrameGenerator::OnAcceleratedWidgetAvailable( | 61 void FrameGenerator::OnAcceleratedWidgetAvailable(gpu::SurfaceHandle widget) { |
|
Fady Samuel
2016/10/19 10:49:52
I'm wondering if we should replace references to "
Jay Civelli
2016/11/02 22:02:17
Based on @sadrul comment I kept the AcceleratedWid
| |
| 62 gfx::AcceleratedWidget widget) { | |
| 63 widget_ = widget; | 62 widget_ = widget; |
| 64 if (gpu_channel_ && widget != gfx::kNullAcceleratedWidget) { | 63 if (gpu_channel_ && widget != gpu::kNullSurfaceHandle) { |
| 65 compositor_frame_sink_.reset(new surfaces::CompositorFrameSink( | 64 compositor_frame_sink_.reset(new surfaces::CompositorFrameSink( |
| 66 frame_sink_id_, base::ThreadTaskRunnerHandle::Get(), widget_, | 65 frame_sink_id_, base::ThreadTaskRunnerHandle::Get(), widget_, |
| 67 std::move(gpu_channel_), display_compositor_)); | 66 std::move(gpu_channel_), display_compositor_)); |
| 68 } | 67 } |
| 69 } | 68 } |
| 70 | 69 |
| 71 void FrameGenerator::RequestCopyOfOutput( | 70 void FrameGenerator::RequestCopyOfOutput( |
| 72 std::unique_ptr<cc::CopyOutputRequest> output_request) { | 71 std::unique_ptr<cc::CopyOutputRequest> output_request) { |
| 73 if (compositor_frame_sink_) | 72 if (compositor_frame_sink_) |
| 74 compositor_frame_sink_->RequestCopyOfOutput(std::move(output_request)); | 73 compositor_frame_sink_->RequestCopyOfOutput(std::move(output_request)); |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 313 if (default_surface) | 312 if (default_surface) |
| 314 ReleaseFrameSinkReference(default_surface->frame_sink_id()); | 313 ReleaseFrameSinkReference(default_surface->frame_sink_id()); |
| 315 ServerWindowSurface* underlay_surface = surface_manager->GetUnderlaySurface(); | 314 ServerWindowSurface* underlay_surface = surface_manager->GetUnderlaySurface(); |
| 316 if (underlay_surface) | 315 if (underlay_surface) |
| 317 ReleaseFrameSinkReference(underlay_surface->frame_sink_id()); | 316 ReleaseFrameSinkReference(underlay_surface->frame_sink_id()); |
| 318 } | 317 } |
| 319 | 318 |
| 320 } // namespace ws | 319 } // namespace ws |
| 321 | 320 |
| 322 } // namespace ui | 321 } // namespace ui |
| OLD | NEW |