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

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

Powered by Google App Engine
This is Rietveld 408576698