blob: 57893f139973aa102afabac288b8ddacfcef5e46 [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
Raul Tambre038e96d2019-01-07 21:47:4428class SkPath;
29
revemanb195f41d2015-11-19 22:16:4830namespace base {
31namespace trace_event {
32class TracedValue;
33}
34}
35
danakj5e0a12b2017-09-25 17:26:4936namespace viz {
37class CompositorFrame;
38}
39
revemanb195f41d2015-11-19 22:16:4840namespace exo {
41class Buffer;
Peng Huang583c9dc62017-07-27 23:38:2842class LayerTreeFrameSinkHolder;
reveman27fe2642015-11-20 06:33:3943class SurfaceObserver;
jbaumanbd9586a92016-05-28 01:09:0344class Surface;
45
jbaumanb362a892016-06-17 03:30:5646namespace subtle {
47class PropertyHelper;
48}
49
David Revemanfca309b2017-08-24 18:18:1150// Counter-clockwise rotations.
51enum class Transform { NORMAL, ROTATE_90, ROTATE_180, ROTATE_270 };
52
revemanb195f41d2015-11-19 22:16:4853// This class represents a rectangular area that is displayed on the screen.
54// It has a location, size and pixel contents.
Hans Wennborgaf90ff12017-09-04 19:46:0255class Surface final : public ui::PropertyHandler {
revemanb195f41d2015-11-19 22:16:4856 public:
reveman2d3815d2016-06-26 20:13:2557 using PropertyDeallocator = void (*)(int64_t value);
jbaumanb362a892016-06-17 03:30:5658
revemanb195f41d2015-11-19 22:16:4859 Surface();
Peng Huang583c9dc62017-07-27 23:38:2860 ~Surface();
revemanb195f41d2015-11-19 22:16:4861
reveman39b32c872015-12-08 05:34:0562 // Type-checking downcast routine.
kinabad14ca03e2016-02-23 04:43:3563 static Surface* AsSurface(const aura::Window* window);
reveman39b32c872015-12-08 05:34:0564
jbaumane3526252016-06-09 18:43:0565 aura::Window* window() { return window_.get(); }
66
revemanb195f41d2015-11-19 22:16:4867 // Set a buffer as the content of this surface. A buffer can only be attached
68 // to one surface at a time.
69 void Attach(Buffer* buffer);
70
71 // Describe the regions where the pending buffer is different from the
72 // current surface contents, and where the surface therefore needs to be
73 // repainted.
74 void Damage(const gfx::Rect& rect);
75
reveman211cf802017-01-10 00:30:5976 // Request notification when it's a good time to produce a new frame. Useful
77 // for throttling redrawing operations, and driving animations.
revemanb195f41d2015-11-19 22:16:4878 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>;
79 void RequestFrameCallback(const FrameCallback& callback);
80
reveman211cf802017-01-10 00:30:5981 // Request notification when the next frame is displayed. Useful for
82 // throttling redrawing operations, and driving animations.
83 using PresentationCallback =
Sadrul Habib Chowdhuryb62a97302018-06-06 03:33:4884 base::Callback<void(const gfx::PresentationFeedback&)>;
reveman211cf802017-01-10 00:30:5985 void RequestPresentationCallback(const PresentationCallback& callback);
86
revemanb195f41d2015-11-19 22:16:4887 // This sets the region of the surface that contains opaque content.
Dominik Laskowski0dcf91352017-11-29 19:21:3588 void SetOpaqueRegion(const cc::Region& region);
revemanb195f41d2015-11-19 22:16:4889
reveman2966d7702016-02-12 02:09:5490 // This sets the region of the surface that can receive pointer and touch
Dominik Laskowski57064702017-11-30 10:31:4191 // events. The region is clipped to the surface bounds.
Dominik Laskowski0dcf91352017-11-29 19:21:3592 void SetInputRegion(const cc::Region& region);
Scott Violetdb1f0682018-08-30 19:19:4693 const cc::Region& hit_test_region() const { return hit_test_region_; }
reveman2966d7702016-02-12 02:09:5494
Mike Reed2c570fa2018-01-11 21:59:2295 // This resets the region of the surface that can receive pointer and touch
96 // events to be wide-open. This will be clipped to the surface bounds.
97 void ResetInputRegion();
98
Dominik Laskowski2d4316412017-12-13 19:14:4499 // This overrides the input region to the surface bounds with an outset.
100 // TODO(domlaskowski): Remove this once client-driven resizing is removed.
101 void SetInputOutset(int outset);
102
reveman7efa4b02016-01-06 08:29:54103 // This sets the scaling factor used to interpret the contents of the buffer
104 // attached to the surface. Note that if the scale is larger than 1, then you
105 // have to attach a buffer that is larger (by a factor of scale in each
106 // dimension) than the desired surface size.
107 void SetBufferScale(float scale);
108
David Revemanfca309b2017-08-24 18:18:11109 // This sets the transformation used to interpret the contents of the buffer
110 // attached to the surface.
111 void SetBufferTransform(Transform transform);
112
reveman27fe2642015-11-20 06:33:39113 // Functions that control sub-surface state. All sub-surface state is
114 // double-buffered and will be applied when Commit() is called.
115 void AddSubSurface(Surface* sub_surface);
116 void RemoveSubSurface(Surface* sub_surface);
117 void SetSubSurfacePosition(Surface* sub_surface, const gfx::Point& position);
118 void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference);
119 void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling);
David Reveman8b43b352017-11-03 15:24:51120 void OnSubSurfaceCommit();
reveman27fe2642015-11-20 06:33:39121
reveman642d8c332016-02-19 19:55:44122 // This sets the surface viewport for scaling.
123 void SetViewport(const gfx::Size& viewport);
124
reveman8e323902016-05-23 21:55:36125 // This sets the surface crop rectangle.
126 void SetCrop(const gfx::RectF& crop);
127
reveman85b7a562016-03-17 23:27:32128 // This sets the only visible on secure output flag, preventing it from
129 // appearing in screenshots or from being viewed on non-secure displays.
130 void SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output);
131
revemanfca687e2016-05-10 21:44:48132 // This sets the blend mode that will be used when drawing the surface.
reedcc9c70f2016-11-22 04:26:01133 void SetBlendMode(SkBlendMode blend_mode);
revemanfca687e2016-05-10 21:44:48134
135 // This sets the alpha value that will be applied to the whole surface.
136 void SetAlpha(float alpha);
137
David Reveman93f67c02017-09-06 03:23:08138 // Request that surface should have the specified frame type.
139 void SetFrame(SurfaceFrameType type);
140
David Reveman786d3182017-12-20 22:04:33141 // Request that surface should use a specific set of frame colors.
142 void SetFrameColors(SkColor active_color, SkColor inactive_color);
143
David Reveman21e2236d2018-04-12 06:01:10144 // Request that surface should have a specific startup ID string.
Tim Zheng08df5662018-04-04 05:08:15145 void SetStartupId(const char* startup_id);
146
David Reveman21e2236d2018-04-12 06:01:10147 // Request that surface should have a specific application ID string.
148 void SetApplicationId(const char* application_id);
149
David Reveman32715092017-12-05 18:24:11150 // Request "parent" for surface.
151 void SetParent(Surface* parent, const gfx::Point& position);
152
Ryo Hashimoto8f10c882018-11-28 17:43:52153 // Request that surface should have a specific ID assigned by client.
154 void SetClientSurfaceId(int32_t client_surface_id);
155 int32_t GetClientSurfaceId() const;
156
revemanb195f41d2015-11-19 22:16:48157 // Surface state (damage regions, attached buffers, etc.) is double-buffered.
158 // A Commit() call atomically applies all pending state, replacing the
reveman27fe2642015-11-20 06:33:39159 // current state. Commit() is not guaranteed to be synchronous. See
160 // CommitSurfaceHierarchy() below.
revemanb195f41d2015-11-19 22:16:48161 void Commit();
162
David Reveman8b43b352017-11-03 15:24:51163 // This will commit all pending state of the surface and its descendants by
David Reveman7a126ba2017-11-09 17:17:41164 // recursively calling CommitSurfaceHierarchy() for each sub-surface.
165 // If |synchronized| is set to false, then synchronized surfaces should not
166 // commit pending state.
David Revemanef1cb082017-11-09 21:14:40167 void CommitSurfaceHierarchy(bool synchronized);
reveman27fe2642015-11-20 06:33:39168
David Revemanef1cb082017-11-09 21:14:40169 // This will append current callbacks for surface and its descendants to
170 // |frame_callbacks| and |presentation_callbacks|.
171 void AppendSurfaceHierarchyCallbacks(
172 std::list<FrameCallback>* frame_callbacks,
173 std::list<PresentationCallback>* presentation_callbacks);
174
175 // This will append contents for surface and its descendants to frame.
Peng Huang76f5fd02017-09-01 00:59:39176 void AppendSurfaceHierarchyContentsToFrame(
177 const gfx::Point& origin,
178 float device_scale_factor,
179 LayerTreeFrameSinkHolder* frame_sink_holder,
danakj5e0a12b2017-09-25 17:26:49180 viz::CompositorFrame* frame);
Peng Huang76f5fd02017-09-01 00:59:39181
reveman27fe2642015-11-20 06:33:39182 // Returns true if surface is in synchronized mode.
183 bool IsSynchronized() const;
184
Dominik Laskowski14a163772018-02-09 19:25:18185 // Returns true if surface should receive input events.
186 bool IsInputEnabled(Surface* surface) const;
Dominik Laskowski3e2f94792017-12-15 00:27:10187
Dominik Laskowski57064702017-11-30 10:31:41188 // Returns false if the hit test region is empty.
189 bool HasHitTestRegion() const;
reveman2966d7702016-02-12 02:09:54190
Dominik Laskowski57064702017-11-30 10:31:41191 // Returns true if |point| is inside the surface.
192 bool HitTest(const gfx::Point& point) const;
reveman2966d7702016-02-12 02:09:54193
Dominik Laskowski57064702017-11-30 10:31:41194 // Sets |mask| to the path that delineates the hit test region of the surface.
Raul Tambre038e96d2019-01-07 21:47:44195 void GetHitTestMask(SkPath* mask) const;
reveman4c94cf962015-12-03 06:49:43196
revemanb195f41d2015-11-19 22:16:48197 // Set the surface delegate.
198 void SetSurfaceDelegate(SurfaceDelegate* delegate);
199
reveman27fe2642015-11-20 06:33:39200 // Returns true if surface has been assigned a surface delegate.
201 bool HasSurfaceDelegate() const;
202
203 // Surface does not own observers. It is the responsibility of the observer
204 // to remove itself when it is done observing.
205 void AddSurfaceObserver(SurfaceObserver* observer);
206 void RemoveSurfaceObserver(SurfaceObserver* observer);
207 bool HasSurfaceObserver(const SurfaceObserver* observer) const;
208
revemanb195f41d2015-11-19 22:16:48209 // Returns a trace value representing the state of the surface.
dcheng31759da2016-04-21 01:26:31210 std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const;
revemanb195f41d2015-11-19 22:16:48211
eseckler599d86bb2017-03-15 09:02:55212 // Called when the begin frame source has changed.
Fady Samuelc645ffe2017-07-24 17:28:20213 void SetBeginFrameSource(viz::BeginFrameSource* begin_frame_source);
jbaumanbd9586a92016-05-28 01:09:03214
David Reveman7a126ba2017-11-09 17:17:41215 // Returns the active content size.
Peng Huangb07b0652017-06-27 17:25:22216 const gfx::Size& content_size() const { return content_size_; }
jbaumanb362a892016-06-17 03:30:56217
David Reveman7a126ba2017-11-09 17:17:41218 // Returns the active content bounds for surface hierarchy. ie. the bounding
219 // box of the surface and its descendants, in the local coordinate space of
220 // the surface.
221 const gfx::Rect& surface_hierarchy_content_bounds() const {
222 return surface_hierarchy_content_bounds_;
223 }
224
kaznacheev8e270592017-05-25 06:13:26225 // Returns true if the associated window is in 'stylus-only' mode.
226 bool IsStylusOnly();
227
228 // Enables 'stylus-only' mode for the associated window.
229 void SetStylusOnly();
230
Peng Huangc51f7aba2017-09-05 16:00:39231 // Notify surface that resources and subsurfaces' resources have been lost.
232 void SurfaceHierarchyResourcesLost();
reveman15aee282016-11-04 19:09:20233
Peng Huang583c9dc62017-07-27 23:38:28234 // Returns true if the surface's bounds should be filled opaquely.
235 bool FillsBoundsOpaquely() const;
reveman211cf802017-01-10 00:30:59236
reveman15aee282016-11-04 19:09:20237 bool HasPendingDamageForTesting(const gfx::Rect& damage) const {
Dominik Laskowski0dcf91352017-11-29 19:21:35238 return pending_damage_.Contains(damage);
reveman15aee282016-11-04 19:09:20239 }
240
Eliot Courtneybb051d12018-12-15 02:41:31241 // Set occlusion tracking region for surface.
242 void SetOcclusionTracking(bool tracking);
243
244 // Triggers sending an occlusion update to observers.
245 void OnWindowOcclusionChanged();
246
revemanb195f41d2015-11-19 22:16:48247 private:
jbaumanf4c3f292016-06-11 00:57:33248 struct State {
249 State();
250 ~State();
251
Lei Zhang1c9963ba2018-05-15 04:50:21252 bool operator==(const State& other) const;
253 bool operator!=(const State& other) const { return !(*this == other); }
jbaumanf4c3f292016-06-11 00:57:33254
Dominik Laskowski0dcf91352017-11-29 19:21:35255 cc::Region opaque_region;
Mike Reed2c570fa2018-01-11 21:59:22256 base::Optional<cc::Region> input_region;
Dominik Laskowski2d4316412017-12-13 19:14:44257 int input_outset = 0;
reveman2d3815d2016-06-26 20:13:25258 float buffer_scale = 1.0f;
David Revemanfca309b2017-08-24 18:18:11259 Transform buffer_transform = Transform::NORMAL;
jbaumanf4c3f292016-06-11 00:57:33260 gfx::Size viewport;
261 gfx::RectF crop;
262 bool only_visible_on_secure_output = false;
reedcc9c70f2016-11-22 04:26:01263 SkBlendMode blend_mode = SkBlendMode::kSrcOver;
jbaumanf4c3f292016-06-11 00:57:33264 float alpha = 1.0f;
jbauman45c06862016-06-23 19:35:02265 };
266 class BufferAttachment {
267 public:
268 BufferAttachment();
269 ~BufferAttachment();
270
271 BufferAttachment& operator=(BufferAttachment&& buffer);
272
273 base::WeakPtr<Buffer>& buffer();
274 const base::WeakPtr<Buffer>& buffer() const;
David Revemane6e23342017-11-07 06:18:06275 const gfx::Size& size() const;
jbauman45c06862016-06-23 19:35:02276 void Reset(base::WeakPtr<Buffer> buffer);
277
278 private:
279 base::WeakPtr<Buffer> buffer_;
David Revemane6e23342017-11-07 06:18:06280 gfx::Size size_;
jbauman45c06862016-06-23 19:35:02281
282 DISALLOW_COPY_AND_ASSIGN(BufferAttachment);
jbaumanf4c3f292016-06-11 00:57:33283 };
284
jbaumanb362a892016-06-17 03:30:56285 friend class subtle::PropertyHelper;
286
jbauman45c06862016-06-23 19:35:02287 // Updates current_resource_ with a new resource id corresponding to the
288 // contents of the attached buffer (or id 0, if no buffer is attached).
289 // UpdateSurface must be called afterwards to ensure the release callback
290 // will be called.
Peng Huangc51f7aba2017-09-05 16:00:39291 void UpdateResource(LayerTreeFrameSinkHolder* frame_sink_holder);
jbauman45c06862016-06-23 19:35:02292
Lloyd Pique0a3045f2017-09-15 23:34:12293 // Updates buffer_transform_ to match the current buffer parameters.
Zach Reizner8bcce6e2018-10-31 00:04:37294 void UpdateBufferTransform(bool y_invert);
Lloyd Pique0a3045f2017-09-15 23:34:12295
Peng Huang583c9dc62017-07-27 23:38:28296 // Puts the current surface into a draw quad, and appends the draw quads into
297 // the |frame|.
298 void AppendContentsToFrame(const gfx::Point& origin,
Peng Huang76f5fd02017-09-01 00:59:39299 float device_scale_factor,
danakj5e0a12b2017-09-25 17:26:49300 viz::CompositorFrame* frame);
jbauman45c06862016-06-23 19:35:02301
Peng Huangc51f7aba2017-09-05 16:00:39302 // Update surface content size base on current buffer size.
Peng Huang583c9dc62017-07-27 23:38:28303 void UpdateContentSize();
eseckler599d86bb2017-03-15 09:02:55304
revemanced21f82015-11-24 00:42:49305 // This returns true when the surface has some contents assigned to it.
David Revemane6e23342017-11-07 06:18:06306 bool has_contents() const { return !current_buffer_.size().IsEmpty(); }
revemanced21f82015-11-24 00:42:49307
jbaumane3526252016-06-09 18:43:05308 // This window has the layer which contains the Surface contents.
309 std::unique_ptr<aura::Window> window_;
310
Peng Huang583c9dc62017-07-27 23:38:28311 // This true, if sub_surfaces_ has changes (order, position, etc).
312 bool sub_surfaces_changed_ = false;
jbaumanf4c3f292016-06-11 00:57:33313
jbaumanb362a892016-06-17 03:30:56314 // This is the size of the last committed contents.
315 gfx::Size content_size_;
316
David Reveman7a126ba2017-11-09 17:17:41317 // This is the bounds of the last committed surface hierarchy contents.
318 gfx::Rect surface_hierarchy_content_bounds_;
319
revemanced21f82015-11-24 00:42:49320 // This is true when Attach() has been called and new contents should take
321 // effect next time Commit() is called.
reveman2d3815d2016-06-26 20:13:25322 bool has_pending_contents_ = false;
reveman27fe2642015-11-20 06:33:39323
revemanb195f41d2015-11-19 22:16:48324 // The buffer that will become the content of surface when Commit() is called.
jbauman45c06862016-06-23 19:35:02325 BufferAttachment pending_buffer_;
revemanb195f41d2015-11-19 22:16:48326
327 // The damage region to schedule paint for when Commit() is called.
Dominik Laskowski0dcf91352017-11-29 19:21:35328 cc::Region pending_damage_;
revemanb195f41d2015-11-19 22:16:48329
Peng Huang76f5fd02017-09-01 00:59:39330 // The damage region which will be used by
331 // AppendSurfaceHierarchyContentsToFrame() to generate frame.
Dominik Laskowski0dcf91352017-11-29 19:21:35332 cc::Region damage_;
Peng Huang76f5fd02017-09-01 00:59:39333
revemanb195f41d2015-11-19 22:16:48334 // These lists contains the callbacks to notify the client when it is a good
335 // time to start producing a new frame. These callbacks move to
336 // |frame_callbacks_| when Commit() is called. Later they are moved to
reveman15aee282016-11-04 19:09:20337 // |active_frame_callbacks_| when the effect of the Commit() is scheduled to
338 // be drawn. They fire at the first begin frame notification after this.
revemanb195f41d2015-11-19 22:16:48339 std::list<FrameCallback> pending_frame_callbacks_;
David Revemanef1cb082017-11-09 21:14:40340 std::list<FrameCallback> frame_callbacks_;
reveman211cf802017-01-10 00:30:59341
342 // These lists contains the callbacks to notify the client when surface
343 // contents have been presented. These callbacks move to
344 // |presentation_callbacks_| when Commit() is called. Later they are moved to
345 // |swapping_presentation_callbacks_| when the effect of the Commit() is
346 // scheduled to be drawn and then moved to |swapped_presentation_callbacks_|
347 // after receiving VSync parameters update for the previous frame. They fire
348 // at the next VSync parameters update after that.
349 std::list<PresentationCallback> pending_presentation_callbacks_;
David Revemanef1cb082017-11-09 21:14:40350 std::list<PresentationCallback> presentation_callbacks_;
revemanb195f41d2015-11-19 22:16:48351
jbaumanf4c3f292016-06-11 00:57:33352 // This is the state that has yet to be committed.
353 State pending_state_;
revemanb195f41d2015-11-19 22:16:48354
jbaumanf4c3f292016-06-11 00:57:33355 // This is the state that has been committed.
356 State state_;
reveman7efa4b02016-01-06 08:29:54357
Dominik Laskowski57064702017-11-30 10:31:41358 // Cumulative input region of surface and its sub-surfaces.
359 cc::Region hit_test_region_;
360
reveman27fe2642015-11-20 06:33:39361 // The stack of sub-surfaces to take effect when Commit() is called.
362 // Bottom-most sub-surface at the front of the list and top-most sub-surface
363 // at the back.
364 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>;
365 using SubSurfaceEntryList = std::list<SubSurfaceEntry>;
366 SubSurfaceEntryList pending_sub_surfaces_;
Peng Huang583c9dc62017-07-27 23:38:28367 SubSurfaceEntryList sub_surfaces_;
reveman27fe2642015-11-20 06:33:39368
revemanced21f82015-11-24 00:42:49369 // The buffer that is currently set as content of surface.
jbauman45c06862016-06-23 19:35:02370 BufferAttachment current_buffer_;
revemanced21f82015-11-24 00:42:49371
jbauman2fdc0732016-06-07 00:55:36372 // The last resource that was sent to a surface.
Fady Samuel4f7f0fb32017-07-28 15:33:37373 viz::TransferableResource current_resource_;
jbauman2fdc0732016-06-07 00:55:36374
revemanca132dc2017-01-31 22:35:54375 // Whether the last resource that was sent to a surface has an alpha channel.
376 bool current_resource_has_alpha_ = false;
377
reveman27fe2642015-11-20 06:33:39378 // This is true if a call to Commit() as been made but
379 // CommitSurfaceHierarchy() has not yet been called.
Peng Huang76f5fd02017-09-01 00:59:39380 bool needs_commit_surface_ = false;
reveman27fe2642015-11-20 06:33:39381
Peng Huangc51f7aba2017-09-05 16:00:39382 // This is true if UpdateResources() should be called.
383 bool needs_update_resource_ = true;
384
Lloyd Pique0a3045f2017-09-15 23:34:12385 // The current buffer transform matrix. It specifies the transformation from
386 // normalized buffer coordinates to post-tranform buffer coordinates.
387 gfx::Transform buffer_transform_;
388
reveman7cadea42016-02-05 20:14:38389 // This is set when the compositing starts and passed to active frame
390 // callbacks when compositing successfully ends.
391 base::TimeTicks last_compositing_start_time_;
392
revemanb195f41d2015-11-19 22:16:48393 // This can be set to have some functions delegated. E.g. ShellSurface class
394 // can set this to handle Commit() and apply any double buffered state it
395 // maintains.
reveman2d3815d2016-06-26 20:13:25396 SurfaceDelegate* delegate_ = nullptr;
revemanb195f41d2015-11-19 22:16:48397
reveman27fe2642015-11-20 06:33:39398 // Surface observer list. Surface does not own the observers.
Trent Apteda250ec3ab2018-08-19 08:52:19399 base::ObserverList<SurfaceObserver, true>::Unchecked observers_;
reveman27fe2642015-11-20 06:33:39400
Eliot Courtneybb051d12018-12-15 02:41:31401 // Whether this surface is tracking occlusion for the client.
402 bool is_tracking_occlusion_ = false;
403
revemanb195f41d2015-11-19 22:16:48404 DISALLOW_COPY_AND_ASSIGN(Surface);
405};
406
407} // namespace exo
408
409#endif // COMPONENTS_EXO_SURFACE_H_