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

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

Issue 2474113002: Mus+Ash: Unified BeginFrame Skeleton (Closed)
Patch Set: Rebase 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 | « services/ui/ws/display_manager.cc ('k') | 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
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 public: 53 public:
54 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 54 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
55 ~FrameGenerator() override; 55 ~FrameGenerator() override;
56 56
57 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); 57 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
58 58
59 // Schedules a redraw for the provided region. 59 // Schedules a redraw for the provided region.
60 void RequestRedraw(const gfx::Rect& redraw_region); 60 void RequestRedraw(const gfx::Rect& redraw_region);
61 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 61 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
62 62
63 bool is_frame_pending() { return frame_pending_; }
64
65 private: 63 private:
66 friend class ui::ws::test::FrameGeneratorTest; 64 friend class ui::ws::test::FrameGeneratorTest;
67 65
68 // cc::mojom::MojoCompositorFrameSinkClient implementation: 66 // cc::mojom::MojoCompositorFrameSinkClient implementation:
69 void DidReceiveCompositorFrameAck() override; 67 void DidReceiveCompositorFrameAck() override;
68 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override;
70 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 69 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
71 70
72 void WantToDraw(); 71 // Generates the CompositorFrame.
73
74 // This method initiates a top level redraw of the display.
75 // TODO(fsamuel): In polliwog, this only gets called when the window manager
76 // changes.
77 void Draw();
78
79 // Generates the CompositorFrame for the current |dirty_rect_|.
80 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 72 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect);
81 73
82 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad 74 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad
83 // for each that lacks one. 75 // for each that lacks one.
84 void DrawWindowTree(cc::RenderPass* pass, 76 void DrawWindowTree(cc::RenderPass* pass,
85 ServerWindow* window, 77 ServerWindow* window,
86 const gfx::Vector2d& parent_to_root_origin_offset, 78 const gfx::Vector2d& parent_to_root_origin_offset,
87 float opacity); 79 float opacity);
88 80
89 // Adds a reference to the current cc::Surface of the provided 81 // Adds a reference to the current cc::Surface of the provided
(...skipping 25 matching lines...) Expand all
115 107
116 FrameGeneratorDelegate* delegate_; 108 FrameGeneratorDelegate* delegate_;
117 cc::FrameSinkId frame_sink_id_; 109 cc::FrameSinkId frame_sink_id_;
118 ServerWindow* const root_window_; 110 ServerWindow* const root_window_;
119 cc::SurfaceSequenceGenerator surface_sequence_generator_; 111 cc::SurfaceSequenceGenerator surface_sequence_generator_;
120 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 112 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
121 113
122 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 114 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
123 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget; 115 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
124 116
125 // The region that needs to be redrawn next time the compositor frame is
126 // generated.
127 gfx::Rect dirty_rect_;
128 base::Timer draw_timer_;
129 bool frame_pending_ = false;
130 struct SurfaceDependency { 117 struct SurfaceDependency {
131 cc::LocalFrameId local_frame_id; 118 cc::LocalFrameId local_frame_id;
132 cc::SurfaceSequence sequence; 119 cc::SurfaceSequence sequence;
133 }; 120 };
134 std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash> 121 std::unordered_map<cc::FrameSinkId, SurfaceDependency, cc::FrameSinkIdHash>
135 dependencies_; 122 dependencies_;
136 123
137 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; 124 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
138 125
139 base::WeakPtrFactory<FrameGenerator> weak_factory_; 126 base::WeakPtrFactory<FrameGenerator> weak_factory_;
140 127
141 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 128 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
142 }; 129 };
143 130
144 } // namespace ws 131 } // namespace ws
145 132
146 } // namespace ui 133 } // namespace ui
147 134
148 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 135 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « services/ui/ws/display_manager.cc ('k') | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698