Chromium Code Reviews| 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/resources/transferable_resource.h" |
| 19 #include "cc/surfaces/surface_factory_client.h" | 19 #include "cc/surfaces/surface_factory_client.h" |
| 20 #include "third_party/skia/include/core/SkRegion.h" | 20 #include "third_party/skia/include/core/SkRegion.h" |
| 21 #include "third_party/skia/include/core/SkXfermode.h" | 21 #include "third_party/skia/include/core/SkXfermode.h" |
| 22 #include "ui/aura/window.h" | 22 #include "ui/aura/window.h" |
| 23 #include "ui/compositor/compositor.h" | 23 #include "ui/compositor/compositor.h" |
| 24 #include "ui/compositor/layer_owner_delegate.h" | 24 #include "ui/compositor/layer_owner_delegate.h" |
| 25 #include "ui/gfx/geometry/rect.h" | 25 #include "ui/gfx/geometry/rect.h" |
| 26 #include "ui/gfx/gpu_fence.h" | |
|
reveman
2016/10/13 17:13:51
nit: looks like this could be moved to .cc file an
| |
| 26 | 27 |
| 27 namespace base { | 28 namespace base { |
| 28 namespace trace_event { | 29 namespace trace_event { |
| 29 class TracedValue; | 30 class TracedValue; |
| 30 } | 31 } |
| 31 } | 32 } |
| 32 | 33 |
| 33 namespace cc { | 34 namespace cc { |
| 34 class SurfaceFactory; | 35 class SurfaceFactory; |
| 35 } | 36 } |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 102 | 103 |
| 103 aura::Window* window() { return window_.get(); } | 104 aura::Window* window() { return window_.get(); } |
| 104 | 105 |
| 105 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; } | 106 const cc::LocalFrameId& local_frame_id() const { return local_frame_id_; } |
| 106 cc::SurfaceId GetSurfaceId() const; | 107 cc::SurfaceId GetSurfaceId() const; |
| 107 | 108 |
| 108 // Set a buffer as the content of this surface. A buffer can only be attached | 109 // Set a buffer as the content of this surface. A buffer can only be attached |
| 109 // to one surface at a time. | 110 // to one surface at a time. |
| 110 void Attach(Buffer* buffer); | 111 void Attach(Buffer* buffer); |
| 111 | 112 |
| 113 // Provide an acquire-fence for the next surface commit. A buffer must be | |
| 114 // attached in the same transaction as applying a fence. | |
| 115 void SetAcquireFence(std::unique_ptr<gfx::GpuFence> fence); | |
| 116 | |
| 112 // Describe the regions where the pending buffer is different from the | 117 // Describe the regions where the pending buffer is different from the |
| 113 // current surface contents, and where the surface therefore needs to be | 118 // current surface contents, and where the surface therefore needs to be |
| 114 // repainted. | 119 // repainted. |
| 115 void Damage(const gfx::Rect& rect); | 120 void Damage(const gfx::Rect& rect); |
| 116 | 121 |
| 117 // Request notification when the next frame is displayed. Useful for | 122 // Request notification when the next frame is displayed. Useful for |
| 118 // throttling redrawing operations, and driving animations. | 123 // throttling redrawing operations, and driving animations. |
| 119 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; | 124 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; |
| 120 void RequestFrameCallback(const FrameCallback& callback); | 125 void RequestFrameCallback(const FrameCallback& callback); |
| 121 | 126 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 // This is the size of the last committed contents. | 331 // This is the size of the last committed contents. |
| 327 gfx::Size content_size_; | 332 gfx::Size content_size_; |
| 328 | 333 |
| 329 // This is true when Attach() has been called and new contents should take | 334 // This is true when Attach() has been called and new contents should take |
| 330 // effect next time Commit() is called. | 335 // effect next time Commit() is called. |
| 331 bool has_pending_contents_ = false; | 336 bool has_pending_contents_ = false; |
| 332 | 337 |
| 333 // The buffer that will become the content of surface when Commit() is called. | 338 // The buffer that will become the content of surface when Commit() is called. |
| 334 BufferAttachment pending_buffer_; | 339 BufferAttachment pending_buffer_; |
| 335 | 340 |
| 341 // The fence which will be used to wait before sourcing from | |
| 342 // |pending_buffer_|, on next Commit(). | |
| 343 std::unique_ptr<gfx::GpuFence> pending_fence_; | |
| 344 | |
| 336 cc::SurfaceManager* surface_manager_; | 345 cc::SurfaceManager* surface_manager_; |
| 337 | 346 |
| 338 scoped_refptr<SurfaceFactoryOwner> factory_owner_; | 347 scoped_refptr<SurfaceFactoryOwner> factory_owner_; |
| 339 | 348 |
| 340 // The Surface Id currently attached to the window. | 349 // The Surface Id currently attached to the window. |
| 341 cc::LocalFrameId local_frame_id_; | 350 cc::LocalFrameId local_frame_id_; |
| 342 | 351 |
| 343 // The next resource id the buffer will be attached to. | 352 // The next resource id the buffer will be attached to. |
| 344 int next_resource_id_ = 1; | 353 int next_resource_id_ = 1; |
| 345 | 354 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 365 // The stack of sub-surfaces to take effect when Commit() is called. | 374 // The stack of sub-surfaces to take effect when Commit() is called. |
| 366 // Bottom-most sub-surface at the front of the list and top-most sub-surface | 375 // Bottom-most sub-surface at the front of the list and top-most sub-surface |
| 367 // at the back. | 376 // at the back. |
| 368 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; | 377 using SubSurfaceEntry = std::pair<Surface*, gfx::Point>; |
| 369 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; | 378 using SubSurfaceEntryList = std::list<SubSurfaceEntry>; |
| 370 SubSurfaceEntryList pending_sub_surfaces_; | 379 SubSurfaceEntryList pending_sub_surfaces_; |
| 371 | 380 |
| 372 // The buffer that is currently set as content of surface. | 381 // The buffer that is currently set as content of surface. |
| 373 BufferAttachment current_buffer_; | 382 BufferAttachment current_buffer_; |
| 374 | 383 |
| 384 // The fence which will be used to wait before sourcing from | |
| 385 // |current_buffer_|. | |
| 386 std::unique_ptr<gfx::GpuFence> fence_; | |
| 387 | |
| 375 // The last resource that was sent to a surface. | 388 // The last resource that was sent to a surface. |
| 376 cc::TransferableResource current_resource_; | 389 cc::TransferableResource current_resource_; |
| 377 | 390 |
| 378 // This is true if a call to Commit() as been made but | 391 // This is true if a call to Commit() as been made but |
| 379 // CommitSurfaceHierarchy() has not yet been called. | 392 // CommitSurfaceHierarchy() has not yet been called. |
| 380 bool needs_commit_surface_hierarchy_ = false; | 393 bool needs_commit_surface_hierarchy_ = false; |
| 381 | 394 |
| 382 // This is set when the compositing starts and passed to active frame | 395 // This is set when the compositing starts and passed to active frame |
| 383 // callbacks when compositing successfully ends. | 396 // callbacks when compositing successfully ends. |
| 384 base::TimeTicks last_compositing_start_time_; | 397 base::TimeTicks last_compositing_start_time_; |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 401 | 414 |
| 402 // Surface observer list. Surface does not own the observers. | 415 // Surface observer list. Surface does not own the observers. |
| 403 base::ObserverList<SurfaceObserver, true> observers_; | 416 base::ObserverList<SurfaceObserver, true> observers_; |
| 404 | 417 |
| 405 DISALLOW_COPY_AND_ASSIGN(Surface); | 418 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 406 }; | 419 }; |
| 407 | 420 |
| 408 } // namespace exo | 421 } // namespace exo |
| 409 | 422 |
| 410 #endif // COMPONENTS_EXO_SURFACE_H_ | 423 #endif // COMPONENTS_EXO_SURFACE_H_ |
| OLD | NEW |