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

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

Issue 2763143002: Remove FrameGenerator::root_window_ (Closed)
Patch Set: Addressed nits Created 3 years, 9 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 "cc/output/compositor_frame.h"
12 #include "cc/ipc/display_compositor.mojom.h"
13 #include "cc/output/compositor_frame_sink_client.h" 12 #include "cc/output/compositor_frame_sink_client.h"
14 #include "cc/scheduler/begin_frame_source.h" 13 #include "cc/scheduler/begin_frame_source.h"
15 #include "cc/surfaces/frame_sink_id.h"
16 #include "cc/surfaces/local_surface_id_allocator.h"
17 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
18 #include "cc/surfaces/surface_reference.h" 15 #include "cc/surfaces/surface_info.h"
19 #include "services/ui/public/interfaces/window_tree_constants.mojom.h"
20 #include "ui/gfx/geometry/rect.h" 16 #include "ui/gfx/geometry/rect.h"
21 #include "ui/gfx/native_widget_types.h"
22 17
23 namespace cc { 18 namespace cc {
24 class CompositorFrameSink; 19 class CompositorFrameSink;
25 class RenderPass; 20 class RenderPass;
26 } 21 }
27 22
28 namespace ui { 23 namespace ui {
29 namespace ws { 24 namespace ws {
30 25
31 class ServerWindow;
32
33 // Responsible for redrawing the display in response to the redraw requests by 26 // Responsible for redrawing the display in response to the redraw requests by
34 // submitting CompositorFrames to the owned CompositorFrameSink. 27 // submitting CompositorFrames to the owned CompositorFrameSink.
35 class FrameGenerator : public cc::CompositorFrameSinkClient, 28 class FrameGenerator : public cc::CompositorFrameSinkClient,
36 public cc::BeginFrameObserver { 29 public cc::BeginFrameObserver {
37 public: 30 public:
38 FrameGenerator( 31 explicit FrameGenerator(
39 ServerWindow* root_window,
40 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink); 32 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink);
41 ~FrameGenerator() override; 33 ~FrameGenerator() override;
42 34
43 void SetDeviceScaleFactor(float device_scale_factor); 35 void SetDeviceScaleFactor(float device_scale_factor);
44 void SetHighContrastMode(bool enabled); 36 void SetHighContrastMode(bool enabled);
45 37
46 // Updates the WindowManager's SurfaceInfo. 38 // Updates the WindowManager's SurfaceInfo.
47 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); 39 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
48 40
49 void OnWindowDamaged(); 41 void OnWindowDamaged();
42 void OnWindowVisibilityChanged(bool visible);
43 void OnWindowBoundsChanged(const gfx::Rect& bounds);
50 44
51 private: 45 private:
52 // cc::CompositorFrameSinkClient implementation: 46 // cc::CompositorFrameSinkClient implementation:
53 void SetBeginFrameSource(cc::BeginFrameSource* source) override; 47 void SetBeginFrameSource(cc::BeginFrameSource* source) override;
54 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 48 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
55 void SetTreeActivationCallback(const base::Closure& callback) override; 49 void SetTreeActivationCallback(const base::Closure& callback) override;
56 void DidReceiveCompositorFrameAck() override; 50 void DidReceiveCompositorFrameAck() override;
57 void DidLoseCompositorFrameSink() override; 51 void DidLoseCompositorFrameSink() override;
58 void OnDraw(const gfx::Transform& transform, 52 void OnDraw(const gfx::Transform& transform,
59 const gfx::Rect& viewport, 53 const gfx::Rect& viewport,
60 bool resourceless_software_draw) override; 54 bool resourceless_software_draw) override;
61 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override; 55 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
62 void SetExternalTilePriorityConstraints( 56 void SetExternalTilePriorityConstraints(
63 const gfx::Rect& viewport_rect, 57 const gfx::Rect& viewport_rect,
64 const gfx::Transform& transform) override; 58 const gfx::Transform& transform) override;
65 59
66 // cc::BeginFrameObserver implementation: 60 // cc::BeginFrameObserver implementation:
67 void OnBeginFrame(const cc::BeginFrameArgs& args) override; 61 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
68 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override; 62 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
69 void OnBeginFrameSourcePausedChanged(bool paused) override; 63 void OnBeginFrameSourcePausedChanged(bool paused) override;
70 64
71 // Generates the CompositorFrame. 65 // Generates the CompositorFrame.
72 cc::CompositorFrame GenerateCompositorFrame(const gfx::Rect& output_rect); 66 cc::CompositorFrame GenerateCompositorFrame();
73 67
74 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to 68 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to
75 // the provided cc::RenderPass. 69 // the provided cc::RenderPass.
76 void DrawWindow(cc::RenderPass* pass); 70 void DrawWindow(cc::RenderPass* pass);
77 71
78 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove 72 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove
79 // FrameGenerator as an observer to/from begin_frame_source_ accordingly. 73 // FrameGenerator as an observer to/from begin_frame_source_ accordingly.
80 void SetNeedsBeginFrame(bool needs_begin_frame); 74 void SetNeedsBeginFrame(bool needs_begin_frame);
81 75
82 ServerWindow* const root_window_;
83 float device_scale_factor_ = 1.f; 76 float device_scale_factor_ = 1.f;
77 bool is_window_visible_ = false;
78 gfx::Rect bounds_;
84 79
85 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_; 80 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_;
86 cc::BeginFrameArgs last_begin_frame_args_; 81 cc::BeginFrameArgs last_begin_frame_args_;
87 cc::BeginFrameAck current_begin_frame_ack_; 82 cc::BeginFrameAck current_begin_frame_ack_;
88 cc::BeginFrameSource* begin_frame_source_ = nullptr; 83 cc::BeginFrameSource* begin_frame_source_ = nullptr;
89 bool observing_begin_frames_ = false; 84 bool observing_begin_frames_ = false;
90 bool high_contrast_mode_enabled_ = false; 85 bool high_contrast_mode_enabled_ = false;
91 86
92 cc::SurfaceInfo window_manager_surface_info_; 87 cc::SurfaceInfo window_manager_surface_info_;
93 88
94 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 89 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
95 }; 90 };
96 91
97 } // namespace ws 92 } // namespace ws
98 93
99 } // namespace ui 94 } // namespace ui
100 95
101 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 96 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « no previous file | services/ui/ws/frame_generator.cc » ('j') | services/ui/ws/platform_display_default.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698