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

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

Issue 2890913002: Add CompositorFrameSinkClientBinding To Be Used By FrameGenerator (Closed)
Patch Set: virtual destructor 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/ipc/mojo_compositor_frame_sink.mojom.h"
11 #include "cc/output/compositor_frame.h" 12 #include "cc/output/compositor_frame.h"
12 #include "cc/output/compositor_frame_sink_client.h" 13 #include "cc/output/compositor_frame_sink_client.h"
13 #include "cc/scheduler/begin_frame_source.h" 14 #include "cc/scheduler/begin_frame_source.h"
15 #include "cc/surfaces/local_surface_id_allocator.h"
14 #include "cc/surfaces/surface_id.h" 16 #include "cc/surfaces/surface_id.h"
15 #include "cc/surfaces/surface_info.h" 17 #include "cc/surfaces/surface_info.h"
18 #include "services/ui/ws/compositor_frame_sink_client_binding.h"
16 #include "ui/gfx/geometry/rect.h" 19 #include "ui/gfx/geometry/rect.h"
17 20
18 namespace cc { 21 namespace cc {
19 class CompositorFrameSink;
20 class RenderPass; 22 class RenderPass;
21 } 23 }
22 24
23 namespace ui { 25 namespace ui {
24 namespace ws { 26 namespace ws {
25 27
26 // Responsible for redrawing the display in response to the redraw requests by 28 // Responsible for redrawing the display in response to the redraw requests by
27 // submitting CompositorFrames to the owned CompositorFrameSink. 29 // submitting CompositorFrames to the owned CompositorFrameSink.
28 class FrameGenerator : public cc::CompositorFrameSinkClient, 30 class FrameGenerator : public cc::mojom::MojoCompositorFrameSinkClient {
29 public cc::BeginFrameObserver {
30 public: 31 public:
31 explicit FrameGenerator( 32 FrameGenerator();
32 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink);
33 ~FrameGenerator() override; 33 ~FrameGenerator() override;
34 34
35 void SetDeviceScaleFactor(float device_scale_factor); 35 void SetDeviceScaleFactor(float device_scale_factor);
36 void SetHighContrastMode(bool enabled); 36 void SetHighContrastMode(bool enabled);
37 37
38 // Updates the WindowManager's SurfaceInfo. 38 // Updates the WindowManager's SurfaceInfo.
39 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info); 39 void OnSurfaceCreated(const cc::SurfaceInfo& surface_info);
40 40
41 void OnWindowDamaged(); 41 void OnWindowDamaged();
42 void OnWindowSizeChanged(const gfx::Size& pixel_size); 42 void OnWindowSizeChanged(const gfx::Size& pixel_size);
43 void Bind(std::unique_ptr<CompositorFrameSinkClientBinding> binding);
43 44
44 private: 45 private:
45 // cc::CompositorFrameSinkClient implementation: 46 // cc::mojom::MojoCompositorFrameSinkClient implementation:
46 void SetBeginFrameSource(cc::BeginFrameSource* source) override; 47 void DidReceiveCompositorFrameAck(
48 const cc::ReturnedResourceArray& resources) override;
49 void OnBeginFrame(const cc::BeginFrameArgs& args) override;
47 void ReclaimResources(const cc::ReturnedResourceArray& resources) override; 50 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 51
64 // Generates the CompositorFrame. 52 // Generates the CompositorFrame.
65 cc::CompositorFrame GenerateCompositorFrame(); 53 cc::CompositorFrame GenerateCompositorFrame();
66 54
67 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to 55 // DrawWindow creates SurfaceDrawQuad for the window manager and appends it to
68 // the provided cc::RenderPass. 56 // the provided cc::RenderPass.
69 void DrawWindow(cc::RenderPass* pass); 57 void DrawWindow(cc::RenderPass* pass);
70 58
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);
74
75 float device_scale_factor_ = 1.f; 59 float device_scale_factor_ = 1.f;
76 gfx::Size pixel_size_; 60 gfx::Size pixel_size_;
77 61
78 std::unique_ptr<cc::CompositorFrameSink> compositor_frame_sink_; 62 std::unique_ptr<CompositorFrameSinkClientBinding> client_binding_;
79 cc::BeginFrameArgs last_begin_frame_args_; 63 cc::BeginFrameArgs last_begin_frame_args_;
80 cc::BeginFrameAck current_begin_frame_ack_; 64 cc::BeginFrameAck current_begin_frame_ack_;
81 cc::BeginFrameSource* begin_frame_source_ = nullptr; 65 cc::LocalSurfaceId local_surface_id_;
82 bool observing_begin_frames_ = false; 66 cc::LocalSurfaceIdAllocator id_allocator_;
Fady Samuel 2017/05/17 20:11:43 Nothing uses these?
Alex Z. 2017/05/17 20:21:17 Done.
83 bool high_contrast_mode_enabled_ = false; 67 bool high_contrast_mode_enabled_ = false;
68 gfx::Size last_submitted_frame_size_;
Fady Samuel 2017/05/17 20:11:43 Nothing uses this?
Alex Z. 2017/05/17 20:21:17 Done.
84 69
85 cc::SurfaceInfo window_manager_surface_info_; 70 cc::SurfaceInfo window_manager_surface_info_;
86 71
87 DISALLOW_COPY_AND_ASSIGN(FrameGenerator); 72 DISALLOW_COPY_AND_ASSIGN(FrameGenerator);
88 }; 73 };
89 74
90 } // namespace ws 75 } // namespace ws
91 76
92 } // namespace ui 77 } // namespace ui
93 78
94 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_ 79 #endif // SERVICES_UI_WS_FRAME_GENERATOR_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698