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

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

Issue 2651843002: FrameGenerator should receive SurfaceInfo and use it in frame generation (Closed)
Patch Set: c Created 3 years, 11 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.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 "cc/ipc/display_compositor.mojom.h" 12 #include "cc/ipc/display_compositor.mojom.h"
13 #include "cc/surfaces/frame_sink_id.h" 13 #include "cc/surfaces/frame_sink_id.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_id_allocator.h" 15 #include "cc/surfaces/surface_id_allocator.h"
16 #include "cc/surfaces/surface_reference.h" 16 #include "cc/surfaces/surface_reference.h"
17 #include "services/ui/public/interfaces/window_tree_constants.mojom.h" 17 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
18 #include "services/ui/ws/ids.h" 18 #include "services/ui/ws/ids.h"
19 #include "services/ui/ws/server_window_delegate.h" 19 #include "services/ui/ws/server_window_delegate.h"
20 #include "services/ui/ws/server_window_tracker.h" 20 #include "services/ui/ws/server_window_tracker.h"
21 #include "ui/gfx/geometry/rect.h" 21 #include "ui/gfx/geometry/rect.h"
22 #include "ui/gfx/native_widget_types.h" 22 #include "ui/gfx/native_widget_types.h"
23 23
24 namespace cc { 24 namespace cc {
25 class RenderPass; 25 class RenderPass;
26 class SurfaceId;
27 } 26 }
28 27
29 namespace ui { 28 namespace ui {
30 namespace ws { 29 namespace ws {
31 30
32 namespace test { 31 namespace test {
33 class FrameGeneratorTest; 32 class FrameGeneratorTest;
34 } 33 }
35 34
36 class FrameGeneratorDelegate; 35 class FrameGeneratorDelegate;
37 class ServerWindow; 36 class ServerWindow;
38 37
39 // Responsible for redrawing the display in response to the redraw requests by 38 // Responsible for redrawing the display in response to the redraw requests by
40 // submitting CompositorFrames to the owned CompositorFrameSink. 39 // submitting CompositorFrames to the owned CompositorFrameSink.
41 class FrameGenerator : public ServerWindowTracker, 40 class FrameGenerator : public cc::mojom::MojoCompositorFrameSinkClient {
42 public cc::mojom::MojoCompositorFrameSinkClient {
43 public: 41 public:
44 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 42 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
45 ~FrameGenerator() override; 43 ~FrameGenerator() override;
46 44
47 void set_device_scale_factor(float device_scale_factor) { 45 void SetDeviceScaleFactor(float device_scale_factor);
48 device_scale_factor_ = device_scale_factor;
49 }
50 46
51 // Schedules a redraw for the provided region. 47 // Schedules a redraw for the provided region.
52 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 48 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
53 49
54 // If |window| corresponds to the active WM for the display then update 50 // Updates the WindowManager's SurfaceInfo.
55 // |window_manager_surface_id_|. 51 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
56 void OnSurfaceCreated(const cc::SurfaceId& surface_id, ServerWindow* window);
57 52
58 private: 53 private:
59 friend class ui::ws::test::FrameGeneratorTest; 54 friend class ui::ws::test::FrameGeneratorTest;
60 55
61 // cc::mojom::MojoCompositorFrameSinkClient implementation: 56 // cc::mojom::MojoCompositorFrameSinkClient implementation:
62 void DidReceiveCompositorFrameAck() override; 57 void DidReceiveCompositorFrameAck() override;
63 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override; 58 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override;
64 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 59 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
65 void WillDrawSurface() override; 60 void WillDrawSurface() override;
66 61
67 // Generates the CompositorFrame. 62 // Generates the CompositorFrame.
68 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 63 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect);
69 64
70 // DrawWindow creates SurfaceDrawQuad for the provided ServerWindow and 65 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to
71 // appends it to the provided cc::RenderPass. 66 // the provided cc::RenderPass.
72 void DrawWindow(cc::RenderPass* pass, ServerWindow* window); 67 void DrawWindow(cc::RenderPass* pass);
73
74 // ServerWindowObserver implementation.
75 void OnWindowDestroying(ServerWindow* window) override;
76 68
77 FrameGeneratorDelegate* delegate_; 69 FrameGeneratorDelegate* delegate_;
78 ServerWindow* const root_window_; 70 ServerWindow* const root_window_;
79 float device_scale_factor_ = 1.f; 71 float device_scale_factor_ = 1.f;
80 72
81 gfx::Size last_submitted_frame_size_; 73 gfx::Size last_submitted_frame_size_;
82 cc::LocalFrameId local_frame_id_; 74 cc::LocalFrameId local_frame_id_;
83 cc::SurfaceIdAllocator id_allocator_; 75 cc::SurfaceIdAllocator id_allocator_;
84 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink_; 76 cc::mojom::MojoCompositorFrameSinkAssociatedPtr compositor_frame_sink_;
85 cc::mojom::DisplayPrivateAssociatedPtr display_private_; 77 cc::mojom::DisplayPrivateAssociatedPtr display_private_;
86 78
87 cc::SurfaceId window_manager_surface_id_; 79 cc::SurfaceInfo window_manager_surface_info_;
88 80
89 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; 81 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
90 82
91 base::WeakPtrFactory<FrameGenerator> weak_factory_; 83 base::WeakPtrFactory<FrameGenerator> weak_factory_;
92 84
93 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 85 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
94 }; 86 };
95 87
96 } // namespace ws 88 } // namespace ws
97 89
98 } // namespace ui 90 } // namespace ui
99 91
100 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 92 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « services/ui/ws/display.cc ('k') | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698