| 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> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace trace_event { | 27 namespace trace_event { |
| 28 class TracedValue; | 28 class TracedValue; |
| 29 } | 29 } |
| 30 } | 30 } |
| 31 | 31 |
| 32 namespace cc { | 32 namespace cc { |
| 33 class SurfaceFactory; | 33 class SurfaceFactory; |
| 34 } | 34 } |
| 35 | 35 |
| 36 namespace gfx { | 36 namespace gfx { |
| 37 class GpuFence; |
| 37 class Path; | 38 class Path; |
| 38 } | 39 } |
| 39 | 40 |
| 40 namespace exo { | 41 namespace exo { |
| 41 class Buffer; | 42 class Buffer; |
| 42 class Pointer; | 43 class Pointer; |
| 43 class SurfaceDelegate; | 44 class SurfaceDelegate; |
| 44 class SurfaceObserver; | 45 class SurfaceObserver; |
| 45 class Surface; | 46 class Surface; |
| 46 | 47 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 101 |
| 101 aura::Window* window() { return window_.get(); } | 102 aura::Window* window() { return window_.get(); } |
| 102 | 103 |
| 103 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; } | 104 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; } |
| 104 cc::SurfaceId GetSurfaceId() const; | 105 cc::SurfaceId GetSurfaceId() const; |
| 105 | 106 |
| 106 // Set a buffer as the content of this surface. A buffer can only be attached | 107 // Set a buffer as the content of this surface. A buffer can only be attached |
| 107 // to one surface at a time. | 108 // to one surface at a time. |
| 108 void Attach(Buffer* buffer); | 109 void Attach(Buffer* buffer); |
| 109 | 110 |
| 111 // Provide an acquire-fence for the next surface commit. A buffer must be |
| 112 // attached in the same transaction as applying a fence. |
| 113 void SetAcquireFence(std::unique_ptr<gfx::GpuFence> fence); |
| 114 |
| 110 // Describe the regions where the pending buffer is different from the | 115 // Describe the regions where the pending buffer is different from the |
| 111 // current surface contents, and where the surface therefore needs to be | 116 // current surface contents, and where the surface therefore needs to be |
| 112 // repainted. | 117 // repainted. |
| 113 void Damage(const gfx::Rect& rect); | 118 void Damage(const gfx::Rect& rect); |
| 114 | 119 |
| 115 // Request notification when the next frame is displayed. Useful for | 120 // Request notification when the next frame is displayed. Useful for |
| 116 // throttling redrawing operations, and driving animations. | 121 // throttling redrawing operations, and driving animations. |
| 117 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; | 122 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; |
| 118 void RequestFrameCallback(const FrameCallback& callback); | 123 void RequestFrameCallback(const FrameCallback& callback); |
| 119 | 124 |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 // This is the size of the last committed contents. | 326 // This is the size of the last committed contents. |
| 322 gfx::Size content_size_; | 327 gfx::Size content_size_; |
| 323 | 328 |
| 324 // This is true when Attach() has been called and new contents should take | 329 // This is true when Attach() has been called and new contents should take |
| 325 // effect next time Commit() is called. | 330 // effect next time Commit() is called. |
| 326 bool has_pending_contents_ = false; | 331 bool has_pending_contents_ = false; |
| 327 | 332 |
| 328 // The buffer that will become the content of surface when Commit() is called. | 333 // The buffer that will become the content of surface when Commit() is called. |
| 329 BufferAttachment pending_buffer_; | 334 BufferAttachment pending_buffer_; |
| 330 | 335 |
| 336 // The fence which will be used to wait before sourcing from |
| 337 // |pending_buffer_|, on next Commit(). |
| 338 std::unique_ptr<gfx::GpuFence> pending_fence_; |
| 339 |
| 331 cc::SurfaceManager* surface_manager_; | 340 cc::SurfaceManager* surface_manager_; |
| 332 | 341 |
| 333 scoped_refptr<SurfaceFactoryOwner> factory_owner_; | 342 scoped_refptr<SurfaceFactoryOwner> factory_owner_; |
| 334 | 343 |
| 335 // The Surface Id currently attached to the window. | 344 // The Surface Id currently attached to the window. |
| 336 cc::LocalFrameId local_frame_id_; | 345 cc::LocalFrameId local_frame_id_; |
| 337 | 346 |
| 338 // The next resource id the buffer will be attached to. | 347 // The next resource id the buffer will be attached to. |
| 339 int next_resource_id_ = 1; | 348 int next_resource_id_ = 1; |
| 340 | 349 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 360 // The stack of sub-surfaces to take effect when Commit() is called. | 369 // The stack of sub-surfaces to take effect when Commit() is called. |
| 361 // Bottom-most sub-surface at the front of the list and top-most sub-surface | 370 // Bottom-most sub-surface at the front of the list and top-most sub-surface |
| 362 // at the back. | 371 // at the back. |
| 363 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; | 372 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; |
| 364 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; | 373 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; |
| 365 SubSurfaceEntryList pending_sub_surfaces_; | 374 SubSurfaceEntryList pending_sub_surfaces_; |
| 366 | 375 |
| 367 // The buffer that is currently set as content of surface. | 376 // The buffer that is currently set as content of surface. |
| 368 BufferAttachment current_buffer_; | 377 BufferAttachment current_buffer_; |
| 369 | 378 |
| 379 // The fence which will be used to wait before sourcing from |
| 380 // |current_buffer_|. |
| 381 std::unique_ptr<gfx::GpuFence> fence_; |
| 382 |
| 370 // The last resource that was sent to a surface. | 383 // The last resource that was sent to a surface. |
| 371 cc::TransferableResource current_resource_; | 384 cc::TransferableResource current_resource_; |
| 372 | 385 |
| 373 // This is true if a call to Commit() as been made but | 386 // This is true if a call to Commit() as been made but |
| 374 // CommitSurfaceHierarchy() has not yet been called. | 387 // CommitSurfaceHierarchy() has not yet been called. |
| 375 bool needs_commit_surface_hierarchy_ = false; | 388 bool needs_commit_surface_hierarchy_ = false; |
| 376 | 389 |
| 377 // This is set when the compositing starts and passed to active frame | 390 // This is set when the compositing starts and passed to active frame |
| 378 // callbacks when compositing successfully ends. | 391 // callbacks when compositing successfully ends. |
| 379 base::TimeTicks last_compositing_start_time_; | 392 base::TimeTicks last_compositing_start_time_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 396 | 409 |
| 397 // Surface observer list. Surface does not own the observers. | 410 // Surface observer list. Surface does not own the observers. |
| 398 base::ObserverList<SurfaceObserver, true> observers_; | 411 base::ObserverList<SurfaceObserver, true> observers_; |
| 399 | 412 |
| 400 DISALLOW_COPY_AND_ASSIGN(Surface); | 413 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 401 }; | 414 }; |
| 402 | 415 |
| 403 } // namespace exo | 416 } // namespace exo |
| 404 | 417 |
| 405 #endif // COMPONENTS_EXO_SURFACE_H_ | 418 #endif // COMPONENTS_EXO_SURFACE_H_ |
| OLD | NEW |