OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 COMPONENTS_EXO_SURFACE_H_ | 5 #ifndef COMPONENTS_EXO_SURFACE_H_ |
6 #define COMPONENTS_EXO_SURFACE_H_ | 6 #define COMPONENTS_EXO_SURFACE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <memory> | 9 #include <memory> |
10 #include <set> | 10 #include <set> |
11 #include <utility> | 11 #include <utility> |
12 | 12 |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/macros.h" | 14 #include "base/macros.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "base/observer_list.h" | 17 #include "base/observer_list.h" |
| 18 #include "cc/resources/transferable_resource.h" |
18 #include "cc/surfaces/surface_factory_client.h" | 19 #include "cc/surfaces/surface_factory_client.h" |
19 #include "third_party/skia/include/core/SkRegion.h" | 20 #include "third_party/skia/include/core/SkRegion.h" |
20 #include "third_party/skia/include/core/SkXfermode.h" | 21 #include "third_party/skia/include/core/SkXfermode.h" |
21 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
22 #include "ui/aura/window_observer.h" | 23 #include "ui/aura/window_observer.h" |
23 #include "ui/compositor/compositor_observer.h" | 24 #include "ui/compositor/compositor_observer.h" |
24 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
25 | 26 |
26 namespace base { | 27 namespace base { |
27 namespace trace_event { | 28 namespace trace_event { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 bool has_contents() const { return !!current_buffer_; } | 232 bool has_contents() const { return !!current_buffer_; } |
232 | 233 |
233 // This is true if the buffer contents should be put in a SurfaceLayer | 234 // This is true if the buffer contents should be put in a SurfaceLayer |
234 // rather than a TextureLayer. | 235 // rather than a TextureLayer. |
235 static bool use_surface_layer_; | 236 static bool use_surface_layer_; |
236 | 237 |
237 // This is true when Attach() has been called and new contents should take | 238 // This is true when Attach() has been called and new contents should take |
238 // effect next time Commit() is called. | 239 // effect next time Commit() is called. |
239 bool has_pending_contents_; | 240 bool has_pending_contents_; |
240 | 241 |
| 242 bool changed_viewport_or_crop_ = false; |
| 243 |
241 // The buffer that will become the content of surface when Commit() is called. | 244 // The buffer that will become the content of surface when Commit() is called. |
242 base::WeakPtr<Buffer> pending_buffer_; | 245 base::WeakPtr<Buffer> pending_buffer_; |
243 | 246 |
244 cc::SurfaceManager* surface_manager_; | 247 cc::SurfaceManager* surface_manager_; |
245 | 248 |
246 scoped_refptr<SurfaceFactoryOwner> factory_owner_; | 249 scoped_refptr<SurfaceFactoryOwner> factory_owner_; |
247 | 250 |
248 // The Surface Id currently attached to the window. | 251 // The Surface Id currently attached to the window. |
249 cc::SurfaceId surface_id_; | 252 cc::SurfaceId surface_id_; |
250 | 253 |
251 // The next resource id the buffer will be attached to. | 254 // The next resource id the buffer will be attached to. |
252 int next_resource_id_ = 0; | 255 int next_resource_id_ = 1; |
253 | 256 |
254 // The damage region to schedule paint for when Commit() is called. | 257 // The damage region to schedule paint for when Commit() is called. |
255 SkRegion pending_damage_; | 258 SkRegion pending_damage_; |
256 | 259 |
257 // These lists contains the callbacks to notify the client when it is a good | 260 // These lists contains the callbacks to notify the client when it is a good |
258 // time to start producing a new frame. These callbacks move to | 261 // time to start producing a new frame. These callbacks move to |
259 // |frame_callbacks_| when Commit() is called. Later they are moved to | 262 // |frame_callbacks_| when Commit() is called. Later they are moved to |
260 // |active_frame_callbacks_| when the effect of the Commit() is reflected in | 263 // |active_frame_callbacks_| when the effect of the Commit() is reflected in |
261 // the compositor's active layer tree. The callbacks fire once we're notified | 264 // the compositor's active layer tree. The callbacks fire once we're notified |
262 // that the compositor started drawing that active layer tree. | 265 // that the compositor started drawing that active layer tree. |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 | 297 |
295 // The alpha state to take effect when Commit() is called. | 298 // The alpha state to take effect when Commit() is called. |
296 float pending_alpha_; | 299 float pending_alpha_; |
297 | 300 |
298 // The active alpha state. | 301 // The active alpha state. |
299 float alpha_; | 302 float alpha_; |
300 | 303 |
301 // The buffer that is currently set as content of surface. | 304 // The buffer that is currently set as content of surface. |
302 base::WeakPtr<Buffer> current_buffer_; | 305 base::WeakPtr<Buffer> current_buffer_; |
303 | 306 |
| 307 // The last resource that was sent to a surface. |
| 308 cc::TransferableResource current_resource_; |
| 309 |
304 // The active input region used for hit testing. | 310 // The active input region used for hit testing. |
305 SkRegion input_region_; | 311 SkRegion input_region_; |
306 | 312 |
307 // This is true if a call to Commit() as been made but | 313 // This is true if a call to Commit() as been made but |
308 // CommitSurfaceHierarchy() has not yet been called. | 314 // CommitSurfaceHierarchy() has not yet been called. |
309 bool needs_commit_surface_hierarchy_; | 315 bool needs_commit_surface_hierarchy_; |
310 | 316 |
311 // This is set when the compositing starts and passed to active frame | 317 // This is set when the compositing starts and passed to active frame |
312 // callbacks when compositing successfully ends. | 318 // callbacks when compositing successfully ends. |
313 base::TimeTicks last_compositing_start_time_; | 319 base::TimeTicks last_compositing_start_time_; |
(...skipping 18 matching lines...) Expand all Loading... |
332 | 338 |
333 // Surface observer list. Surface does not own the observers. | 339 // Surface observer list. Surface does not own the observers. |
334 base::ObserverList<SurfaceObserver, true> observers_; | 340 base::ObserverList<SurfaceObserver, true> observers_; |
335 | 341 |
336 DISALLOW_COPY_AND_ASSIGN(Surface); | 342 DISALLOW_COPY_AND_ASSIGN(Surface); |
337 }; | 343 }; |
338 | 344 |
339 } // namespace exo | 345 } // namespace exo |
340 | 346 |
341 #endif // COMPONENTS_EXO_SURFACE_H_ | 347 #endif // COMPONENTS_EXO_SURFACE_H_ |
OLD | NEW |