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

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

Issue 2386763002: services/ui: Match naming in cc (and jellyfish branch) (Closed)
Patch Set: Removed bad change 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_unittest.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;
29 }
30
27 class DisplayCompositor; 31 class DisplayCompositor;
28 class SurfacesState;
29 32
30 namespace ws { 33 namespace ws {
31 34
32 namespace test { 35 namespace test {
33 class FrameGeneratorTest; 36 class FrameGeneratorTest;
34 } 37 }
35 38
36 class FrameGeneratorDelegate; 39 class FrameGeneratorDelegate;
37 class ServerWindow; 40 class ServerWindow;
38 41
39 // Responsible for redrawing the display in response to the redraw requests by 42 // Responsible for redrawing the display in response to the redraw requests by
40 // submitting CompositorFrames to the owned DisplayCompositor. 43 // submitting CompositorFrames to the owned CompositorFrameSink.
41 class FrameGenerator { 44 class FrameGenerator {
42 public: 45 public:
43 FrameGenerator(FrameGeneratorDelegate* delegate, 46 FrameGenerator(FrameGeneratorDelegate* delegate,
44 scoped_refptr<SurfacesState> surfaces_state); 47 scoped_refptr<DisplayCompositor> display_compositor);
45 virtual ~FrameGenerator(); 48 virtual ~FrameGenerator();
46 49
47 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel); 50 void OnGpuChannelEstablished(scoped_refptr<gpu::GpuChannelHost> gpu_channel);
48 51
49 // Schedules a redraw for the provided region. 52 // Schedules a redraw for the provided region.
50 void RequestRedraw(const gfx::Rect& redraw_region); 53 void RequestRedraw(const gfx::Rect& redraw_region);
51 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 54 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
52 void RequestCopyOfOutput( 55 void RequestCopyOfOutput(
53 std::unique_ptr<cc::CopyOutputRequest> output_request); 56 std::unique_ptr<cc::CopyOutputRequest> output_request);
54 57
55 bool is_frame_pending() { return frame_pending_; } 58 bool is_frame_pending() { return frame_pending_; }
56 59
57 private: 60 private:
58 friend class ui::ws::test::FrameGeneratorTest; 61 friend class ui::ws::test::FrameGeneratorTest;
59 62
60 void WantToDraw(); 63 void WantToDraw();
61 64
62 // This method initiates a top level redraw of the display. 65 // This method initiates a top level redraw of the display.
63 // TODO(fsamuel): This should use vblank as a signal rather than a timer 66 // TODO(fsamuel): This should use vblank as a signal rather than a timer
64 // http://crbug.com/533042 67 // http://crbug.com/533042
65 void Draw(); 68 void Draw();
66 69
67 // This is called after the DisplayCompositor has completed generating a new 70 // This is called after the CompositorFrameSink has completed generating a new
68 // frame for the display. TODO(fsamuel): Idle time processing should happen 71 // frame for the display. TODO(fsamuel): Idle time processing should happen
69 // here if there is budget for it. 72 // here if there is budget for it.
70 void DidDraw(); 73 void DidDraw();
71 74
72 // Generates the CompositorFrame for the current |dirty_rect_|. 75 // Generates the CompositorFrame for the current |dirty_rect_|.
73 cc::CompositorFrame GenerateCompositorFrame( 76 cc::CompositorFrame GenerateCompositorFrame(
74 const gfx::Rect& output_rect) const; 77 const gfx::Rect& output_rect) const;
75 78
76 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad 79 // DrawWindowTree recursively visits ServerWindows, creating a SurfaceDrawQuad
77 // for each that lacks one. 80 // for each that lacks one.
78 void DrawWindowTree(cc::RenderPass* pass, 81 void DrawWindowTree(cc::RenderPass* pass,
79 ServerWindow* window, 82 ServerWindow* window,
80 const gfx::Vector2d& parent_to_root_origin_offset, 83 const gfx::Vector2d& parent_to_root_origin_offset,
81 float opacity, 84 float opacity,
82 bool* may_contain_video) const; 85 bool* may_contain_video) const;
83 86
84 FrameGeneratorDelegate* delegate_; 87 FrameGeneratorDelegate* delegate_;
85 scoped_refptr<SurfacesState> surfaces_state_; 88 scoped_refptr<DisplayCompositor> display_compositor_;
86 scoped_refptr<gpu::GpuChannelHost> gpu_channel_; 89 scoped_refptr<gpu::GpuChannelHost> gpu_channel_;
87 90
88 std::unique_ptr<DisplayCompositor> display_compositor_; 91 std::unique_ptr<surfaces::CompositorFrameSink> compositor_frame_sink_;
89 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget; 92 gfx::AcceleratedWidget widget_ = gfx::kNullAcceleratedWidget;
90 93
91 // The region that needs to be redrawn next time the compositor frame is 94 // The region that needs to be redrawn next time the compositor frame is
92 // generated. 95 // generated.
93 gfx::Rect dirty_rect_; 96 gfx::Rect dirty_rect_;
94 base::Timer draw_timer_; 97 base::Timer draw_timer_;
95 bool frame_pending_ = false; 98 bool frame_pending_ = false;
96 bool may_contain_video_ = false; 99 bool may_contain_video_ = false;
97 100
98 base::WeakPtrFactory<FrameGenerator> weak_factory_; 101 base::WeakPtrFactory<FrameGenerator> weak_factory_;
99 102
100 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 103 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
101 }; 104 };
102 105
103 } // namespace ws 106 } // namespace ws
104 107
105 } // namespace ui 108 } // namespace ui
106 109
107 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 110 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « services/ui/ws/display_unittest.cc ('k') | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698