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

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

Issue 2905523003: Revert of Enforce constant size and device scale factor for surfaces (Closed)
Patch Set: 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
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/surface.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_H_ 5 #ifndef CC_SURFACES_SURFACE_H_
6 #define CC_SURFACES_SURFACE_H_ 6 #define CC_SURFACES_SURFACE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <set> 13 #include <set>
14 #include <unordered_set> 14 #include <unordered_set>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/memory/weak_ptr.h" 19 #include "base/memory/weak_ptr.h"
20 #include "base/optional.h" 20 #include "base/optional.h"
21 #include "cc/output/copy_output_request.h" 21 #include "cc/output/copy_output_request.h"
22 #include "cc/surfaces/compositor_frame_sink_support.h" 22 #include "cc/surfaces/compositor_frame_sink_support.h"
23 #include "cc/surfaces/frame_sink_id.h" 23 #include "cc/surfaces/frame_sink_id.h"
24 #include "cc/surfaces/surface_info.h" 24 #include "cc/surfaces/surface_id.h"
25 #include "cc/surfaces/surface_sequence.h" 25 #include "cc/surfaces/surface_sequence.h"
26 #include "cc/surfaces/surfaces_export.h" 26 #include "cc/surfaces/surfaces_export.h"
27 #include "ui/gfx/geometry/size.h" 27 #include "ui/gfx/geometry/size.h"
28 28
29 namespace ui { 29 namespace ui {
30 class LatencyInfo; 30 class LatencyInfo;
31 } 31 }
32 32
33 namespace cc { 33 namespace cc {
34 34
35 class CompositorFrame; 35 class CompositorFrame;
36 class CopyOutputRequest; 36 class CopyOutputRequest;
37 37
38 class CC_SURFACES_EXPORT Surface { 38 class CC_SURFACES_EXPORT Surface {
39 public: 39 public:
40 using WillDrawCallback = 40 using WillDrawCallback =
41 base::RepeatingCallback<void(const LocalSurfaceId&, const gfx::Rect&)>; 41 base::RepeatingCallback<void(const LocalSurfaceId&, const gfx::Rect&)>;
42 42
43 Surface( 43 Surface(
44 const SurfaceInfo& surface_info, 44 const SurfaceId& id,
45 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support); 45 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support);
46 ~Surface(); 46 ~Surface();
47 47
48 const SurfaceId& surface_id() const { return surface_info_.id(); } 48 const SurfaceId& surface_id() const { return surface_id_; }
49 const SurfaceId& previous_frame_surface_id() const { 49 const SurfaceId& previous_frame_surface_id() const {
50 return previous_frame_surface_id_; 50 return previous_frame_surface_id_;
51 } 51 }
52 52
53 void SetPreviousFrameSurface(Surface* surface); 53 void SetPreviousFrameSurface(Surface* surface);
54 54
55 // Returns false if |frame| is invalid.
56 // |draw_callback| is called once to notify the client that the previously 55 // |draw_callback| is called once to notify the client that the previously
57 // submitted CompositorFrame is processed and that another frame can be 56 // submitted CompositorFrame is processed and that another frame can be
58 // submitted. 57 // submitted.
59 // |will_draw_callback| is called when |surface| is scheduled for a draw and 58 // |will_draw_callback| is called when |surface| is scheduled for a draw and
60 // there is visible damage. 59 // there is visible damage.
61 bool QueueFrame(CompositorFrame frame, 60 void QueueFrame(CompositorFrame frame,
62 const base::Closure& draw_callback, 61 const base::Closure& draw_callback,
63 const WillDrawCallback& will_draw_callback); 62 const WillDrawCallback& will_draw_callback);
64 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request); 63 void RequestCopyOfOutput(std::unique_ptr<CopyOutputRequest> copy_request);
65 64
66 // Notifies the Surface that a blocking SurfaceId now has an active frame. 65 // Notifies the Surface that a blocking SurfaceId now has an active frame.
67 void NotifySurfaceIdAvailable(const SurfaceId& surface_id); 66 void NotifySurfaceIdAvailable(const SurfaceId& surface_id);
68 67
69 // Called if a deadline has been hit and this surface is not yet active but 68 // Called if a deadline has been hit and this surface is not yet active but
70 // it's marked as respecting deadlines. 69 // it's marked as respecting deadlines.
71 void ActivatePendingFrameForDeadline(); 70 void ActivatePendingFrameForDeadline();
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 void UnrefFrameResourcesAndRunDrawCallback( 149 void UnrefFrameResourcesAndRunDrawCallback(
151 base::Optional<FrameData> frame_data); 150 base::Optional<FrameData> frame_data);
152 void ClearCopyRequests(); 151 void ClearCopyRequests();
153 152
154 void TakeLatencyInfoFromPendingFrame( 153 void TakeLatencyInfoFromPendingFrame(
155 std::vector<ui::LatencyInfo>* latency_info); 154 std::vector<ui::LatencyInfo>* latency_info);
156 static void TakeLatencyInfoFromFrame( 155 static void TakeLatencyInfoFromFrame(
157 CompositorFrame* frame, 156 CompositorFrame* frame,
158 std::vector<ui::LatencyInfo>* latency_info); 157 std::vector<ui::LatencyInfo>* latency_info);
159 158
160 SurfaceInfo surface_info_; 159 const SurfaceId surface_id_;
161 SurfaceId previous_frame_surface_id_; 160 SurfaceId previous_frame_surface_id_;
162 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support_; 161 base::WeakPtr<CompositorFrameSinkSupport> compositor_frame_sink_support_;
163 SurfaceManager* const surface_manager_; 162 SurfaceManager* const surface_manager_;
164 163
165 base::Optional<FrameData> pending_frame_data_; 164 base::Optional<FrameData> pending_frame_data_;
166 base::Optional<FrameData> active_frame_data_; 165 base::Optional<FrameData> active_frame_data_;
167 int frame_index_; 166 int frame_index_;
168 bool closed_ = false; 167 bool closed_ = false;
169 bool destroyed_; 168 bool destroyed_;
170 std::vector<SurfaceSequence> destruction_dependencies_; 169 std::vector<SurfaceSequence> destruction_dependencies_;
171 170
172 base::flat_set<SurfaceId> blocking_surfaces_; 171 base::flat_set<SurfaceId> blocking_surfaces_;
173 172
174 DISALLOW_COPY_AND_ASSIGN(Surface); 173 DISALLOW_COPY_AND_ASSIGN(Surface);
175 }; 174 };
176 175
177 } // namespace cc 176 } // namespace cc
178 177
179 #endif // CC_SURFACES_SURFACE_H_ 178 #endif // CC_SURFACES_SURFACE_H_
OLDNEW
« no previous file with comments | « cc/surfaces/display_unittest.cc ('k') | cc/surfaces/surface.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698