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/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
(...skipping 22 matching lines...) Expand all Loading... |
33 } | 33 } |
34 | 34 |
35 void TestContextSupport::SignalQuery(uint32 query, | 35 void TestContextSupport::SignalQuery(uint32 query, |
36 const base::Closure& callback) { | 36 const base::Closure& callback) { |
37 sync_point_callbacks_.push_back(callback); | 37 sync_point_callbacks_.push_back(callback); |
38 base::ThreadTaskRunnerHandle::Get()->PostTask( | 38 base::ThreadTaskRunnerHandle::Get()->PostTask( |
39 FROM_HERE, base::Bind(&TestContextSupport::CallAllSyncPointCallbacks, | 39 FROM_HERE, base::Bind(&TestContextSupport::CallAllSyncPointCallbacks, |
40 weak_ptr_factory_.GetWeakPtr())); | 40 weak_ptr_factory_.GetWeakPtr())); |
41 } | 41 } |
42 | 42 |
43 void TestContextSupport::SetSurfaceVisible(bool visible) { | |
44 if (!set_visible_callback_.is_null()) { | |
45 set_visible_callback_.Run(visible); | |
46 } | |
47 } | |
48 | |
49 void TestContextSupport::SetAggressivelyFreeResources( | 43 void TestContextSupport::SetAggressivelyFreeResources( |
50 bool aggressively_free_resources) { | 44 bool aggressively_free_resources) { |
51 } | 45 } |
52 | 46 |
53 void TestContextSupport::CallAllSyncPointCallbacks() { | 47 void TestContextSupport::CallAllSyncPointCallbacks() { |
54 size_t size = sync_point_callbacks_.size(); | 48 size_t size = sync_point_callbacks_.size(); |
55 if (out_of_order_callbacks_) { | 49 if (out_of_order_callbacks_) { |
56 for (size_t i = size; i > 0; --i) { | 50 for (size_t i = size; i > 0; --i) { |
57 base::ThreadTaskRunnerHandle::Get()->PostTask( | 51 base::ThreadTaskRunnerHandle::Get()->PostTask( |
58 FROM_HERE, sync_point_callbacks_[i - 1]); | 52 FROM_HERE, sync_point_callbacks_[i - 1]); |
59 } | 53 } |
60 } else { | 54 } else { |
61 for (size_t i = 0; i < size; ++i) { | 55 for (size_t i = 0; i < size; ++i) { |
62 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 56 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
63 sync_point_callbacks_[i]); | 57 sync_point_callbacks_[i]); |
64 } | 58 } |
65 } | 59 } |
66 sync_point_callbacks_.clear(); | 60 sync_point_callbacks_.clear(); |
67 } | 61 } |
68 | 62 |
69 void TestContextSupport::SetSurfaceVisibleCallback( | |
70 const SurfaceVisibleCallback& set_visible_callback) { | |
71 set_visible_callback_ = set_visible_callback; | |
72 } | |
73 | |
74 void TestContextSupport::SetScheduleOverlayPlaneCallback( | 63 void TestContextSupport::SetScheduleOverlayPlaneCallback( |
75 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) { | 64 const ScheduleOverlayPlaneCallback& schedule_overlay_plane_callback) { |
76 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback; | 65 schedule_overlay_plane_callback_ = schedule_overlay_plane_callback; |
77 } | 66 } |
78 | 67 |
79 void TestContextSupport::Swap() { | 68 void TestContextSupport::Swap() { |
80 } | 69 } |
81 | 70 |
82 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() { | 71 uint32 TestContextSupport::InsertFutureSyncPointCHROMIUM() { |
83 NOTIMPLEMENTED(); | 72 NOTIMPLEMENTED(); |
(...skipping 21 matching lines...) Expand all Loading... |
105 uv_rect); | 94 uv_rect); |
106 } | 95 } |
107 } | 96 } |
108 | 97 |
109 uint64_t TestContextSupport::ShareGroupTracingGUID() const { | 98 uint64_t TestContextSupport::ShareGroupTracingGUID() const { |
110 NOTIMPLEMENTED(); | 99 NOTIMPLEMENTED(); |
111 return 0; | 100 return 0; |
112 } | 101 } |
113 | 102 |
114 } // namespace cc | 103 } // namespace cc |
OLD | NEW |