| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 CC_TEST_TEST_CONTEXT_SUPPORT_H_ | 5 #ifndef CC_TEST_TEST_CONTEXT_SUPPORT_H_ |
| 6 #define CC_TEST_TEST_CONTEXT_SUPPORT_H_ | 6 #define CC_TEST_TEST_CONTEXT_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 11 #include "gpu/command_buffer/client/context_support.h" | 11 #include "gpu/command_buffer/client/context_support.h" |
| 12 | 12 |
| 13 namespace cc { | 13 namespace cc { |
| 14 | 14 |
| 15 class TestContextSupport : public gpu::ContextSupport { | 15 class TestContextSupport : public gpu::ContextSupport { |
| 16 public: | 16 public: |
| 17 TestContextSupport(); | 17 TestContextSupport(); |
| 18 virtual ~TestContextSupport(); | 18 virtual ~TestContextSupport(); |
| 19 | 19 |
| 20 // gpu::ContextSupport implementation. | 20 // gpu::ContextSupport implementation. |
| 21 virtual void SignalSyncPoint(uint32 sync_point, | 21 virtual void SignalSyncPoint(uint32 sync_point, |
| 22 const base::Closure& callback) OVERRIDE; | 22 const base::Closure& callback) OVERRIDE; |
| 23 virtual void SignalQuery(uint32 query, | 23 virtual void SignalQuery(uint32 query, |
| 24 const base::Closure& callback) OVERRIDE; | 24 const base::Closure& callback) OVERRIDE; |
| 25 virtual void SetSurfaceVisible(bool visible) OVERRIDE; | 25 virtual void SetSurfaceVisible(bool visible) OVERRIDE; |
| 26 virtual void Swap() OVERRIDE; | |
| 27 virtual void PartialSwapBuffers(const gfx::Rect& sub_buffer) OVERRIDE; | |
| 28 virtual uint32 InsertFutureSyncPointCHROMIUM() OVERRIDE; | 26 virtual uint32 InsertFutureSyncPointCHROMIUM() OVERRIDE; |
| 29 virtual void RetireSyncPointCHROMIUM(uint32 sync_point) OVERRIDE; | 27 virtual void RetireSyncPointCHROMIUM(uint32 sync_point) OVERRIDE; |
| 30 virtual void SetSwapBuffersCompleteCallback( | |
| 31 const base::Closure& callback) OVERRIDE; | |
| 32 virtual void ScheduleOverlayPlane(int plane_z_order, | 28 virtual void ScheduleOverlayPlane(int plane_z_order, |
| 33 gfx::OverlayTransform plane_transform, | 29 gfx::OverlayTransform plane_transform, |
| 34 unsigned overlay_texture_id, | 30 unsigned overlay_texture_id, |
| 35 const gfx::Rect& display_bounds, | 31 const gfx::Rect& display_bounds, |
| 36 const gfx::RectF& uv_rect) OVERRIDE; | 32 const gfx::RectF& uv_rect) OVERRIDE; |
| 37 | 33 |
| 38 void CallAllSyncPointCallbacks(); | 34 void CallAllSyncPointCallbacks(); |
| 39 | 35 |
| 40 typedef base::Callback<void(bool visible)> SurfaceVisibleCallback; | 36 typedef base::Callback<void(bool visible)> SurfaceVisibleCallback; |
| 41 void SetSurfaceVisibleCallback( | 37 void SetSurfaceVisibleCallback( |
| 42 const SurfaceVisibleCallback& set_visible_callback); | 38 const SurfaceVisibleCallback& set_visible_callback); |
| 43 | 39 |
| 44 typedef base::Callback<void(int plane_z_order, | 40 typedef base::Callback<void(int plane_z_order, |
| 45 gfx::OverlayTransform plane_transform, | 41 gfx::OverlayTransform plane_transform, |
| 46 unsigned overlay_texture_id, | 42 unsigned overlay_texture_id, |
| 47 const gfx::Rect& display_bounds, | 43 const gfx::Rect& display_bounds, |
| 48 const gfx::RectF& crop_rect)> | 44 const gfx::RectF& crop_rect)> |
| 49 ScheduleOverlayPlaneCallback; | 45 ScheduleOverlayPlaneCallback; |
| 50 void SetScheduleOverlayPlaneCallback( | 46 void SetScheduleOverlayPlaneCallback( |
| 51 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback); | 47 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback); |
| 52 | 48 |
| 53 enum SwapType { | |
| 54 NO_SWAP, | |
| 55 SWAP, | |
| 56 PARTIAL_SWAP | |
| 57 }; | |
| 58 | |
| 59 SwapType last_swap_type() const { return last_swap_type_; } | |
| 60 gfx::Rect last_partial_swap_rect() const { | |
| 61 return last_partial_swap_rect_; | |
| 62 } | |
| 63 | |
| 64 private: | 49 private: |
| 65 void OnSwapBuffersComplete(); | |
| 66 | |
| 67 std::vector<base::Closure> sync_point_callbacks_; | 50 std::vector<base::Closure> sync_point_callbacks_; |
| 68 SurfaceVisibleCallback set_visible_callback_; | 51 SurfaceVisibleCallback set_visible_callback_; |
| 69 ScheduleOverlayPlaneCallback schedule_overlay_plane_callback_; | 52 ScheduleOverlayPlaneCallback schedule_overlay_plane_callback_; |
| 70 | 53 |
| 71 base::Closure swap_buffers_complete_callback_; | |
| 72 | |
| 73 SwapType last_swap_type_; | |
| 74 gfx::Rect last_partial_swap_rect_; | |
| 75 | |
| 76 base::WeakPtrFactory<TestContextSupport> weak_ptr_factory_; | 54 base::WeakPtrFactory<TestContextSupport> weak_ptr_factory_; |
| 77 | 55 |
| 78 DISALLOW_COPY_AND_ASSIGN(TestContextSupport); | 56 DISALLOW_COPY_AND_ASSIGN(TestContextSupport); |
| 79 }; | 57 }; |
| 80 | 58 |
| 81 } // namespace cc | 59 } // namespace cc |
| 82 | 60 |
| 83 #endif // CC_TEST_TEST_CONTEXT_SUPPORT_H_ | 61 #endif // CC_TEST_TEST_CONTEXT_SUPPORT_H_ |
| OLD | NEW |