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 { |
11 | 11 |
12 TestContextSupport::TestContextSupport() | 12 TestContextSupport::TestContextSupport() |
13 : last_swap_type_(NO_SWAP), | 13 : weak_ptr_factory_(this) { |
14 weak_ptr_factory_(this) { | |
15 } | 14 } |
16 | 15 |
17 TestContextSupport::~TestContextSupport() {} | 16 TestContextSupport::~TestContextSupport() {} |
18 | 17 |
19 void TestContextSupport::SignalSyncPoint(uint32 sync_point, | 18 void TestContextSupport::SignalSyncPoint(uint32 sync_point, |
20 const base::Closure& callback) { | 19 const base::Closure& callback) { |
21 sync_point_callbacks_.push_back(callback); | 20 sync_point_callbacks_.push_back(callback); |
22 base::MessageLoop::current()->PostTask( | 21 base::MessageLoop::current()->PostTask( |
23 FROM_HERE, | 22 FROM_HERE, |
24 base::Bind(&TestContextSupport::CallAllSyncPointCallbacks, | 23 base::Bind(&TestContextSupport::CallAllSyncPointCallbacks, |
(...skipping 27 matching lines...) Expand all Loading... |
52 const SurfaceVisibleCallback& set_visible_callback) { | 51 const SurfaceVisibleCallback& set_visible_callback) { |
53 set_visible_callback_ = set_visible_callback; | 52 set_visible_callback_ = set_visible_callback; |
54 } | 53 } |
55 | 54 |
56 void TestContextSupport::SetScheduleOverlayPlaneCallback( | 55 void TestContextSupport::SetScheduleOverlayPlaneCallback( |
57 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) { | 56 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) { |
58 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback; | 57 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback; |
59 } | 58 } |
60 | 59 |
61 void TestContextSupport::Swap() { | 60 void TestContextSupport::Swap() { |
62 last_swap_type_ = SWAP; | |
63 } | 61 } |
64 | 62 |
65 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() { | 63 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() { |
66 NOTIMPLEMENTED(); | 64 NOTIMPLEMENTED(); |
67 return 0; | 65 return 0; |
68 } | 66 } |
69 | 67 |
70 void TestContextSupport::RetireSyncPointCHROMIUM(uint32 sync_point) { | 68 void TestContextSupport::RetireSyncPointCHROMIUM(uint32 sync_point) { |
71 NOTIMPLEMENTED(); | 69 NOTIMPLEMENTED(); |
72 } | 70 } |
73 | 71 |
74 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { | 72 void TestContextSupport::PartialSwapBuffers(const gfx::Rect& sub_buffer) { |
75 last_swap_type_ = PARTIAL_SWAP; | |
76 last_partial_swap_rect_ = sub_buffer; | |
77 } | 73 } |
78 | 74 |
79 void TestContextSupport::ScheduleOverlayPlane( | 75 void TestContextSupport::ScheduleOverlayPlane( |
80 int plane_z_order, | 76 int plane_z_order, |
81 gfx::OverlayTransform plane_transform, | 77 gfx::OverlayTransform plane_transform, |
82 unsigned overlay_texture_id, | 78 unsigned overlay_texture_id, |
83 const gfx::Rect& display_bounds, | 79 const gfx::Rect& display_bounds, |
84 const gfx::RectF& uv_rect) { | 80 const gfx::RectF& uv_rect) { |
85 if (!schedule_overlay_plane_callback_.is_null()) { | 81 if (!schedule_overlay_plane_callback_.is_null()) { |
86 schedule_overlay_plane_callback_.Run(plane_z_order, | 82 schedule_overlay_plane_callback_.Run(plane_z_order, |
87 plane_transform, | 83 plane_transform, |
88 overlay_texture_id, | 84 overlay_texture_id, |
89 display_bounds, | 85 display_bounds, |
90 uv_rect); | 86 uv_rect); |
91 } | 87 } |
92 } | 88 } |
93 | 89 |
94 } // namespace cc | 90 } // namespace cc |
OLD | NEW |