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 #include "cc/test/test_context_support.h" | 5 #include "cc/test/test_context_support.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 | 9 |
10 namespace cc { | 10 namespace cc { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 FROM_HERE, sync_point_callbacks_[i]); | 49 FROM_HERE, sync_point_callbacks_[i]); |
50 } | 50 } |
51 sync_point_callbacks_.clear(); | 51 sync_point_callbacks_.clear(); |
52 } | 52 } |
53 | 53 |
54 void TestContextSupport::SetSurfaceVisibleCallback( | 54 void TestContextSupport::SetSurfaceVisibleCallback( |
55 const SurfaceVisibleCallback& set_visible_callback) { | 55 const SurfaceVisibleCallback& set_visible_callback) { |
56 set_visible_callback_ = set_visible_callback; | 56 set_visible_callback_ = set_visible_callback; |
57 } | 57 } |
58 | 58 |
| 59 void TestContextSupport::SetScheduleOverlayPlaneCallback( |
| 60 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) { |
| 61 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback; |
| 62 } |
| 63 |
59 void TestContextSupport::Swap() { | 64 void TestContextSupport::Swap() { |
60 last_swap_type_ = SWAP; | 65 last_swap_type_ = SWAP; |
61 base::MessageLoop::current()->PostTask( | 66 base::MessageLoop::current()->PostTask( |
62 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, | 67 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, |
63 weak_ptr_factory_.GetWeakPtr())); | 68 weak_ptr_factory_.GetWeakPtr())); |
64 } | 69 } |
65 | 70 |
66 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { | 71 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { |
67 last_swap_type_ = PARTIAL_SWAP; | 72 last_swap_type_ = PARTIAL_SWAP; |
68 last_partial_swap_rect_ = sub_buffer; | 73 last_partial_swap_rect_ = sub_buffer; |
69 base::MessageLoop::current()->PostTask( | 74 base::MessageLoop::current()->PostTask( |
70 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, | 75 FROM_HERE, base::Bind(&TestContextSupport::OnSwapBuffersComplete, |
71 weak_ptr_factory_.GetWeakPtr())); | 76 weak_ptr_factory_.GetWeakPtr())); |
72 } | 77 } |
73 | 78 |
| 79 void TestContextSupport::ScheduleOverlayPlane(int plane_z_order, |
| 80 unsigned plane_transform, |
| 81 unsigned overlay_texture_id, |
| 82 const gfx::Rect& display_bounds, |
| 83 gfx::RectF uv_rect) { |
| 84 if (!schedule_overlay_plane_callback_.is_null()) { |
| 85 schedule_overlay_plane_callback_.Run(plane_z_order, |
| 86 plane_transform, |
| 87 overlay_texture_id, |
| 88 display_bounds, |
| 89 uv_rect); |
| 90 } |
| 91 } |
| 92 |
74 void TestContextSupport::SetSwapBuffersCompleteCallback( | 93 void TestContextSupport::SetSwapBuffersCompleteCallback( |
75 const base::Closure& callback) { | 94 const base::Closure& callback) { |
76 swap_buffers_complete_callback_ = callback; | 95 swap_buffers_complete_callback_ = callback; |
77 } | 96 } |
78 | 97 |
79 void TestContextSupport::OnSwapBuffersComplete() { | 98 void TestContextSupport::OnSwapBuffersComplete() { |
80 if (!swap_buffers_complete_callback_.is_null()) | 99 if (!swap_buffers_complete_callback_.is_null()) |
81 swap_buffers_complete_callback_.Run(); | 100 swap_buffers_complete_callback_.Run(); |
82 } | 101 } |
83 | 102 |
84 } // namespace cc | 103 } // namespace cc |
OLD | NEW |