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

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

Issue 2890913002: Add CompositorFrameSinkClientBinding To Be Used By FrameGenerator (Closed)
Patch Set: Remove redundant SetNeedsBeginFrame Created 3 years, 7 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 "cc/output/compositor_frame.h" 11 #include "cc/ipc/mojo_compositor_frame_sink.mojom.h"
12 #include "cc/output/compositor_frame_sink_client.h"
13 #include "cc/scheduler/begin_frame_source.h" 12 #include "cc/scheduler/begin_frame_source.h"
13 #include "cc/surfaces/local_surface_id_allocator.h"
14 #include "cc/surfaces/surface_id.h" 14 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_info.h" 15 #include "cc/surfaces/surface_info.h"
16 #include "services/ui/ws/compositor_frame_sink_client_binding.h"
16 #include "ui/gfx/geometry/rect.h" 17 #include "ui/gfx/geometry/rect.h"
17 18
18 namespace cc { 19 namespace cc {
19 class CompositorFrameSink;
20 class RenderPass; 20 class RenderPass;
21 } 21 }
22 22
23 namespace ui { 23 namespace ui {
24 namespace ws { 24 namespace ws {
25 25
26 // 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
27 // submitting CompositorFrames to the owned CompositorFrameSink. 27 // submitting CompositorFrames to the owned CompositorFrameSink.
28 class FrameGenerator : public cc::CompositorFrameSinkClient, 28 class FrameGenerator : public cc::mojom::MojoCompositorFrameSinkClient {
29 public cc::BeginFrameObserver {
30 public: 29 public:
31 explicit FrameGenerator( 30 FrameGenerator();
32 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink);
33 ~FrameGenerator() override; 31 ~FrameGenerator() override;
34 32
35 void SetDeviceScaleFactor(float device_scale_factor); 33 void SetDeviceScaleFactor(float device_scale_factor);
36 void SetHighContrastMode(bool enabled); 34 void SetHighContrastMode(bool enabled);
37 35
38 // Updates the WindowManager's SurfaceInfo. 36 // Updates the WindowManager's SurfaceInfo.
39 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); 37 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
40 38
41 void OnWindowDamaged(); 39 void OnWindowDamaged();
42 void OnWindowSizeChanged(const gfx::Size& pixel_size); 40 void OnWindowSizeChanged(const gfx::Size& pixel_size);
41 void Bind(std::unique_ptr<cc::mojom::MojoCompositorFrameSink>
42 compositor_frame_sink);
43 43
44 private: 44 private:
45 // cc::CompositorFrameSinkClient implementation: 45 // cc::mojom::MojoCompositorFrameSinkClient implementation:
46 void SetBeginFrameSource(cc::BeginFrameSource* source) override; 46 void DidReceiveCompositorFrameAck(
47 const cc::ReturnedResourceArray& resources) override;
48 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
47 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 49 void ReclaimResources(const cc::ReturnedResourceArray& resources) override;
48 void SetTreeActivationCallback(const base::Closure& callback) override;
49 void DidReceiveCompositorFrameAck() override;
50 void DidLoseCompositorFrameSink() override;
51 void OnDraw(const gfx::Transform& transform,
52 const gfx::Rect& viewport,
53 bool resourceless_software_draw) override;
54 void SetMemoryPolicy(const cc::ManagedMemoryPolicy& policy) override;
55 void SetExternalTilePriorityConstraints(
56 const gfx::Rect& viewport_rect,
57 const gfx::Transform& transform) override;
58
59 // cc::BeginFrameObserver implementation:
60 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
61 const cc::BeginFrameArgs& LastUsedBeginFrameArgs() const override;
62 void OnBeginFrameSourcePausedChanged(bool paused) override;
63 50
64 // Generates the CompositorFrame. 51 // Generates the CompositorFrame.
65 cc::CompositorFrame GenerateCompositorFrame(); 52 cc::CompositorFrame GenerateCompositorFrame();
66 53
67 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to 54 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to
68 // the provided cc::RenderPass. 55 // the provided cc::RenderPass.
69 void DrawWindow(cc::RenderPass* pass); 56 void DrawWindow(cc::RenderPass* pass);
70 57
71 // SetNeedsBeginFrame sets observing_begin_frames_ and add/remove
72 // FrameGenerator as an observer to/from begin_frame_source_ accordingly.
73 void SetNeedsBeginFrame(bool needs_begin_frame); 58 void SetNeedsBeginFrame(bool needs_begin_frame);
74 59
75 float device_scale_factor_ = 1.f; 60 float device_scale_factor_ = 1.f;
76 gfx::Size pixel_size_; 61 gfx::Size pixel_size_;
77 62
78 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_; 63 std::unique_ptr<cc::mojom::MojoCompositorFrameSink> compositor_frame_sink_;
79 cc::BeginFrameArgs last_begin_frame_args_; 64 cc::BeginFrameArgs last_begin_frame_args_;
80 cc::BeginFrameAck current_begin_frame_ack_; 65 cc::BeginFrameAck current_begin_frame_ack_;
81 cc::BeginFrameSource* begin_frame_source_ = nullptr;
82 bool observing_begin_frames_ = false;
83 bool high_contrast_mode_enabled_ = false; 66 bool high_contrast_mode_enabled_ = false;
67 gfx::Size last_submitted_frame_size_;
68 cc::LocalSurfaceId local_surface_id_;
69 cc::LocalSurfaceIdAllocator id_allocator_;
70 float last_device_scale_factor_ = 0.0f;
84 71
85 cc::SurfaceInfo window_manager_surface_info_; 72 cc::SurfaceInfo window_manager_surface_info_;
86 73
87 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 74 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
88 }; 75 };
89 76
90 } // namespace ws 77 } // namespace ws
91 78
92 } // namespace ui 79 } // namespace ui
93 80
94 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 81 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW
« no previous file with comments | « services/ui/ws/display_client_compositor_frame_sink.cc ('k') | services/ui/ws/frame_generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698