blob: 0ee0827a2cbb2bd3ab73df7a769d7cca749bf2ad [file] [log] [blame]
revemanb195f41d2015-11-19 22:16:481// Copyright 2015 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef COMPONENTS_EXO_SURFACE_H_
6#define COMPONENTS_EXO_SURFACE_H_
7
8#include <list>
reveman70baca12016-05-31 20:35:309#include <set>
reveman27fe2642015-11-20 06:33:3910#include <utility>
revemanb195f41d2015-11-19 22:16:4811
12#include "base/callback.h"
13#include "base/macros.h"
jbaumanbd9586a92016-05-28 01:09:0314#include "base/memory/ref_counted.h"
revemanb195f41d2015-11-19 22:16:4815#include "base/memory/weak_ptr.h"
reveman27fe2642015-11-20 06:33:3916#include "base/observer_list.h"
Dominik Laskowski0dcf91352017-11-29 19:21:3517#include "cc/base/region.h"
danakjc7afae52017-06-20 21:12:4118#include "components/exo/layer_tree_frame_sink_holder.h"
David Reveman93f67c02017-09-06 03:23:0819#include "components/exo/surface_delegate.h"
Fady Samuelc645ffe2017-07-24 17:28:2020#include "components/viz/common/frame_sinks/begin_frame_source.h"
Fady Samuel4f7f0fb32017-07-28 15:33:3721#include "components/viz/common/resources/transferable_resource.h"
reedcc9c70f2016-11-22 04:26:0122#include "third_party/skia/include/core/SkBlendMode.h"
reveman4c94cf962015-12-03 06:49:4323#include "ui/aura/window.h"
revemanb195f41d2015-11-19 22:16:4824#include "ui/gfx/geometry/rect.h"
revemane295c662017-01-30 23:01:2125#include "ui/gfx/native_widget_types.h"
Lloyd Pique0a3045f2017-09-15 23:34:1226#include "ui/gfx/transform.h"
revemanb195f41d2015-11-19 22:16:4827
28namespace base {
29namespace trace_event {
30class TracedValue;
31}
32}
33
reveman2966d7702016-02-12 02:09:5434namespace gfx {
35class Path;
36}
37
danakj5e0a12b2017-09-25 17:26:4938namespace viz {
39class CompositorFrame;
40}
41
revemanb195f41d2015-11-19 22:16:4842namespace exo {
43class Buffer;
Peng Huang583c9dc62017-07-27 23:38:2844class LayerTreeFrameSinkHolder;
reveman27fe2642015-11-20 06:33:3945class SurfaceObserver;
jbaumanbd9586a92016-05-28 01:09:0346class Surface;
47
jbaumanb362a892016-06-17 03:30:5648namespace subtle {
49class PropertyHelper;
50}
51
David Revemanfca309b2017-08-24 18:18:1152// Counter-clockwise rotations.
53enum class Transform { NORMAL, ROTATE_90, ROTATE_180, ROTATE_270 };
54
revemanb195f41d2015-11-19 22:16:4855// This class represents a rectangular area that is displayed on the screen.
56// It has a location, size and pixel contents.
Hans Wennborgaf90ff12017-09-04 19:46:0257class Surface final : public ui::PropertyHandler {
revemanb195f41d2015-11-19 22:16:4858 public:
reveman2d3815d2016-06-26 20:13:2559 using PropertyDeallocator = void (*)(int64_t value);
jbaumanb362a892016-06-17 03:30:5660
revemanb195f41d2015-11-19 22:16:4861 Surface();
Peng Huang583c9dc62017-07-27 23:38:2862 ~Surface();
revemanb195f41d2015-11-19 22:16:4863
reveman39b32c872015-12-08 05:34:0564 // Type-checking downcast routine.
kinabad14ca03e2016-02-23 04:43:3565 static Surface* AsSurface(const aura::Window* window);
reveman39b32c872015-12-08 05:34:0566
jbaumane3526252016-06-09 18:43:0567 aura::Window* window() { return window_.get(); }
68
revemanb195f41d2015-11-19 22:16:4869 // Set a buffer as the content of this surface. A buffer can only be attached
70 // to one surface at a time.
71 void Attach(Buffer* buffer);
72
73 // Describe the regions where the pending buffer is different from the
74 // current surface contents, and where the surface therefore needs to be
75 // repainted.
76 void Damage(const gfx::Rect& rect);
77
reveman211cf802017-01-10 00:30:5978 // Request notification when it's a good time to produce a new frame. Useful
79 // for throttling redrawing operations, and driving animations.
revemanb195f41d2015-11-19 22:16:4880 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>;
81 void RequestFrameCallback(const FrameCallback& callback);
82
reveman211cf802017-01-10 00:30:5983 // Request notification when the next frame is displayed. Useful for
84 // throttling redrawing operations, and driving animations.
85 using PresentationCallback =
Sadrul Habib Chowdhuryb62a97302018-06-06 03:33:4886 base::Callback<void(const gfx::PresentationFeedback&)>;
reveman211cf802017-01-10 00:30:5987 void RequestPresentationCallback(const PresentationCallback& callback);
88
revemanb195f41d2015-11-19 22:16:4889 // This sets the region of the surface that contains opaque content.
Dominik Laskowski0dcf91352017-11-29 19:21:3590 void SetOpaqueRegion(const cc::Region& region);
revemanb195f41d2015-11-19 22:16:4891
reveman2966d7702016-02-12 02:09:5492 // This sets the region of the surface that can receive pointer and touch
Dominik Laskowski57064702017-11-30 10:31:4193 // events. The region is clipped to the surface bounds.
Dominik Laskowski0dcf91352017-11-29 19:21:3594 void SetInputRegion(const cc::Region& region);
Scott Violetdb1f0682018-08-30 19:19:4695 const cc::Region& hit_test_region() const { return hit_test_region_; }
reveman2966d7702016-02-12 02:09:5496
Mike Reed2c570fa2018-01-11 21:59:2297 // This resets the region of the surface that can receive pointer and touch
98 // events to be wide-open. This will be clipped to the surface bounds.
99 void ResetInputRegion();
100
Dominik Laskowski2d4316412017-12-13 19:14:44101 // This overrides the input region to the surface bounds with an outset.
102 // TODO(domlaskowski): Remove this once client-driven resizing is removed.
103 void SetInputOutset(int outset);
104
reveman7efa4b02016-01-06 08:29:54105 // This sets the scaling factor used to interpret the contents of the buffer
106 // attached to the surface. Note that if the scale is larger than 1, then you
107 // have to attach a buffer that is larger (by a factor of scale in each
108 // dimension) than the desired surface size.
109 void SetBufferScale(float scale);
110
David Revemanfca309b2017-08-24 18:18:11111 // This sets the transformation used to interpret the contents of the buffer
112 // attached to the surface.
113 void SetBufferTransform(Transform transform);
114
reveman27fe2642015-11-20 06:33:39115 // Functions that control sub-surface state. All sub-surface state is
116 // double-buffered and will be applied when Commit() is called.
117 void AddSubSurface(Surface* sub_surface);
118 void RemoveSubSurface(Surface* sub_surface);
119 void SetSubSurfacePosition(Surface* sub_surface, const gfx::Point& position);
120 void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference);
121 void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling);
David Reveman8b43b352017-11-03 15:24:51122 void OnSubSurfaceCommit();
reveman27fe2642015-11-20 06:33:39123
reveman642d8c332016-02-19 19:55:44124 // This sets the surface viewport for scaling.
125 void SetViewport(const gfx::Size& viewport);
126
reveman8e323902016-05-23 21:55:36127 // This sets the surface crop rectangle.
128 void SetCrop(const gfx::RectF& crop);
129
reveman85b7a562016-03-17 23:27:32130 // This sets the only visible on secure output flag, preventing it from
131 // appearing in screenshots or from being viewed on non-secure displays.
132 void SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output);
133
revemanfca687e2016-05-10 21:44:48134 // This sets the blend mode that will be used when drawing the surface.
reedcc9c70f2016-11-22 04:26:01135 void SetBlendMode(SkBlendMode blend_mode);
revemanfca687e2016-05-10 21:44:48136
137 // This sets the alpha value that will be applied to the whole surface.
138 void SetAlpha(float alpha);
139
David Reveman93f67c02017-09-06 03:23:08140 // Request that surface should have the specified frame type.
141 void SetFrame(SurfaceFrameType type);
142
David Reveman786d3182017-12-20 22:04:33143 // Request that surface should use a specific set of frame colors.
144 void SetFrameColors(SkColor active_color, SkColor inactive_color);
145
David Reveman21e2236d2018-04-12 06:01:10146 // Request that surface should have a specific startup ID string.
Tim Zheng08df5662018-04-04 05:08:15147 void SetStartupId(const char* startup_id);
148
David Reveman21e2236d2018-04-12 06:01:10149 // Request that surface should have a specific application ID string.
150 void SetApplicationId(const char* application_id);
151
David Reveman32715092017-12-05 18:24:11152 // Request "parent" for surface.
153 void SetParent(Surface* parent, const gfx::Point& position);
154
Ryo Hashimoto8f10c882018-11-28 17:43:52155 // Request that surface should have a specific ID assigned by client.
156 void SetClientSurfaceId(int32_t client_surface_id);
157 int32_t GetClientSurfaceId() const;
158
revemanb195f41d2015-11-19 22:16:48159 // Surface state (damage regions, attached buffers, etc.) is double-buffered.
160 // A Commit() call atomically applies all pending state, replacing the
reveman27fe2642015-11-20 06:33:39161 // current state. Commit() is not guaranteed to be synchronous. See
162 // CommitSurfaceHierarchy() below.
revemanb195f41d2015-11-19 22:16:48163 void Commit();
164
David Reveman8b43b352017-11-03 15:24:51165 // This will commit all pending state of the surface and its descendants by
David Reveman7a126ba2017-11-09 17:17:41166 // recursively calling CommitSurfaceHierarchy() for each sub-surface.
167 // If |synchronized| is set to false, then synchronized surfaces should not
168 // commit pending state.
David Revemanef1cb082017-11-09 21:14:40169 void CommitSurfaceHierarchy(bool synchronized);
reveman27fe2642015-11-20 06:33:39170
David Revemanef1cb082017-11-09 21:14:40171 // This will append current callbacks for surface and its descendants to
172 // |frame_callbacks| and |presentation_callbacks|.
173 void AppendSurfaceHierarchyCallbacks(
174 std::list<FrameCallback>* frame_callbacks,
175 std::list<PresentationCallback>* presentation_callbacks);
176
177 // This will append contents for surface and its descendants to frame.
Peng Huang76f5fd02017-09-01 00:59:39178 void AppendSurfaceHierarchyContentsToFrame(
179 const gfx::Point& origin,
180 float device_scale_factor,
181 LayerTreeFrameSinkHolder* frame_sink_holder,
danakj5e0a12b2017-09-25 17:26:49182 viz::CompositorFrame* frame);
Peng Huang76f5fd02017-09-01 00:59:39183
reveman27fe2642015-11-20 06:33:39184 // Returns true if surface is in synchronized mode.
185 bool IsSynchronized() const;
186
Dominik Laskowski14a163772018-02-09 19:25:18187 // Returns true if surface should receive input events.
188 bool IsInputEnabled(Surface* surface) const;
Dominik Laskowski3e2f94792017-12-15 00:27:10189
Dominik Laskowski57064702017-11-30 10:31:41190 // Returns false if the hit test region is empty.
191 bool HasHitTestRegion() const;
reveman2966d7702016-02-12 02:09:54192
Dominik Laskowski57064702017-11-30 10:31:41193 // Returns true if |point| is inside the surface.
194 bool HitTest(const gfx::Point& point) const;
reveman2966d7702016-02-12 02:09:54195
Dominik Laskowski57064702017-11-30 10:31:41196 // Sets |mask| to the path that delineates the hit test region of the surface.
reveman2966d7702016-02-12 02:09:54197 void GetHitTestMask(gfx::Path* mask) const;
reveman4c94cf962015-12-03 06:49:43198
revemanb195f41d2015-11-19 22:16:48199 // Set the surface delegate.
200 void SetSurfaceDelegate(SurfaceDelegate* delegate);
201
reveman27fe2642015-11-20 06:33:39202 // Returns true if surface has been assigned a surface delegate.
203 bool HasSurfaceDelegate() const;
204
205 // Surface does not own observers. It is the responsibility of the observer
206 // to remove itself when it is done observing.
207 void AddSurfaceObserver(SurfaceObserver* observer);
208 void RemoveSurfaceObserver(SurfaceObserver* observer);
209 bool HasSurfaceObserver(const SurfaceObserver* observer) const;
210
revemanb195f41d2015-11-19 22:16:48211 // Returns a trace value representing the state of the surface.
dcheng31759da2016-04-21 01:26:31212 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const;
revemanb195f41d2015-11-19 22:16:48213
eseckler599d86bb2017-03-15 09:02:55214 // Called when the begin frame source has changed.
Fady Samuelc645ffe2017-07-24 17:28:20215 void SetBeginFrameSource(viz::BeginFrameSource* begin_frame_source);
jbaumanbd9586a92016-05-28 01:09:03216
David Reveman7a126ba2017-11-09 17:17:41217 // Returns the active content size.
Peng Huangb07b0652017-06-27 17:25:22218 const gfx::Size& content_size() const { return content_size_; }
jbaumanb362a892016-06-17 03:30:56219
David Reveman7a126ba2017-11-09 17:17:41220 // Returns the active content bounds for surface hierarchy. ie. the bounding
221 // box of the surface and its descendants, in the local coordinate space of
222 // the surface.
223 const gfx::Rect& surface_hierarchy_content_bounds() const {
224 return surface_hierarchy_content_bounds_;
225 }
226
kaznacheev8e270592017-05-25 06:13:26227 // Returns true if the associated window is in 'stylus-only' mode.
228 bool IsStylusOnly();
229
230 // Enables 'stylus-only' mode for the associated window.
231 void SetStylusOnly();
232
Peng Huangc51f7aba2017-09-05 16:00:39233 // Notify surface that resources and subsurfaces' resources have been lost.
234 void SurfaceHierarchyResourcesLost();
reveman15aee282016-11-04 19:09:20235
Peng Huang583c9dc62017-07-27 23:38:28236 // Returns true if the surface's bounds should be filled opaquely.
237 bool FillsBoundsOpaquely() const;
reveman211cf802017-01-10 00:30:59238
reveman15aee282016-11-04 19:09:20239 bool HasPendingDamageForTesting(const gfx::Rect& damage) const {
Dominik Laskowski0dcf91352017-11-29 19:21:35240 return pending_damage_.Contains(damage);
reveman15aee282016-11-04 19:09:20241 }
242
Eliot Courtneybb051d12018-12-15 02:41:31243 // Set occlusion tracking region for surface.
244 void SetOcclusionTracking(bool tracking);
245
246 // Triggers sending an occlusion update to observers.
247 void OnWindowOcclusionChanged();
248
revemanb195f41d2015-11-19 22:16:48249 private:
jbaumanf4c3f292016-06-11 00:57:33250 struct State {
251 State();
252 ~State();
253
Lei Zhang1c9963ba2018-05-15 04:50:21254 bool operator==(const State& other) const;
255 bool operator!=(const State& other) const { return !(*this == other); }
jbaumanf4c3f292016-06-11 00:57:33256
Dominik Laskowski0dcf91352017-11-29 19:21:35257 cc::Region opaque_region;
Mike Reed2c570fa2018-01-11 21:59:22258 base::Optional<cc::Region> input_region;
Dominik Laskowski2d4316412017-12-13 19:14:44259 int input_outset = 0;
reveman2d3815d2016-06-26 20:13:25260 float buffer_scale = 1.0f;
David Revemanfca309b2017-08-24 18:18:11261 Transform buffer_transform = Transform::NORMAL;
jbaumanf4c3f292016-06-11 00:57:33262 gfx::Size viewport;
263 gfx::RectF crop;
264 bool only_visible_on_secure_output = false;
reedcc9c70f2016-11-22 04:26:01265 SkBlendMode blend_mode = SkBlendMode::kSrcOver;
jbaumanf4c3f292016-06-11 00:57:33266 float alpha = 1.0f;
jbauman45c06862016-06-23 19:35:02267 };
268 class BufferAttachment {
269 public:
270 BufferAttachment();
271 ~BufferAttachment();
272
273 BufferAttachment& operator=(BufferAttachment&& buffer);
274
275 base::WeakPtr<Buffer>& buffer();
276 const base::WeakPtr<Buffer>& buffer() const;
David Revemane6e23342017-11-07 06:18:06277 const gfx::Size& size() const;
jbauman45c06862016-06-23 19:35:02278 void Reset(base::WeakPtr<Buffer> buffer);
279
280 private:
281 base::WeakPtr<Buffer> buffer_;
David Revemane6e23342017-11-07 06:18:06282 gfx::Size size_;
jbauman45c06862016-06-23 19:35:02283
284 DISALLOW_COPY_AND_ASSIGN(BufferAttachment);
jbaumanf4c3f292016-06-11 00:57:33285 };
286
jbaumanb362a892016-06-17 03:30:56287 friend class subtle::PropertyHelper;
288
jbauman45c06862016-06-23 19:35:02289 // Updates current_resource_ with a new resource id corresponding to the
290 // contents of the attached buffer (or id 0, if no buffer is attached).
291 // UpdateSurface must be called afterwards to ensure the release callback
292 // will be called.
Peng Huangc51f7aba2017-09-05 16:00:39293 void UpdateResource(LayerTreeFrameSinkHolder* frame_sink_holder);
jbauman45c06862016-06-23 19:35:02294
Lloyd Pique0a3045f2017-09-15 23:34:12295 // Updates buffer_transform_ to match the current buffer parameters.
Zach Reizner8bcce6e2018-10-31 00:04:37296 void UpdateBufferTransform(bool y_invert);
Lloyd Pique0a3045f2017-09-15 23:34:12297
Peng Huang583c9dc62017-07-27 23:38:28298 // Puts the current surface into a draw quad, and appends the draw quads into
299 // the |frame|.
300 void AppendContentsToFrame(const gfx::Point& origin,
Peng Huang76f5fd02017-09-01 00:59:39301 float device_scale_factor,
danakj5e0a12b2017-09-25 17:26:49302 viz::CompositorFrame* frame);
jbauman45c06862016-06-23 19:35:02303
Peng Huangc51f7aba2017-09-05 16:00:39304 // Update surface content size base on current buffer size.
Peng Huang583c9dc62017-07-27 23:38:28305 void UpdateContentSize();
eseckler599d86bb2017-03-15 09:02:55306
revemanced21f862015-11-24 00:42:49307 // This returns true when the surface has some contents assigned to it.
David Revemane6e23342017-11-07 06:18:06308 bool has_contents() const { return !current_buffer_.size().IsEmpty(); }
revemanced21f862015-11-24 00:42:49309
jbaumane3526252016-06-09 18:43:05310 // This window has the layer which contains the Surface contents.
311 std::unique_ptr<aura::Window> window_;
312
Peng Huang583c9dc62017-07-27 23:38:28313 // This true, if sub_surfaces_ has changes (order, position, etc).
314 bool sub_surfaces_changed_ = false;
jbaumanf4c3f292016-06-11 00:57:33315
jbaumanb362a892016-06-17 03:30:56316 // This is the size of the last committed contents.
317 gfx::Size content_size_;
318
David Reveman7a126ba2017-11-09 17:17:41319 // This is the bounds of the last committed surface hierarchy contents.
320 gfx::Rect surface_hierarchy_content_bounds_;
321
revemanced21f862015-11-24 00:42:49322 // This is true when Attach() has been called and new contents should take
323 // effect next time Commit() is called.
reveman2d3815d2016-06-26 20:13:25324 bool has_pending_contents_ = false;
reveman27fe2642015-11-20 06:33:39325
revemanb195f41d2015-11-19 22:16:48326 // The buffer that will become the content of surface when Commit() is called.
jbauman45c06862016-06-23 19:35:02327 BufferAttachment pending_buffer_;
revemanb195f41d2015-11-19 22:16:48328
329 // The damage region to schedule paint for when Commit() is called.
Dominik Laskowski0dcf91352017-11-29 19:21:35330 cc::Region pending_damage_;
revemanb195f41d2015-11-19 22:16:48331
Peng Huang76f5fd02017-09-01 00:59:39332 // The damage region which will be used by
333 // AppendSurfaceHierarchyContentsToFrame() to generate frame.
Dominik Laskowski0dcf91352017-11-29 19:21:35334 cc::Region damage_;
Peng Huang76f5fd02017-09-01 00:59:39335
revemanb195f41d2015-11-19 22:16:48336 // These lists contains the callbacks to notify the client when it is a good
337 // time to start producing a new frame. These callbacks move to
338 // |frame_callbacks_| when Commit() is called. Later they are moved to
reveman15aee282016-11-04 19:09:20339 // |active_frame_callbacks_| when the effect of the Commit() is scheduled to
340 // be drawn. They fire at the first begin frame notification after this.
revemanb195f41d2015-11-19 22:16:48341 std::list<FrameCallback> pending_frame_callbacks_;
David Revemanef1cb082017-11-09 21:14:40342 std::list<FrameCallback> frame_callbacks_;
reveman211cf802017-01-10 00:30:59343
344 // These lists contains the callbacks to notify the client when surface
345 // contents have been presented. These callbacks move to
346 // |presentation_callbacks_| when Commit() is called. Later they are moved to
347 // |swapping_presentation_callbacks_| when the effect of the Commit() is
348 // scheduled to be drawn and then moved to |swapped_presentation_callbacks_|
349 // after receiving VSync parameters update for the previous frame. They fire
350 // at the next VSync parameters update after that.
351 std::list<PresentationCallback> pending_presentation_callbacks_;
David Revemanef1cb082017-11-09 21:14:40352 std::list<PresentationCallback> presentation_callbacks_;
revemanb195f41d2015-11-19 22:16:48353
jbaumanf4c3f292016-06-11 00:57:33354 // This is the state that has yet to be committed.
355 State pending_state_;
revemanb195f41d2015-11-19 22:16:48356
jbaumanf4c3f292016-06-11 00:57:33357 // This is the state that has been committed.
358 State state_;
reveman7efa4b02016-01-06 08:29:54359
Dominik Laskowski57064702017-11-30 10:31:41360 // Cumulative input region of surface and its sub-surfaces.
361 cc::Region hit_test_region_;
362
reveman27fe2642015-11-20 06:33:39363 // The stack of sub-surfaces to take effect when Commit() is called.
364 // Bottom-most sub-surface at the front of the list and top-most sub-surface
365 // at the back.
366 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>;
367 using SubSurfaceEntryList = std::list<SubSurfaceEntry>;
368 SubSurfaceEntryList pending_sub_surfaces_;
Peng Huang583c9dc62017-07-27 23:38:28369 SubSurfaceEntryList sub_surfaces_;
reveman27fe2642015-11-20 06:33:39370
revemanced21f862015-11-24 00:42:49371 // The buffer that is currently set as content of surface.
jbauman45c06862016-06-23 19:35:02372 BufferAttachment current_buffer_;
revemanced21f862015-11-24 00:42:49373
jbauman2fdc0732016-06-07 00:55:36374 // The last resource that was sent to a surface.
Fady Samuel4f7f0fb32017-07-28 15:33:37375 viz::TransferableResource current_resource_;
jbauman2fdc0732016-06-07 00:55:36376
revemanca132dc2017-01-31 22:35:54377 // Whether the last resource that was sent to a surface has an alpha channel.
378 bool current_resource_has_alpha_ = false;
379
reveman27fe2642015-11-20 06:33:39380 // This is true if a call to Commit() as been made but
381 // CommitSurfaceHierarchy() has not yet been called.
Peng Huang76f5fd02017-09-01 00:59:39382 bool needs_commit_surface_ = false;
reveman27fe2642015-11-20 06:33:39383
Peng Huangc51f7aba2017-09-05 16:00:39384 // This is true if UpdateResources() should be called.
385 bool needs_update_resource_ = true;
386
Lloyd Pique0a3045f2017-09-15 23:34:12387 // The current buffer transform matrix. It specifies the transformation from
388 // normalized buffer coordinates to post-tranform buffer coordinates.
389 gfx::Transform buffer_transform_;
390
reveman7cadea42016-02-05 20:14:38391 // This is set when the compositing starts and passed to active frame
392 // callbacks when compositing successfully ends.
393 base::TimeTicks last_compositing_start_time_;
394
revemanb195f41d2015-11-19 22:16:48395 // This can be set to have some functions delegated. E.g. ShellSurface class
396 // can set this to handle Commit() and apply any double buffered state it
397 // maintains.
reveman2d3815d2016-06-26 20:13:25398 SurfaceDelegate* delegate_ = nullptr;
revemanb195f41d2015-11-19 22:16:48399
reveman27fe2642015-11-20 06:33:39400 // Surface observer list. Surface does not own the observers.
Trent Apteda250ec3ab2018-08-19 08:52:19401 base::ObserverList<SurfaceObserver, true>::Unchecked observers_;
reveman27fe2642015-11-20 06:33:39402
Eliot Courtneybb051d12018-12-15 02:41:31403 // Whether this surface is tracking occlusion for the client.
404 bool is_tracking_occlusion_ = false;
405
revemanb195f41d2015-11-19 22:16:48406 DISALLOW_COPY_AND_ASSIGN(Surface);
407};
408
409} // namespace exo
410
411#endif // COMPONENTS_EXO_SURFACE_H_