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" | |
| 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 (as a raw file descriptor) for the next surface | |
|
reveman
2016/10/09 19:03:17
nit: update comment as this is not a raw file desc
fooishbar
2016/10/12 15:41:56
Done.
| |
| 114 // commit. A buffer must be attached in the same transaction as applying a | |
|
reveman
2016/10/09 19:03:17
What happens if a client doesn't respect this? We
fooishbar
2016/10/12 15:41:56
Probably the same which happens if 'A buffer can o
| |
| 115 // fence. | |
| 116 void FenceAcquire(std::unique_ptr<gfx::GpuFence> fence); | |
|
reveman
2016/10/09 19:03:17
nit: s/FenceAcquire/SetAcquireFence/. We try to ma
fooishbar
2016/10/12 15:41:56
Done.
| |
| 117 | |
| 112 // Describe the regions where the pending buffer is different from the | 118 // Describe the regions where the pending buffer is different from the |
| 113 // current surface contents, and where the surface therefore needs to be | 119 // current surface contents, and where the surface therefore needs to be |
| 114 // repainted. | 120 // repainted. |
| 115 void Damage(const gfx::Rect& rect); | 121 void Damage(const gfx::Rect& rect); |
| 116 | 122 |
| 117 // Request notification when the next frame is displayed. Useful for | 123 // Request notification when the next frame is displayed. Useful for |
| 118 // throttling redrawing operations, and driving animations. | 124 // throttling redrawing operations, and driving animations. |
| 119 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; | 125 using FrameCallback = base::Callback<void(base::TimeTicks frame_time)>; |
| 120 void RequestFrameCallback(const FrameCallback& callback); | 126 void RequestFrameCallback(const FrameCallback& callback); |
| 121 | 127 |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 326 // This is the size of the last committed contents. | 332 // This is the size of the last committed contents. |
| 327 gfx::Size content_size_; | 333 gfx::Size content_size_; |
| 328 | 334 |
| 329 // This is true when Attach() has been called and new contents should take | 335 // This is true when Attach() has been called and new contents should take |
| 330 // effect next time Commit() is called. | 336 // effect next time Commit() is called. |
| 331 bool has_pending_contents_ = false; | 337 bool has_pending_contents_ = false; |
| 332 | 338 |
| 333 // The buffer that will become the content of surface when Commit() is called. | 339 // The buffer that will become the content of surface when Commit() is called. |
| 334 BufferAttachment pending_buffer_; | 340 BufferAttachment pending_buffer_; |
| 335 | 341 |
| 342 std::unique_ptr<gfx::GpuFence> acquire_fence_; | |
|
reveman
2016/10/09 19:03:17
nit: can you move acquire_fence_ just below curren
fooishbar
2016/10/12 15:41:56
Done.
| |
| 343 std::unique_ptr<gfx::GpuFence> pending_acquire_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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 401 | 410 |
| 402 // Surface observer list. Surface does not own the observers. | 411 // Surface observer list. Surface does not own the observers. |
| 403 base::ObserverList<SurfaceObserver, true> observers_; | 412 base::ObserverList<SurfaceObserver, true> observers_; |
| 404 | 413 |
| 405 DISALLOW_COPY_AND_ASSIGN(Surface); | 414 DISALLOW_COPY_AND_ASSIGN(Surface); |
| 406 }; | 415 }; |
| 407 | 416 |
| 408 } // namespace exo | 417 } // namespace exo |
| 409 | 418 |
| 410 #endif // COMPONENTS_EXO_SURFACE_H_ | 419 #endif // COMPONENTS_EXO_SURFACE_H_ |
| OLD | NEW |