reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 1 | // 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> |
dcheng | 31759da | 2016-04-21 01:26:31 | [diff] [blame] | 9 | #include <memory> |
reveman | 70baca1 | 2016-05-31 20:35:30 | [diff] [blame] | 10 | #include <set> |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 11 | #include <utility> |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 12 | |
| 13 | #include "base/callback.h" |
| 14 | #include "base/macros.h" |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 15 | #include "base/memory/ref_counted.h" |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 16 | #include "base/memory/weak_ptr.h" |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 17 | #include "base/observer_list.h" |
jbauman | 2fdc073 | 2016-06-07 00:55:36 | [diff] [blame] | 18 | #include "cc/resources/transferable_resource.h" |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 19 | #include "cc/surfaces/surface_factory_client.h" |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 20 | #include "third_party/skia/include/core/SkRegion.h" |
reveman | fca687e | 2016-05-10 21:44:48 | [diff] [blame] | 21 | #include "third_party/skia/include/core/SkXfermode.h" |
reveman | 4c94cf96 | 2015-12-03 06:49:43 | [diff] [blame] | 22 | #include "ui/aura/window.h" |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 23 | #include "ui/aura/window_observer.h" |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 24 | #include "ui/compositor/compositor_observer.h" |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 25 | #include "ui/compositor/layer_owner_delegate.h" |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 26 | #include "ui/gfx/geometry/rect.h" |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 27 | |
| 28 | namespace base { |
| 29 | namespace trace_event { |
| 30 | class TracedValue; |
| 31 | } |
| 32 | } |
| 33 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 34 | namespace cc { |
| 35 | class SurfaceFactory; |
| 36 | enum class SurfaceDrawStatus; |
| 37 | } |
| 38 | |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 39 | namespace gfx { |
| 40 | class Path; |
| 41 | } |
| 42 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 43 | namespace exo { |
| 44 | class Buffer; |
reveman | 70baca1 | 2016-05-31 20:35:30 | [diff] [blame] | 45 | class Pointer; |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 46 | class SurfaceDelegate; |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 47 | class SurfaceObserver; |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 48 | class Surface; |
| 49 | |
reveman | 70baca1 | 2016-05-31 20:35:30 | [diff] [blame] | 50 | // The pointer class is currently the only cursor provider class but this can |
| 51 | // change in the future when better hardware cursor support is added. |
| 52 | using CursorProvider = Pointer; |
| 53 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 54 | // This class owns the SurfaceFactory and keeps track of references to the |
| 55 | // contents of Buffers. It's keeped alive by references from |
| 56 | // release_callbacks_. It's destroyed when its owning Surface is destroyed and |
| 57 | // the last outstanding release callback is called. |
| 58 | class SurfaceFactoryOwner : public base::RefCounted<SurfaceFactoryOwner>, |
| 59 | public cc::SurfaceFactoryClient { |
| 60 | public: |
| 61 | SurfaceFactoryOwner(); |
| 62 | |
| 63 | // Overridden from cc::SurfaceFactoryClient: |
| 64 | void ReturnResources(const cc::ReturnedResourceArray& resources) override; |
| 65 | void WillDrawSurface(cc::SurfaceId id, const gfx::Rect& damage_rect) override; |
| 66 | void SetBeginFrameSource(cc::BeginFrameSource* begin_frame_source) override; |
| 67 | |
| 68 | private: |
| 69 | friend class base::RefCounted<SurfaceFactoryOwner>; |
| 70 | friend class Surface; |
| 71 | ~SurfaceFactoryOwner() override; |
| 72 | |
| 73 | std::map<int, |
| 74 | std::pair<scoped_refptr<SurfaceFactoryOwner>, |
| 75 | std::unique_ptr<cc::SingleReleaseCallback>>> |
| 76 | release_callbacks_; |
| 77 | std::unique_ptr<cc::SurfaceIdAllocator> id_allocator_; |
| 78 | std::unique_ptr<cc::SurfaceFactory> surface_factory_; |
| 79 | Surface* surface_; |
| 80 | }; |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 81 | |
| 82 | // This class represents a rectangular area that is displayed on the screen. |
| 83 | // It has a location, size and pixel contents. |
jbauman | e352625 | 2016-06-09 18:43:05 | [diff] [blame^] | 84 | class Surface : public aura::WindowObserver, |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 85 | public ui::LayerOwnerDelegate, |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 86 | public ui::CompositorObserver { |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 87 | public: |
| 88 | Surface(); |
| 89 | ~Surface() override; |
| 90 | |
reveman | 39b32c87 | 2015-12-08 05:34:05 | [diff] [blame] | 91 | // Type-checking downcast routine. |
kinaba | d14ca03e | 2016-02-23 04:43:35 | [diff] [blame] | 92 | static Surface* AsSurface(const aura::Window* window); |
reveman | 39b32c87 | 2015-12-08 05:34:05 | [diff] [blame] | 93 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 94 | // Sets whether to put the contents in a SurfaceLayer or a TextureLayer. |
| 95 | static void SetUseSurfaceLayer(bool use_surface_layer); |
| 96 | |
jbauman | e352625 | 2016-06-09 18:43:05 | [diff] [blame^] | 97 | aura::Window* window() { return window_.get(); } |
| 98 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 99 | // Set a buffer as the content of this surface. A buffer can only be attached |
| 100 | // to one surface at a time. |
| 101 | void Attach(Buffer* buffer); |
| 102 | |
| 103 | // Describe the regions where the pending buffer is different from the |
| 104 | // current surface contents, and where the surface therefore needs to be |
| 105 | // repainted. |
| 106 | void Damage(const gfx::Rect& rect); |
| 107 | |
| 108 | // Request notification when the next frame is displayed. Useful for |
| 109 | // throttling redrawing operations, and driving animations. |
| 110 | using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; |
| 111 | void RequestFrameCallback(const FrameCallback& callback); |
| 112 | |
| 113 | // This sets the region of the surface that contains opaque content. |
| 114 | void SetOpaqueRegion(const SkRegion& region); |
| 115 | |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 116 | // This sets the region of the surface that can receive pointer and touch |
| 117 | // events. |
| 118 | void SetInputRegion(const SkRegion& region); |
| 119 | |
reveman | 7efa4b0 | 2016-01-06 08:29:54 | [diff] [blame] | 120 | // This sets the scaling factor used to interpret the contents of the buffer |
| 121 | // attached to the surface. Note that if the scale is larger than 1, then you |
| 122 | // have to attach a buffer that is larger (by a factor of scale in each |
| 123 | // dimension) than the desired surface size. |
| 124 | void SetBufferScale(float scale); |
| 125 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 126 | // Functions that control sub-surface state. All sub-surface state is |
| 127 | // double-buffered and will be applied when Commit() is called. |
| 128 | void AddSubSurface(Surface* sub_surface); |
| 129 | void RemoveSubSurface(Surface* sub_surface); |
| 130 | void SetSubSurfacePosition(Surface* sub_surface, const gfx::Point& position); |
| 131 | void PlaceSubSurfaceAbove(Surface* sub_surface, Surface* reference); |
| 132 | void PlaceSubSurfaceBelow(Surface* sub_surface, Surface* sibling); |
| 133 | |
reveman | 642d8c33 | 2016-02-19 19:55:44 | [diff] [blame] | 134 | // This sets the surface viewport for scaling. |
| 135 | void SetViewport(const gfx::Size& viewport); |
| 136 | |
reveman | 8e32390 | 2016-05-23 21:55:36 | [diff] [blame] | 137 | // This sets the surface crop rectangle. |
| 138 | void SetCrop(const gfx::RectF& crop); |
| 139 | |
reveman | 85b7a56 | 2016-03-17 23:27:32 | [diff] [blame] | 140 | // This sets the only visible on secure output flag, preventing it from |
| 141 | // appearing in screenshots or from being viewed on non-secure displays. |
| 142 | void SetOnlyVisibleOnSecureOutput(bool only_visible_on_secure_output); |
| 143 | |
reveman | fca687e | 2016-05-10 21:44:48 | [diff] [blame] | 144 | // This sets the blend mode that will be used when drawing the surface. |
| 145 | void SetBlendMode(SkXfermode::Mode blend_mode); |
| 146 | |
| 147 | // This sets the alpha value that will be applied to the whole surface. |
| 148 | void SetAlpha(float alpha); |
| 149 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 150 | // Surface state (damage regions, attached buffers, etc.) is double-buffered. |
| 151 | // A Commit() call atomically applies all pending state, replacing the |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 152 | // current state. Commit() is not guaranteed to be synchronous. See |
| 153 | // CommitSurfaceHierarchy() below. |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 154 | void Commit(); |
| 155 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 156 | // This will synchronously commit all pending state of the surface and its |
| 157 | // descendants by recursively calling CommitSurfaceHierarchy() for each |
| 158 | // sub-surface with pending state. |
| 159 | void CommitSurfaceHierarchy(); |
| 160 | |
| 161 | // Returns true if surface is in synchronized mode. |
| 162 | bool IsSynchronized() const; |
| 163 | |
reveman | b947076 | 2016-04-10 03:49:24 | [diff] [blame] | 164 | // Returns the bounds of the current input region of surface. |
| 165 | gfx::Rect GetHitTestBounds() const; |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 166 | |
| 167 | // Returns true if |rect| intersects this surface's bounds. |
| 168 | bool HitTestRect(const gfx::Rect& rect) const; |
| 169 | |
| 170 | // Returns true if the current input region is different than the surface |
| 171 | // bounds. |
| 172 | bool HasHitTestMask() const; |
| 173 | |
| 174 | // Returns the current input region of surface in the form of a hit-test mask. |
| 175 | void GetHitTestMask(gfx::Path* mask) const; |
reveman | 4c94cf96 | 2015-12-03 06:49:43 | [diff] [blame] | 176 | |
reveman | 70baca1 | 2016-05-31 20:35:30 | [diff] [blame] | 177 | // Surface does not own cursor providers. It is the responsibility of the |
| 178 | // caller to remove the cursor provider before it is destroyed. |
| 179 | void RegisterCursorProvider(CursorProvider* provider); |
| 180 | void UnregisterCursorProvider(CursorProvider* provider); |
| 181 | |
| 182 | // Returns true if surface has at least one cursor provider registered. |
| 183 | bool HasCursorProvider() const; |
| 184 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 185 | // Set the surface delegate. |
| 186 | void SetSurfaceDelegate(SurfaceDelegate* delegate); |
| 187 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 188 | // Returns true if surface has been assigned a surface delegate. |
| 189 | bool HasSurfaceDelegate() const; |
| 190 | |
| 191 | // Surface does not own observers. It is the responsibility of the observer |
| 192 | // to remove itself when it is done observing. |
| 193 | void AddSurfaceObserver(SurfaceObserver* observer); |
| 194 | void RemoveSurfaceObserver(SurfaceObserver* observer); |
| 195 | bool HasSurfaceObserver(const SurfaceObserver* observer) const; |
| 196 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 197 | // Returns a trace value representing the state of the surface. |
dcheng | 31759da | 2016-04-21 01:26:31 | [diff] [blame] | 198 | std::unique_ptr<base::trace_event::TracedValue> AsTracedValue() const; |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 199 | |
reveman | 5c353d5 | 2016-02-11 21:28:56 | [diff] [blame] | 200 | bool HasPendingDamageForTesting(const gfx::Rect& damage) const { |
| 201 | return pending_damage_.contains(gfx::RectToSkIRect(damage)); |
| 202 | } |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 203 | |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 204 | // Overridden from aura::WindowObserver: |
| 205 | void OnWindowAddedToRootWindow(aura::Window* window) override; |
| 206 | void OnWindowRemovingFromRootWindow(aura::Window* window, |
| 207 | aura::Window* new_root) override; |
| 208 | |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 209 | // Overridden from ui::LayerOwnerDelegate: |
| 210 | void OnLayerRecreated(ui::Layer* old_layer, ui::Layer* new_layer) override; |
| 211 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 212 | // Overridden from ui::CompositorObserver: |
| 213 | void OnCompositingDidCommit(ui::Compositor* compositor) override; |
| 214 | void OnCompositingStarted(ui::Compositor* compositor, |
| 215 | base::TimeTicks start_time) override; |
reveman | ced21f86 | 2015-11-24 00:42:49 | [diff] [blame] | 216 | void OnCompositingEnded(ui::Compositor* compositor) override; |
| 217 | void OnCompositingAborted(ui::Compositor* compositor) override; |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 218 | void OnCompositingLockStateChanged(ui::Compositor* compositor) override {} |
| 219 | void OnCompositingShuttingDown(ui::Compositor* compositor) override; |
| 220 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 221 | void WillDraw(cc::SurfaceId surface_id); |
| 222 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 223 | private: |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 224 | bool needs_commit_surface_hierarchy() const { |
| 225 | return needs_commit_surface_hierarchy_; |
| 226 | } |
| 227 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 228 | // Commit the current attached buffer to a TextureLayer. |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 229 | void CommitTextureContents(); |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 230 | |
| 231 | // Commit the current attached buffer to a SurfaceLayer. |
| 232 | void CommitSurfaceContents(); |
| 233 | |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 234 | // Set TextureLayer contents to the current buffer. |
| 235 | void SetTextureLayerContents(ui::Layer* layer); |
| 236 | |
| 237 | // Set SurfaceLayer contents to the current buffer. |
| 238 | void SetSurfaceLayerContents(ui::Layer* layer); |
| 239 | |
reveman | ced21f86 | 2015-11-24 00:42:49 | [diff] [blame] | 240 | // This returns true when the surface has some contents assigned to it. |
| 241 | bool has_contents() const { return !!current_buffer_; } |
| 242 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 243 | // This is true if the buffer contents should be put in a SurfaceLayer |
| 244 | // rather than a TextureLayer. |
| 245 | static bool use_surface_layer_; |
| 246 | |
jbauman | e352625 | 2016-06-09 18:43:05 | [diff] [blame^] | 247 | // This window has the layer which contains the Surface contents. |
| 248 | std::unique_ptr<aura::Window> window_; |
| 249 | |
reveman | ced21f86 | 2015-11-24 00:42:49 | [diff] [blame] | 250 | // This is true when Attach() has been called and new contents should take |
| 251 | // effect next time Commit() is called. |
| 252 | bool has_pending_contents_; |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 253 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 254 | // The buffer that will become the content of surface when Commit() is called. |
| 255 | base::WeakPtr<Buffer> pending_buffer_; |
| 256 | |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 257 | cc::SurfaceManager* surface_manager_; |
| 258 | |
| 259 | scoped_refptr<SurfaceFactoryOwner> factory_owner_; |
| 260 | |
| 261 | // The Surface Id currently attached to the window. |
| 262 | cc::SurfaceId surface_id_; |
| 263 | |
| 264 | // The next resource id the buffer will be attached to. |
jbauman | 2fdc073 | 2016-06-07 00:55:36 | [diff] [blame] | 265 | int next_resource_id_ = 1; |
jbauman | bd9586a9 | 2016-05-28 01:09:03 | [diff] [blame] | 266 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 267 | // The damage region to schedule paint for when Commit() is called. |
reveman | 5c353d5 | 2016-02-11 21:28:56 | [diff] [blame] | 268 | SkRegion pending_damage_; |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 269 | |
| 270 | // These lists contains the callbacks to notify the client when it is a good |
| 271 | // time to start producing a new frame. These callbacks move to |
| 272 | // |frame_callbacks_| when Commit() is called. Later they are moved to |
| 273 | // |active_frame_callbacks_| when the effect of the Commit() is reflected in |
| 274 | // the compositor's active layer tree. The callbacks fire once we're notified |
| 275 | // that the compositor started drawing that active layer tree. |
| 276 | std::list<FrameCallback> pending_frame_callbacks_; |
| 277 | std::list<FrameCallback> frame_callbacks_; |
| 278 | std::list<FrameCallback> active_frame_callbacks_; |
| 279 | |
| 280 | // The opaque region to take effect when Commit() is called. |
| 281 | SkRegion pending_opaque_region_; |
| 282 | |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 283 | // The input region to take effect when Commit() is called. |
| 284 | SkRegion pending_input_region_; |
| 285 | |
reveman | 7efa4b0 | 2016-01-06 08:29:54 | [diff] [blame] | 286 | // The buffer scaling factor to take effect when Commit() is called. |
| 287 | float pending_buffer_scale_; |
| 288 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 289 | // The stack of sub-surfaces to take effect when Commit() is called. |
| 290 | // Bottom-most sub-surface at the front of the list and top-most sub-surface |
| 291 | // at the back. |
| 292 | using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; |
| 293 | using SubSurfaceEntryList = std::list<SubSurfaceEntry>; |
| 294 | SubSurfaceEntryList pending_sub_surfaces_; |
| 295 | |
reveman | 642d8c33 | 2016-02-19 19:55:44 | [diff] [blame] | 296 | // The viewport to take effect when Commit() is called. |
| 297 | gfx::Size pending_viewport_; |
| 298 | |
reveman | 8e32390 | 2016-05-23 21:55:36 | [diff] [blame] | 299 | // The crop rectangle to take effect when Commit() is called. |
| 300 | gfx::RectF pending_crop_; |
| 301 | |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 302 | // The active crop rectangle. |
| 303 | gfx::RectF crop_; |
| 304 | |
reveman | 85b7a56 | 2016-03-17 23:27:32 | [diff] [blame] | 305 | // The secure output visibility state to take effect when Commit() is called. |
| 306 | bool pending_only_visible_on_secure_output_; |
| 307 | |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 308 | // The active secure output visibility state. |
| 309 | bool only_visible_on_secure_output_; |
| 310 | |
reveman | fca687e | 2016-05-10 21:44:48 | [diff] [blame] | 311 | // The blend mode state to take effect when Commit() is called. |
| 312 | SkXfermode::Mode pending_blend_mode_; |
| 313 | |
| 314 | // The alpha state to take effect when Commit() is called. |
| 315 | float pending_alpha_; |
| 316 | |
reveman | 56f34590 | 2016-06-06 03:58:28 | [diff] [blame] | 317 | // The active alpha state. |
| 318 | float alpha_; |
| 319 | |
reveman | ced21f86 | 2015-11-24 00:42:49 | [diff] [blame] | 320 | // The buffer that is currently set as content of surface. |
| 321 | base::WeakPtr<Buffer> current_buffer_; |
| 322 | |
jbauman | 2fdc073 | 2016-06-07 00:55:36 | [diff] [blame] | 323 | // The last resource that was sent to a surface. |
| 324 | cc::TransferableResource current_resource_; |
| 325 | |
reveman | 2966d770 | 2016-02-12 02:09:54 | [diff] [blame] | 326 | // The active input region used for hit testing. |
| 327 | SkRegion input_region_; |
| 328 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 329 | // This is true if a call to Commit() as been made but |
| 330 | // CommitSurfaceHierarchy() has not yet been called. |
| 331 | bool needs_commit_surface_hierarchy_; |
| 332 | |
reveman | 7cadea4 | 2016-02-05 20:14:38 | [diff] [blame] | 333 | // This is set when the compositing starts and passed to active frame |
| 334 | // callbacks when compositing successfully ends. |
| 335 | base::TimeTicks last_compositing_start_time_; |
| 336 | |
reveman | ced21f86 | 2015-11-24 00:42:49 | [diff] [blame] | 337 | // This is true when the contents of the surface should be updated next time |
| 338 | // the compositor successfully ends compositing. |
| 339 | bool update_contents_after_successful_compositing_; |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 340 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 341 | // The compsitor being observer or null if not observing a compositor. |
| 342 | ui::Compositor* compositor_; |
| 343 | |
reveman | 70baca1 | 2016-05-31 20:35:30 | [diff] [blame] | 344 | // Cursor providers. Surface does not own the cursor providers. |
| 345 | std::set<CursorProvider*> cursor_providers_; |
| 346 | |
reveman | 1468135 | 2016-06-02 15:37:51 | [diff] [blame] | 347 | // Texture size. |
| 348 | gfx::Size texture_size_in_dip_; |
| 349 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 350 | // This can be set to have some functions delegated. E.g. ShellSurface class |
| 351 | // can set this to handle Commit() and apply any double buffered state it |
| 352 | // maintains. |
| 353 | SurfaceDelegate* delegate_; |
| 354 | |
reveman | 27fe264 | 2015-11-20 06:33:39 | [diff] [blame] | 355 | // Surface observer list. Surface does not own the observers. |
| 356 | base::ObserverList<SurfaceObserver, true> observers_; |
| 357 | |
reveman | b195f41d | 2015-11-19 22:16:48 | [diff] [blame] | 358 | DISALLOW_COPY_AND_ASSIGN(Surface); |
| 359 | }; |
| 360 | |
| 361 | } // namespace exo |
| 362 | |
| 363 | #endif // COMPONENTS_EXO_SURFACE_H_ |