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

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

Issue 2687433002: Move surface reference code to CompositorFrameSinkSupport. (Closed)
Patch Set: Revert to patch 2 to reland. Created 3 years, 10 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 <memory>
9 #include <unordered_set>
10
8 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
9 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
10 #include "cc/output/compositor_frame.h" 13 #include "cc/output/compositor_frame.h"
11 #include "cc/scheduler/begin_frame_source.h" 14 #include "cc/scheduler/begin_frame_source.h"
12 #include "cc/surfaces/display.h" 15 #include "cc/surfaces/display.h"
13 #include "cc/surfaces/display_client.h" 16 #include "cc/surfaces/display_client.h"
17 #include "cc/surfaces/referenced_surface_tracker.h"
14 #include "cc/surfaces/surface_factory.h" 18 #include "cc/surfaces/surface_factory.h"
15 #include "cc/surfaces/surface_factory_client.h" 19 #include "cc/surfaces/surface_factory_client.h"
20 #include "cc/surfaces/surface_id.h"
16 #include "cc/surfaces/surfaces_export.h" 21 #include "cc/surfaces/surfaces_export.h"
17 22
18 namespace cc { 23 namespace cc {
19 24
20 class CompositorFrameSinkSupportClient; 25 class CompositorFrameSinkSupportClient;
21 class Display; 26 class Display;
22 class SurfaceManager; 27 class SurfaceManager;
23 28
24 class CC_SURFACES_EXPORT CompositorFrameSinkSupport 29 class CC_SURFACES_EXPORT CompositorFrameSinkSupport
25 : public NON_EXPORTED_BASE(DisplayClient), 30 : public NON_EXPORTED_BASE(DisplayClient),
(...skipping 17 matching lines...) Expand all
43 CompositorFrame frame); 48 CompositorFrame frame);
44 void Require(const LocalSurfaceId& local_surface_id, 49 void Require(const LocalSurfaceId& local_surface_id,
45 const SurfaceSequence& sequence); 50 const SurfaceSequence& sequence);
46 void Satisfy(const SurfaceSequence& sequence); 51 void Satisfy(const SurfaceSequence& sequence);
47 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id); 52 void AddChildFrameSink(const FrameSinkId& child_frame_sink_id);
48 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id); 53 void RemoveChildFrameSink(const FrameSinkId& child_frame_sink_id);
49 54
50 Display* display() { return display_.get(); } 55 Display* display() { return display_.get(); }
51 56
52 private: 57 private:
58 // Update surface references with SurfaceManager for current CompositorFrame
59 // that has |local_surface_id|. UpdateReferences() must be called on
60 // |reference_tracker_| before calling this. Will add and remove top-level
61 // root references if |display_| is not null.
62 void UpdateSurfaceReferences(const SurfaceId& last_surface_id,
63 const LocalSurfaceId& local_surface_id);
64
65 void AddTopLevelRootReference(const SurfaceId& surface_id);
66 void RemoveTopLevelRootReference(const SurfaceId& surface_id);
67
53 void DidReceiveCompositorFrameAck(); 68 void DidReceiveCompositorFrameAck();
54 69
55 // DisplayClient implementation. 70 // DisplayClient implementation.
56 void DisplayOutputSurfaceLost() override; 71 void DisplayOutputSurfaceLost() override;
57 void DisplayWillDrawAndSwap(bool will_draw_and_swap, 72 void DisplayWillDrawAndSwap(bool will_draw_and_swap,
58 const RenderPassList& render_passes) override; 73 const RenderPassList& render_passes) override;
59 void DisplayDidDrawAndSwap() override; 74 void DisplayDidDrawAndSwap() override;
60 75
61 // SurfaceFactoryClient implementation. 76 // SurfaceFactoryClient implementation.
62 void ReturnResources(const ReturnedResourceArray& resources) override; 77 void ReturnResources(const ReturnedResourceArray& resources) override;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 109
95 // The last begin frame args generated by the begin frame source. 110 // The last begin frame args generated by the begin frame source.
96 BeginFrameArgs last_begin_frame_args_; 111 BeginFrameArgs last_begin_frame_args_;
97 112
98 // Whether a request for begin frames has been issued. 113 // Whether a request for begin frames has been issued.
99 bool needs_begin_frame_ = false; 114 bool needs_begin_frame_ = false;
100 115
101 // Whether or not a frame observer has been added. 116 // Whether or not a frame observer has been added.
102 bool added_frame_observer_ = false; 117 bool added_frame_observer_ = false;
103 118
119 // Track the surface references for the surface corresponding to this
120 // compositor frame sink.
121 ReferencedSurfaceTracker reference_tracker_;
122
104 // The set of BeginFrame children of this CompositorFrameSink. 123 // The set of BeginFrame children of this CompositorFrameSink.
105 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_; 124 std::unordered_set<FrameSinkId, FrameSinkIdHash> child_frame_sinks_;
106 125
107 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_; 126 base::WeakPtrFactory<CompositorFrameSinkSupport> weak_factory_;
108 127
109 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport); 128 DISALLOW_COPY_AND_ASSIGN(CompositorFrameSinkSupport);
110 }; 129 };
111 130
112 } // namespace cc 131 } // namespace cc
113 132
114 #endif // CC_SURFACES_COMPOSITOR_FRAME_SINK_SUPPORT_H_ 133 #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