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

Side by Side Diff: services/ui/ws/frame_generator.h

Issue 2453013002: Mus: Remove dependency on ServerWindowCompositorFrameSink from FrameGenerator (Closed)
Patch Set: Rebased Created 4 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef SERVICES_UI_WS_FRAME_GENERATOR_H_ 5 #ifndef SERVICES_UI_WS_FRAME_GENERATOR_H_
6 #define SERVICES_UI_WS_FRAME_GENERATOR_H_ 6 #define SERVICES_UI_WS_FRAME_GENERATOR_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <unordered_map> 9 #include <unordered_map>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/timer/timer.h" 12 #include "base/timer/timer.h"
13 #include "cc/surfaces/frame_sink_id.h" 13 #include "cc/surfaces/frame_sink_id.h"
14 #include "cc/surfaces/local_frame_id.h" 14 #include "cc/surfaces/local_frame_id.h"
15 #include "cc/surfaces/surface_sequence.h" 15 #include "cc/surfaces/surface_sequence.h"
16 #include "cc/surfaces/surface_sequence_generator.h" 16 #include "cc/surfaces/surface_sequence_generator.h"
17 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
17 #include "services/ui/ws/ids.h" 18 #include "services/ui/ws/ids.h"
18 #include "services/ui/ws/server_window_tracker.h" 19 #include "services/ui/ws/server_window_tracker.h"
19 #include "ui/gfx/geometry/rect.h" 20 #include "ui/gfx/geometry/rect.h"
20 #include "ui/gfx/native_widget_types.h" 21 #include "ui/gfx/native_widget_types.h"
21 22
22 namespace cc { 23 namespace cc {
23 class CompositorFrame; 24 class CompositorFrame;
24 class CopyOutputRequest; 25 class CopyOutputRequest;
25 class RenderPass; 26 class RenderPass;
26 class SurfaceId; 27 class SurfaceId;
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 void DidDraw(); 78 void DidDraw();
78 79
79 // Generates the CompositorFrame for the current |dirty_rect_|. 80 // Generates the CompositorFrame for the current |dirty_rect_|.
80 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 81 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect);
81 82
82 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad 83 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad
83 // for each that lacks one. 84 // for each that lacks one.
84 void DrawWindowTree(cc::RenderPass* pass, 85 void DrawWindowTree(cc::RenderPass* pass,
85 ServerWindow* window, 86 ServerWindow* window,
86 const gfx::Vector2d& parent_to_root_origin_offset, 87 const gfx::Vector2d& parent_to_root_origin_offset,
87 float opacity, 88 float opacity);
88 bool* may_contain_video);
89 89
90 // Adds a reference to the current cc::Surface of the provided 90 // Adds a reference to the current cc::Surface of the provided
91 // |window_compositor_frame_sink|. If an existing reference is held with a 91 // |window_compositor_frame_sink|. If an existing reference is held with a
92 // different LocalFrameId then release that reference first. This is called on 92 // different LocalFrameId then release that reference first. This is called on
93 // each ServerWindowCompositorFrameSink as FrameGenerator walks the window 93 // each ServerWindowCompositorFrameSink as FrameGenerator walks the window
94 // tree to generate a CompositorFrame. This is done to make sure that the 94 // tree to generate a CompositorFrame. This is done to make sure that the
95 // window surfaces are retained for the entirety of the time between 95 // window surfaces are retained for the entirety of the time between
96 // submission of the top-level frame to drawing the frame to screen. 96 // submission of the top-level frame to drawing the frame to screen.
97 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime 97 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
98 // management. 98 // management.
99 void AddOrUpdateSurfaceReference( 99 void AddOrUpdateSurfaceReference(mojom::CompositorFrameSinkType type,
100 ServerWindowCompositorFrameSink* window_compositor_frame_sink); 100 ServerWindow* window);
101 101
102 // Releases any retained references for the provided FrameSink. 102 // Releases any retained references for the provided FrameSink.
103 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime 103 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
104 // management. 104 // management.
105 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id); 105 void ReleaseFrameSinkReference(const cc::FrameSinkId& frame_sink_id);
106 106
107 // Releases all retained references to surfaces. 107 // Releases all retained references to surfaces.
108 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime 108 // TODO(fsamuel, kylechar): This will go away once we get surface lifetime
109 // management. 109 // management.
110 void ReleaseAllSurfaceReferences(); 110 void ReleaseAllSurfaceReferences();
111 111
112 // ServerWindowObserver implementation. 112 // ServerWindowObserver implementation.
113 void OnWindowDestroying(ServerWindow* window) override; 113 void OnWindowDestroying(ServerWindow* window) override;
114 114
115 FrameGeneratorDelegate* delegate_; 115 FrameGeneratorDelegate* delegate_;
116 scoped_refptr<DisplayCompositor> display_compositor_; 116 scoped_refptr<DisplayCompositor> display_compositor_;
117 cc::FrameSinkId frame_sink_id_; 117 cc::FrameSinkId frame_sink_id_;
118 cc::SurfaceSequenceGenerator surface_sequence_generator_; 118 cc::SurfaceSequenceGenerator surface_sequence_generator_;
119 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 119 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
120 120
121 std::unique_ptr<DisplayCompositorFrameSink> compositor_frame_sink_; 121 std::unique_ptr<DisplayCompositorFrameSink> compositor_frame_sink_;
122 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget; 122 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
123 123
124 // The region that needs to be redrawn next time the compositor frame is 124 // The region that needs to be redrawn next time the compositor frame is
125 // generated. 125 // generated.
126 gfx::Rect dirty_rect_; 126 gfx::Rect dirty_rect_;
127 base::Timer draw_timer_; 127 base::Timer draw_timer_;
128 bool frame_pending_ = false; 128 bool frame_pending_ = false;
129 bool may_contain_video_ = false;
130 struct SurfaceDependency { 129 struct SurfaceDependency {
131 cc::LocalFrameId local_frame_id; 130 cc::LocalFrameId local_frame_id;
132 cc::SurfaceSequence sequence; 131 cc::SurfaceSequence sequence;
133 }; 132 };
134 std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash> 133 std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash>
135 dependencies_; 134 dependencies_;
136 135
137 base::WeakPtrFactory<FrameGenerator> weak_factory_; 136 base::WeakPtrFactory<FrameGenerator> weak_factory_;
138 137
139 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 138 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
140 }; 139 };
141 140
142 } // namespace ws 141 } // namespace ws
143 142
144 } // namespace ui 143 } // namespace ui
145 144
146 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 145 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698