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

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

Issue 2831213004: cc: Reject CompositorFrames to old child surfaces (Closed)
Patch Set: Improved comment 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_SURFACE_FACTORY_H_ 5 #ifndef CC_SURFACES_SURFACE_FACTORY_H_
6 #define CC_SURFACES_SURFACE_FACTORY_H_ 6 #define CC_SURFACES_SURFACE_FACTORY_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <set> 9 #include <set>
10 10
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // factory owns it. The callback is called the first time this frame is used 60 // factory owns it. The callback is called the first time this frame is used
61 // to draw, or if the frame is discarded. 61 // to draw, or if the frame is discarded.
62 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id, 62 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id,
63 CompositorFrame frame, 63 CompositorFrame frame,
64 const DrawCallback& callback, 64 const DrawCallback& callback,
65 const WillDrawCallback& will_draw_callback); 65 const WillDrawCallback& will_draw_callback);
66 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> copy_request); 66 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> copy_request);
67 67
68 SurfaceFactoryClient* client() { return client_; } 68 SurfaceFactoryClient* client() { return client_; }
69 69
70 SurfaceResourceHolderClient* resource_holder_client() {
71 return resource_holder_client_;
72 }
73
70 void ReceiveFromChild(const TransferableResourceArray& resources); 74 void ReceiveFromChild(const TransferableResourceArray& resources);
71 void RefResources(const TransferableResourceArray& resources); 75 void RefResources(const TransferableResourceArray& resources);
72 void UnrefResources(const ReturnedResourceArray& resources); 76 void UnrefResources(const ReturnedResourceArray& resources);
73 77
74 SurfaceManager* manager() { return manager_; } 78 SurfaceManager* manager() { return manager_; }
75 79
76 Surface* current_surface_for_testing() { return current_surface_.get(); } 80 Surface* current_surface_for_testing() { return current_surface_.get(); }
77 81
78 // This can be set to false if resources from this SurfaceFactory don't need 82 // This can be set to false if resources from this SurfaceFactory don't need
79 // to have sync points set on them when returned from the Display, for 83 // to have sync points set on them when returned from the Display, for
80 // example if the Display shares a context with the creator. 84 // example if the Display shares a context with the creator.
81 bool needs_sync_points() const { return needs_sync_points_; } 85 bool needs_sync_points() const { return needs_sync_points_; }
82 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; } 86 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; }
83 87
84 private: 88 private:
85 // PendingFrameObserver implementation. 89 // PendingFrameObserver implementation.
86 void OnSurfaceActivated(Surface* surface) override; 90 void OnSurfaceActivated(Surface* surface) override;
87 void OnSurfaceDependenciesChanged( 91 void OnSurfaceDependenciesChanged(
88 Surface* surface, 92 Surface* surface,
89 const base::flat_set<SurfaceId>& added_dependencies, 93 const base::flat_set<SurfaceId>& added_dependencies,
90 const base::flat_set<SurfaceId>& removed_dependencies) override; 94 const base::flat_set<SurfaceId>& removed_dependencies) override;
91 void OnSurfaceDiscarded(Surface* surface) override; 95 void OnSurfaceDiscarded(Surface* surface) override;
92 96
93 std::unique_ptr<Surface> Create(const LocalSurfaceId& local_surface_id); 97 std::unique_ptr<Surface> Create(const LocalSurfaceId& local_surface_id);
94 void Destroy(std::unique_ptr<Surface> surface); 98 void Destroy(std::unique_ptr<Surface> surface);
95 99
96 const FrameSinkId frame_sink_id_; 100 const FrameSinkId frame_sink_id_;
97 SurfaceManager* manager_; 101 SurfaceManager* manager_;
98 SurfaceFactoryClient* client_; 102 SurfaceFactoryClient* client_;
103 SurfaceResourceHolderClient* resource_holder_client_;
99 SurfaceResourceHolder holder_; 104 SurfaceResourceHolder holder_;
100 bool needs_sync_points_; 105 bool needs_sync_points_;
101 bool seen_first_frame_activation_ = false; 106 bool seen_first_frame_activation_ = false;
102 std::unique_ptr<Surface> current_surface_; 107 std::unique_ptr<Surface> current_surface_;
103 base::WeakPtrFactory<SurfaceFactory> weak_factory_; 108 base::WeakPtrFactory<SurfaceFactory> weak_factory_;
104 109
105 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); 110 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
106 }; 111 };
107 112
108 } // namespace cc 113 } // namespace cc
109 114
110 #endif // CC_SURFACES_SURFACE_FACTORY_H_ 115 #endif // CC_SURFACES_SURFACE_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698