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

Side by Side Diff: cc/surfaces/compositor_frame_sink_support.h

Issue 2612083002: DirectCompositorFrameSink Uses CompositorFrameSinkSupport (Closed)
Patch Set: CompositorFrameSinkSupport takes a flag indicating if it's supporting a DirectCompositorFrameSink Created 3 years, 11 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 | cc/surfaces/compositor_frame_sink_support.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 CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 5 #ifndef CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 6 #define CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
7 7
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "cc/output/compositor_frame.h" 10 #include "cc/output/compositor_frame.h"
11 #include "cc/scheduler/begin_frame_source.h" 11 #include "cc/scheduler/begin_frame_source.h"
12 #include "cc/surfaces/display.h" 12 #include "cc/surfaces/display.h"
13 #include "cc/surfaces/display_client.h" 13 #include "cc/surfaces/display_client.h"
14 #include "cc/surfaces/surface_factory.h" 14 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h" 15 #include "cc/surfaces/surface_factory_client.h"
16 #include "cc/surfaces/surfaces_export.h" 16 #include "cc/surfaces/surfaces_export.h"
17 17
18 namespace cc { 18 namespace cc {
19 19
20 class CompositorFrameSinkSupportClient; 20 class CompositorFrameSinkSupportClient;
21 class Display; 21 class Display;
22 class SurfaceManager; 22 class SurfaceManager;
23 23
24 class CC_SURFACES_EXPORT CompositorFrameSinkSupport 24 class CC_SURFACES_EXPORT CompositorFrameSinkSupport
25 : public NON_EXPORTED_BASE(DisplayClient), 25 : public NON_EXPORTED_BASE(DisplayClient),
26 public SurfaceFactoryClient, 26 public SurfaceFactoryClient,
27 public BeginFrameObserver { 27 public BeginFrameObserver {
28 public: 28 public:
29 CompositorFrameSinkSupport( 29 CompositorFrameSinkSupport(CompositorFrameSinkSupportClient* client,
30 CompositorFrameSinkSupportClient* client, 30 SurfaceManager* surface_manager,
31 SurfaceManager* surface_manager, 31 const FrameSinkId& frame_sink_id,
32 const FrameSinkId& frame_sink_id, 32 Display* display,
33 std::unique_ptr<Display> display, 33 bool direct_compositor_frame_sink);
Fady Samuel 2017/01/25 13:56:04 not lgtm. Please note that contradicts the directi
Alex Z. 2017/01/25 14:25:38 Yes, I added this before we talked on Monday. I'm
34 std::unique_ptr<BeginFrameSource> display_begin_frame_source);
35 34
36 ~CompositorFrameSinkSupport() override; 35 ~CompositorFrameSinkSupport() override;
37 36
38 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } 37 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
39 38
40 void EvictFrame(); 39 void EvictFrame();
41 void SetNeedsBeginFrame(bool needs_begin_frame); 40 void SetNeedsBeginFrame(bool needs_begin_frame);
42 void SubmitCompositorFrame(const LocalFrameId& local_frame_id, 41 void SubmitCompositorFrame(const LocalFrameId& local_frame_id,
43 CompositorFrame frame); 42 CompositorFrame frame);
44 void Require(const LocalFrameId& local_frame_id, 43 void Require(const LocalFrameId& local_frame_id,
45 const SurfaceSequence& sequence); 44 const SurfaceSequence& sequence);
46 void Satisfy(const SurfaceSequence& sequence); 45 void Satisfy(const SurfaceSequence& sequence);
47 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id); 46 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id);
48 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id); 47 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id);
48 void SetNeedsSyncPoints(bool needs_sync_points);
49 void ForceReclaimResources();
49 50
50 Display* display() { return display_.get(); } 51 Display* display() { return display_; }
51 52
52 private: 53 private:
53 void DidReceiveCompositorFrameAck(); 54 void DidReceiveCompositorFrameAck();
54 55
55 // DisplayClient implementation. 56 // DisplayClient implementation.
56 void DisplayOutputSurfaceLost() override; 57 void DisplayOutputSurfaceLost() override;
57 void DisplayWillDrawAndSwap(bool will_draw_and_swap, 58 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
58 const RenderPassList& render_passes) override; 59 const RenderPassList& render_passes) override;
59 void DisplayDidDrawAndSwap() override; 60 void DisplayDidDrawAndSwap() override;
60 61
61 // SurfaceFactoryClient implementation. 62 // SurfaceFactoryClient implementation.
62 void ReturnResources(const ReturnedResourceArray& resources) override; 63 void ReturnResources(const ReturnedResourceArray& resources) override;
63 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override; 64 void SetBeginFrameSource(BeginFrameSource* begin_frame_source) override;
64 void WillDrawSurface(const LocalFrameId& local_frame_id, 65 void WillDrawSurface(const LocalFrameId& local_frame_id,
65 const gfx::Rect& damage_rect) override; 66 const gfx::Rect& damage_rect) override;
66 67
67 // BeginFrameObserver implementation. 68 // BeginFrameObserver implementation.
68 void OnBeginFrame(const BeginFrameArgs& args) override; 69 void OnBeginFrame(const BeginFrameArgs& args) override;
69 const BeginFrameArgs& LastUsedBeginFrameArgs() const override; 70 const BeginFrameArgs& LastUsedBeginFrameArgs() const override;
70 void OnBeginFrameSourcePausedChanged(bool paused) override; 71 void OnBeginFrameSourcePausedChanged(bool paused) override;
71 72
72 void UpdateNeedsBeginFramesInternal(); 73 void UpdateNeedsBeginFramesInternal();
73 74
74 CompositorFrameSinkSupportClient* const client_; 75 CompositorFrameSinkSupportClient* const client_;
75 76
76 SurfaceManager* const surface_manager_; 77 SurfaceManager* const surface_manager_;
77 78
78 const FrameSinkId frame_sink_id_; 79 const FrameSinkId frame_sink_id_;
79 80
80 // GpuCompositorFrameSink holds a Display and its BeginFrameSource if it 81 Display* display_;
81 // created with non-null gpu::SurfaceHandle. In the window server, the display
82 // root window's CompositorFrameSink will have a valid gpu::SurfaceHandle.
83 std::unique_ptr<BeginFrameSource> display_begin_frame_source_;
84 std::unique_ptr<Display> display_;
85 82
86 LocalFrameId local_frame_id_; 83 LocalFrameId local_frame_id_;
87 SurfaceFactory surface_factory_; 84 SurfaceFactory surface_factory_;
88 // Counts the number of CompositorFrames that have been submitted and have not 85 // Counts the number of CompositorFrames that have been submitted and have not
89 // yet received an ACK. 86 // yet received an ACK.
90 int ack_pending_count_ = 0; 87 int ack_pending_count_ = 0;
91 ReturnedResourceArray surface_returned_resources_; 88 ReturnedResourceArray surface_returned_resources_;
92 89
93 // The begin frame source being observered. Null if none. 90 // The begin frame source being observered. Null if none.
94 BeginFrameSource* begin_frame_source_ = nullptr; 91 BeginFrameSource* begin_frame_source_ = nullptr;
95 92
96 // The last begin frame args generated by the begin frame source. 93 // The last begin frame args generated by the begin frame source.
97 BeginFrameArgs last_begin_frame_args_; 94 BeginFrameArgs last_begin_frame_args_;
98 95
99 // Whether a request for begin frames has been issued. 96 // Whether a request for begin frames has been issued.
100 bool needs_begin_frame_ = false; 97 bool needs_begin_frame_ = false;
101 98
102 // Whether or not a frame observer has been added. 99 // Whether or not a frame observer has been added.
103 bool added_frame_observer_ = false; 100 bool added_frame_observer_ = false;
104 101
105 // The set of BeginFrame children of this CompositorFrameSink. 102 // The set of BeginFrame children of this CompositorFrameSink.
106 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; 103 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_;
107 104
105 bool direct_compositor_frame_sink_ = false;
106
108 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 107 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
109 108
110 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 109 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
111 }; 110 };
112 111
113 } // namespace cc 112 } // namespace cc
114 113
115 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 114 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_
OLDNEW
« no previous file with comments | « no previous file | cc/surfaces/compositor_frame_sink_support.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698