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

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

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

Powered by Google App Engine
This is Rietveld 408576698