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

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

Issue 2369793002: WIP: Propagate SurfaceID up window tree hierarchy
Patch Set: Fix input events: EventDispatcher ignores container windows Created 4 years, 2 months 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 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/timer/timer.h" 11 #include "base/timer/timer.h"
12 #include "ui/gfx/geometry/rect.h" 12 #include "ui/gfx/geometry/rect.h"
13 #include "ui/gfx/native_widget_types.h" 13 #include "ui/gfx/native_widget_types.h"
14 14
15 namespace cc { 15 namespace cc {
16 class CompositorFrame; 16 class CompositorFrame;
17 class CopyOutputRequest; 17 class CopyOutputRequest;
18 class RenderPass; 18 class RenderPass;
19 } 19 }
20 20
21 namespace gpu { 21 namespace gpu {
22 class GpuChannelHost; 22 class GpuChannelHost;
23 } 23 }
24 24
25 namespace ui { 25 namespace ui {
26 26
27 namespace surfaces {
28 class CompositorFrameSink;
27 class DisplayCompositor; 29 class DisplayCompositor;
28 class SurfacesState; 30 }
29 31
30 namespace ws { 32 namespace ws {
31 33
32 namespace test { 34 namespace test {
33 class FrameGeneratorTest; 35 class FrameGeneratorTest;
34 } 36 }
35 37
36 class FrameGeneratorDelegate; 38 class FrameGeneratorDelegate;
37 class ServerWindow; 39 class ServerWindow;
38 40
39 // Responsible for redrawing the display in response to the redraw requests by 41 // Responsible for redrawing the display in response to the redraw requests by
40 // submitting CompositorFrames to the owned DisplayCompositor. 42 // submitting CompositorFrames to the owned CompositorFrameSink.
41 class FrameGenerator { 43 class FrameGenerator {
42 public: 44 public:
43 FrameGenerator(FrameGeneratorDelegate* delegate, 45 FrameGenerator(FrameGeneratorDelegate* delegate,
44 scoped_refptr<SurfacesState> surfaces_state); 46 scoped_refptr<surfaces::DisplayCompositor> display_compositor);
45 virtual ~FrameGenerator(); 47 virtual ~FrameGenerator();
46 48
47 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); 49 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
48 50
49 // Schedules a redraw for the provided region. 51 // Schedules a redraw for the provided region.
50 void RequestRedraw(const gfx::Rect& redraw_region); 52 void RequestRedraw(const gfx::Rect& redraw_region);
51 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 53 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
52 void RequestCopyOfOutput( 54 void RequestCopyOfOutput(
53 std::unique_ptr<cc::CopyOutputRequest> output_request); 55 std::unique_ptr<cc::CopyOutputRequest> output_request);
54 56
55 bool is_frame_pending() { return frame_pending_; } 57 bool is_frame_pending() { return frame_pending_; }
56 58
57 private: 59 private:
58 friend class ui::ws::test::FrameGeneratorTest; 60 friend class ui::ws::test::FrameGeneratorTest;
59 61
60 void WantToDraw(); 62 void WantToDraw();
61 63
62 // This method initiates a top level redraw of the display. 64 // This method initiates a top level redraw of the display.
63 // TODO(fsamuel): This should use vblank as a signal rather than a timer 65 // TODO(fsamuel): This should use vblank as a signal rather than a timer
64 // http://crbug.com/533042 66 // http://crbug.com/533042
65 void Draw(); 67 void Draw();
66 68
67 // This is called after the DisplayCompositor has completed generating a new 69 // This is called after the CompositorFrameSink has completed generating a new
68 // frame for the display. TODO(fsamuel): Idle time processing should happen 70 // frame for the display. TODO(fsamuel): Idle time processing should happen
69 // here if there is budget for it. 71 // here if there is budget for it.
70 void DidDraw(); 72 void DidDraw();
71 73
72 // Generates the CompositorFrame for the current |dirty_rect_|. 74 // Generates the CompositorFrame for the current |dirty_rect_|.
73 cc::CompositorFrame GenerateCompositorFrame( 75 cc::CompositorFrame GenerateCompositorFrame(
74 const gfx::Rect& output_rect) const; 76 const gfx::Rect& output_rect) const;
75 77
76 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad 78 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad
77 // for each that lacks one. 79 // for each that lacks one.
78 void DrawWindowTree(cc::RenderPass* pass, 80 void DrawWindowTree(cc::RenderPass* pass,
79 ServerWindow* window, 81 ServerWindow* window,
80 const gfx::Vector2d& parent_to_root_origin_offset, 82 const gfx::Vector2d& parent_to_root_origin_offset,
81 float opacity, 83 float opacity,
82 bool* may_contain_video) const; 84 bool* may_contain_video) const;
83 85
84 FrameGeneratorDelegate* delegate_; 86 FrameGeneratorDelegate* delegate_;
85 scoped_refptr<SurfacesState> surfaces_state_; 87 scoped_refptr<surfaces::DisplayCompositor> display_compositor_;
86 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 88 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
87 89
88 std::unique_ptr<DisplayCompositor> display_compositor_; 90 std::unique_ptr<surfaces::CompositorFrameSink> compositor_frame_sink_;
89 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget; 91 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
90 92
91 // The region that needs to be redrawn next time the compositor frame is 93 // The region that needs to be redrawn next time the compositor frame is
92 // generated. 94 // generated.
93 gfx::Rect dirty_rect_; 95 gfx::Rect dirty_rect_;
94 base::Timer draw_timer_; 96 base::Timer draw_timer_;
95 bool frame_pending_ = false; 97 bool frame_pending_ = false;
96 bool may_contain_video_ = false; 98 bool may_contain_video_ = false;
97 99
98 base::WeakPtrFactory<FrameGenerator> weak_factory_; 100 base::WeakPtrFactory<FrameGenerator> weak_factory_;
99 101
100 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 102 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
101 }; 103 };
102 104
103 } // namespace ws 105 } // namespace ws
104 106
105 } // namespace ui 107 } // namespace ui
106 108
107 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 109 #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