| 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" |
| 11 #include "cc/quads/shared_quad_state.h" | 11 #include "cc/quads/shared_quad_state.h" |
| 12 #include "cc/quads/surface_draw_quad.h" | 12 #include "cc/quads/surface_draw_quad.h" |
| 13 #include "cc/surfaces/surface_id.h" | 13 #include "cc/surfaces/surface_id.h" |
| 14 #include "gpu/ipc/client/gpu_channel_host.h" | 14 #include "gpu/ipc/client/gpu_channel_host.h" |
| 15 #include "services/ui/surfaces/display_compositor_frame_sink.h" | 15 #include "services/ui/surfaces/display_compositor_frame_sink.h" |
| 16 #include "services/ui/ws/frame_generator_delegate.h" | 16 #include "services/ui/ws/frame_generator_delegate.h" |
| 17 #include "services/ui/ws/server_window.h" | 17 #include "services/ui/ws/server_window.h" |
| 18 #include "services/ui/ws/server_window_compositor_frame_sink.h" | 18 #include "services/ui/ws/server_window_compositor_frame_sink.h" |
| 19 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" | 19 #include "services/ui/ws/server_window_compositor_frame_sink_manager.h" |
| 20 | 20 |
| 21 namespace ui { | 21 namespace ui { |
| 22 | 22 |
| 23 namespace ws { | 23 namespace ws { |
| 24 | 24 |
| 25 FrameGenerator::FrameGenerator( | 25 FrameGenerator::FrameGenerator( |
| 26 FrameGeneratorDelegate* delegate, | 26 FrameGeneratorDelegate* delegate, |
| 27 ServerWindow* root_window, |
| 27 scoped_refptr<DisplayCompositor> display_compositor) | 28 scoped_refptr<DisplayCompositor> display_compositor) |
| 28 : delegate_(delegate), | 29 : delegate_(delegate), |
| 29 display_compositor_(display_compositor), | 30 display_compositor_(display_compositor), |
| 30 frame_sink_id_(0, display_compositor->GenerateNextClientId()), | 31 frame_sink_id_( |
| 32 WindowIdToTransportId(root_window->id()), |
| 33 static_cast<uint32_t>(mojom::CompositorFrameSinkType::DEFAULT)), |
| 31 draw_timer_(false, false), | 34 draw_timer_(false, false), |
| 32 weak_factory_(this) { | 35 weak_factory_(this) { |
| 33 DCHECK(delegate_); | 36 DCHECK(delegate_); |
| 34 surface_sequence_generator_.set_frame_sink_id(frame_sink_id_); | 37 surface_sequence_generator_.set_frame_sink_id(frame_sink_id_); |
| 35 } | 38 } |
| 36 | 39 |
| 37 FrameGenerator::~FrameGenerator() { | 40 FrameGenerator::~FrameGenerator() { |
| 38 ReleaseAllSurfaceReferences(); | 41 ReleaseAllSurfaceReferences(); |
| 39 // Invalidate WeakPtrs now to avoid callbacks back into the | 42 // Invalidate WeakPtrs now to avoid callbacks back into the |
| 40 // FrameGenerator during destruction of |compositor_frame_sink_|. | 43 // FrameGenerator during destruction of |compositor_frame_sink_|. |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 ReleaseFrameSinkReference(default_compositor_frame_sink->frame_sink_id()); | 316 ReleaseFrameSinkReference(default_compositor_frame_sink->frame_sink_id()); |
| 314 ServerWindowCompositorFrameSink* underlay_compositor_frame_sink = | 317 ServerWindowCompositorFrameSink* underlay_compositor_frame_sink = |
| 315 surface_manager->GetUnderlayCompositorFrameSink(); | 318 surface_manager->GetUnderlayCompositorFrameSink(); |
| 316 if (underlay_compositor_frame_sink) | 319 if (underlay_compositor_frame_sink) |
| 317 ReleaseFrameSinkReference(underlay_compositor_frame_sink->frame_sink_id()); | 320 ReleaseFrameSinkReference(underlay_compositor_frame_sink->frame_sink_id()); |
| 318 } | 321 } |
| 319 | 322 |
| 320 } // namespace ws | 323 } // namespace ws |
| 321 | 324 |
| 322 } // namespace ui | 325 } // namespace ui |
| OLD | NEW |