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

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
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 ServerWindowTracker,
Fady Samuel 2017/01/24 02:52:32 FrameGenerator doesn't need to be a ServerWindowTr
Saman Sami 2017/01/24 20:29:58 Done.
42 public cc::mojom::MojoCompositorFrameSinkClient { 41 public cc::mojom::MojoCompositorFrameSinkClient {
43 public: 42 public:
44 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window); 43 FrameGenerator(FrameGeneratorDelegate* delegate, ServerWindow* root_window);
45 ~FrameGenerator() override; 44 ~FrameGenerator() override;
46 45
47 void set_device_scale_factor(float device_scale_factor) { 46 void set_device_scale_factor(float device_scale_factor) {
Fady Samuel 2017/01/24 02:52:32 set_device_scale_factor => SetDeviceScaleFactor an
Saman Sami 2017/01/24 20:29:59 Done.
48 device_scale_factor_ = device_scale_factor; 47 device_scale_factor_ = device_scale_factor;
49 } 48 }
50 49
51 // Schedules a redraw for the provided region. 50 // Schedules a redraw for the provided region.
52 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget); 51 void OnAcceleratedWidgetAvailable(gfx::AcceleratedWidget widget);
53 52
54 // If |window| corresponds to the active WM for the display then update 53 // Updates the WindowManager's SurfaceInfo.
55 // |window_manager_surface_id_|. 54 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
56 void OnSurfaceCreated(const cc::SurfaceId& surface_id, ServerWindow* window);
57 55
58 private: 56 private:
59 friend class ui::ws::test::FrameGeneratorTest; 57 friend class ui::ws::test::FrameGeneratorTest;
60 58
61 // cc::mojom::MojoCompositorFrameSinkClient implementation: 59 // cc::mojom::MojoCompositorFrameSinkClient implementation:
62 void DidReceiveCompositorFrameAck() override; 60 void DidReceiveCompositorFrameAck() override;
63 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override; 61 void OnBeginFrame(const cc::BeginFrameArgs& begin_frame_arags) override;
64 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 62 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
65 void WillDrawSurface() override; 63 void WillDrawSurface() override;
66 64
67 // Generates the CompositorFrame. 65 // Generates the CompositorFrame.
68 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 66 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect);
69 67
70 // DrawWindow creates SurfaceDrawQuad for the provided ServerWindow and 68 // DrawWindow creates SurfaceDrawQuad for the provided ServerWindow and
71 // appends it to the provided cc::RenderPass. 69 // appends it to the provided cc::RenderPass.
72 void DrawWindow(cc::RenderPass* pass, ServerWindow* window); 70 void DrawWindow(cc::RenderPass* pass, ServerWindow* window);
Fady Samuel 2017/01/24 02:52:32 DrawWindow doesn't need to take in a ServerWindow.
Saman Sami 2017/01/24 20:29:58 Done.
73 71
74 // ServerWindowObserver implementation. 72 // ServerWindowObserver implementation.
Fady Samuel 2017/01/24 02:52:32 Delete this.
Saman Sami 2017/01/24 20:29:58 Done.
75 void OnWindowDestroying(ServerWindow* window) override; 73 void OnWindowDestroying(ServerWindow* window) override;
Fady Samuel 2017/01/24 02:52:32 Delete this.
Saman Sami 2017/01/24 20:29:58 Done.
76 74
77 FrameGeneratorDelegate* delegate_; 75 FrameGeneratorDelegate* delegate_;
78 ServerWindow* const root_window_; 76 ServerWindow* const root_window_;
79 float device_scale_factor_ = 1.f; 77 float device_scale_factor_ = 1.f;
80 78
81 gfx::Size last_submitted_frame_size_; 79 gfx::Size last_submitted_frame_size_;
82 cc::LocalFrameId local_frame_id_; 80 cc::LocalFrameId local_frame_id_;
83 cc::SurfaceIdAllocator id_allocator_; 81 cc::SurfaceIdAllocator id_allocator_;
84 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_; 82 cc::mojom::MojoCompositorFrameSinkPtr compositor_frame_sink_;
85 cc::mojom::DisplayPrivatePtr display_private_; 83 cc::mojom::DisplayPrivatePtr display_private_;
86 84
87 cc::SurfaceId window_manager_surface_id_; 85 cc::SurfaceInfo window_manager_surface_info_;
88 86
89 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_; 87 mojo::Binding<cc::mojom::MojoCompositorFrameSinkClient> binding_;
90 88
91 base::WeakPtrFactory<FrameGenerator> weak_factory_; 89 base::WeakPtrFactory<FrameGenerator> weak_factory_;
92 90
93 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 91 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
94 }; 92 };
95 93
96 } // namespace ws 94 } // namespace ws
97 95
98 } // namespace ui 96 } // namespace ui
99 97
100 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 98 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698