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

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

Issue 2661543002: Rename LocalFrameId to LocalSurfaceId (Closed)
Patch Set: c 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 | « cc/surfaces/surface_aggregator_unittest.cc ('k') | cc/surfaces/surface_factory.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 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 // Destroys and disowns the current surface, and resets all resource 52 // Destroys and disowns the current surface, and resets all resource
53 // references. This is useful when resources are invalid (e.g. lost context). 53 // references. This is useful when resources are invalid (e.g. lost context).
54 void Reset(); 54 void Reset();
55 55
56 // Submits the frame to the current surface being managed by the factory if 56 // Submits the frame to the current surface being managed by the factory if
57 // the local frame ids match, or creates a new surface with the given local 57 // the local frame ids match, or creates a new surface with the given local
58 // frame id, destroys the old one, and submits the frame to this new surface. 58 // frame id, destroys the old one, and submits the frame to this new surface.
59 // The frame can contain references to any surface, regardless of which 59 // The frame can contain references to any surface, regardless of which
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 LocalFrameId& local_frame_id, 62 void SubmitCompositorFrame(const LocalSurfaceId& local_surface_id,
63 CompositorFrame frame, 63 CompositorFrame frame,
64 const DrawCallback& callback); 64 const DrawCallback& callback);
65 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> copy_request); 65 void RequestCopyOfSurface(std::unique_ptr<CopyOutputRequest> copy_request);
66 66
67 // Evicts the current frame on the surface. All the resources 67 // Evicts the current frame on the surface. All the resources
68 // will be released and Surface::HasFrame will return false. 68 // will be released and Surface::HasFrame will return false.
69 void ClearSurface(); 69 void ClearSurface();
70 70
71 void WillDrawSurface(const LocalFrameId& id, const gfx::Rect& damage_rect); 71 void WillDrawSurface(const LocalSurfaceId& id, const gfx::Rect& damage_rect);
72 72
73 SurfaceFactoryClient* client() { return client_; } 73 SurfaceFactoryClient* client() { return client_; }
74 74
75 void ReceiveFromChild(const TransferableResourceArray& resources); 75 void ReceiveFromChild(const TransferableResourceArray& resources);
76 void RefResources(const TransferableResourceArray& resources); 76 void RefResources(const TransferableResourceArray& resources);
77 void UnrefResources(const ReturnedResourceArray& resources); 77 void UnrefResources(const ReturnedResourceArray& resources);
78 78
79 SurfaceManager* manager() { return manager_; } 79 SurfaceManager* manager() { return manager_; }
80 80
81 // This can be set to false if resources from this SurfaceFactory don't need 81 // This can be set to false if resources from this SurfaceFactory don't need
82 // to have sync points set on them when returned from the Display, for 82 // to have sync points set on them when returned from the Display, for
83 // example if the Display shares a context with the creator. 83 // example if the Display shares a context with the creator.
84 bool needs_sync_points() const { return needs_sync_points_; } 84 bool needs_sync_points() const { return needs_sync_points_; }
85 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; } 85 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; }
86 86
87 // SurfaceFactory's owner can call this when it finds out that SurfaceManager 87 // SurfaceFactory's owner can call this when it finds out that SurfaceManager
88 // is no longer alive during destruction. 88 // is no longer alive during destruction.
89 void DidDestroySurfaceManager() { manager_ = nullptr; } 89 void DidDestroySurfaceManager() { manager_ = nullptr; }
90 90
91 private: 91 private:
92 std::unique_ptr<Surface> Create(const LocalFrameId& local_frame_id); 92 std::unique_ptr<Surface> Create(const LocalSurfaceId& local_surface_id);
93 void Destroy(std::unique_ptr<Surface> surface); 93 void Destroy(std::unique_ptr<Surface> surface);
94 94
95 const FrameSinkId frame_sink_id_; 95 const FrameSinkId frame_sink_id_;
96 SurfaceManager* manager_; 96 SurfaceManager* manager_;
97 SurfaceFactoryClient* client_; 97 SurfaceFactoryClient* client_;
98 SurfaceResourceHolder holder_; 98 SurfaceResourceHolder holder_;
99 bool needs_sync_points_; 99 bool needs_sync_points_;
100 std::unique_ptr<Surface> current_surface_; 100 std::unique_ptr<Surface> current_surface_;
101 base::WeakPtrFactory<SurfaceFactory> weak_factory_; 101 base::WeakPtrFactory<SurfaceFactory> weak_factory_;
102 102
103 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); 103 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
104 }; 104 };
105 105
106 } // namespace cc 106 } // namespace cc
107 107
108 #endif // CC_SURFACES_SURFACE_FACTORY_H_ 108 #endif // CC_SURFACES_SURFACE_FACTORY_H_
OLDNEW
« no previous file with comments | « cc/surfaces/surface_aggregator_unittest.cc ('k') | cc/surfaces/surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698