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

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

Issue 2388753003: Introduce cc::LocalFrameId and use in SurfaceFactory (Closed)
Patch Set: Fix exo_unittests Created 4 years, 2 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 #include <unordered_map> 10 #include <unordered_map>
(...skipping 29 matching lines...) Expand all
40 public: 40 public:
41 using DrawCallback = base::Callback<void()>; 41 using DrawCallback = base::Callback<void()>;
42 42
43 SurfaceFactory(const FrameSinkId& frame_sink_id, 43 SurfaceFactory(const FrameSinkId& frame_sink_id,
44 SurfaceManager* manager, 44 SurfaceManager* manager,
45 SurfaceFactoryClient* client); 45 SurfaceFactoryClient* client);
46 ~SurfaceFactory(); 46 ~SurfaceFactory();
47 47
48 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; } 48 const FrameSinkId& frame_sink_id() const { return frame_sink_id_; }
49 49
50 void Create(const SurfaceId& surface_id); 50 void Create(const LocalFrameId& local_frame_id);
enne (OOO) 2016/10/06 00:28:11 Yeah, this is nice. :)
51 void Destroy(const SurfaceId& surface_id); 51 void Destroy(const LocalFrameId& local_frame_id);
52 void DestroyAll(); 52 void DestroyAll();
53 53
54 // Set that the current frame on new_id is to be treated as the successor to 54 // Set that the current frame on new_id is to be treated as the successor to
55 // the current frame on old_id for the purposes of calculating damage. 55 // the current frame on old_id for the purposes of calculating damage.
56 void SetPreviousFrameSurface(const SurfaceId& new_id, 56 void SetPreviousFrameSurface(const LocalFrameId& new_id,
57 const SurfaceId& old_id); 57 const LocalFrameId& old_id);
58 58
59 // A frame can only be submitted to a surface created by this factory, 59 // A frame can only be submitted to a surface created by this factory,
60 // although the frame may reference surfaces created by other factories. 60 // although the frame may reference surfaces created by other factories.
61 // The callback is called the first time this frame is used to draw, or if 61 // The callback is called the first time this frame is used to draw, or if
62 // the frame is discarded. 62 // the frame is discarded.
63 void SubmitCompositorFrame(const SurfaceId& surface_id, 63 void SubmitCompositorFrame(const LocalFrameId& local_frame_id,
64 CompositorFrame frame, 64 CompositorFrame frame,
65 const DrawCallback& callback); 65 const DrawCallback& callback);
66 void RequestCopyOfSurface(const SurfaceId& surface_id, 66 void RequestCopyOfSurface(const LocalFrameId& local_frame_id,
67 std::unique_ptr<CopyOutputRequest> copy_request); 67 std::unique_ptr<CopyOutputRequest> copy_request);
68 68
69 void WillDrawSurface(const SurfaceId& id, const gfx::Rect& damage_rect); 69 void WillDrawSurface(const LocalFrameId& id, const gfx::Rect& damage_rect);
70 70
71 SurfaceFactoryClient* client() { return client_; } 71 SurfaceFactoryClient* client() { return client_; }
72 72
73 void ReceiveFromChild(const TransferableResourceArray& resources); 73 void ReceiveFromChild(const TransferableResourceArray& resources);
74 void RefResources(const TransferableResourceArray& resources); 74 void RefResources(const TransferableResourceArray& resources);
75 void UnrefResources(const ReturnedResourceArray& resources); 75 void UnrefResources(const ReturnedResourceArray& resources);
76 76
77 SurfaceManager* manager() { return manager_; } 77 SurfaceManager* manager() { return manager_; }
78 78
79 // This can be set to false if resources from this SurfaceFactory don't need 79 // This can be set to false if resources from this SurfaceFactory don't need
80 // to have sync points set on them when returned from the Display, for 80 // to have sync points set on them when returned from the Display, for
81 // example if the Display shares a context with the creator. 81 // example if the Display shares a context with the creator.
82 bool needs_sync_points() const { return needs_sync_points_; } 82 bool needs_sync_points() const { return needs_sync_points_; }
83 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; } 83 void set_needs_sync_points(bool needs) { needs_sync_points_ = needs; }
84 84
85 // SurfaceFactory's owner can call this when it finds out that SurfaceManager 85 // SurfaceFactory's owner can call this when it finds out that SurfaceManager
86 // is no longer alive during destruction. 86 // is no longer alive during destruction.
87 void DidDestroySurfaceManager() { manager_ = nullptr; } 87 void DidDestroySurfaceManager() { manager_ = nullptr; }
88 88
89 private: 89 private:
90 FrameSinkId frame_sink_id_; 90 FrameSinkId frame_sink_id_;
91 SurfaceManager* manager_; 91 SurfaceManager* manager_;
92 SurfaceFactoryClient* client_; 92 SurfaceFactoryClient* client_;
93 SurfaceResourceHolder holder_; 93 SurfaceResourceHolder holder_;
94 94
95 bool needs_sync_points_; 95 bool needs_sync_points_;
96 96
97 using OwningSurfaceMap = 97 using OwningSurfaceMap = std::
98 std::unordered_map<SurfaceId, std::unique_ptr<Surface>, SurfaceIdHash>; 98 unordered_map<LocalFrameId, std::unique_ptr<Surface>, LocalFrameIdHash>;
99 OwningSurfaceMap surface_map_; 99 OwningSurfaceMap surface_map_;
100 100
101 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory); 101 DISALLOW_COPY_AND_ASSIGN(SurfaceFactory);
102 }; 102 };
103 103
104 } // namespace cc 104 } // namespace cc
105 105
106 #endif // CC_SURFACES_SURFACE_FACTORY_H_ 106 #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