OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/test/proxy_impl_for_test.h" | |
6 | |
7 #include "base/memory/ptr_util.h" | |
8 | |
9 namespace cc { | |
10 std::unique_ptr<ProxyImplForTest> ProxyImplForTest::Create( | |
11 TestHooks* test_hooks, | |
12 ChannelImpl* channel_impl, | |
13 LayerTreeHost* layer_tree_host, | |
14 TaskRunnerProvider* task_runner_provider, | |
15 std::unique_ptr<BeginFrameSource> external_begin_frame_source) { | |
16 return base::WrapUnique(new ProxyImplForTest( | |
17 test_hooks, channel_impl, layer_tree_host, task_runner_provider, | |
18 std::move(external_begin_frame_source))); | |
19 } | |
20 | |
21 ProxyImplForTest::ProxyImplForTest( | |
22 TestHooks* test_hooks, | |
23 ChannelImpl* channel_impl, | |
24 LayerTreeHost* layer_tree_host, | |
25 TaskRunnerProvider* task_runner_provider, | |
26 std::unique_ptr<BeginFrameSource> external_begin_frame_source) | |
27 : ProxyImpl(channel_impl, | |
28 layer_tree_host, | |
29 task_runner_provider, | |
30 std::move(external_begin_frame_source)), | |
31 test_hooks_(test_hooks) {} | |
32 | |
33 void ProxyImplForTest::ScheduledActionSendBeginMainFrame( | |
34 const BeginFrameArgs& args) { | |
35 test_hooks_->ScheduledActionWillSendBeginMainFrame(); | |
36 ProxyImpl::ScheduledActionSendBeginMainFrame(args); | |
37 test_hooks_->ScheduledActionSendBeginMainFrame(); | |
38 } | |
39 | |
40 DrawResult ProxyImplForTest::ScheduledActionDrawAndSwapIfPossible() { | |
41 DrawResult result = ProxyImpl::ScheduledActionDrawAndSwapIfPossible(); | |
42 test_hooks_->ScheduledActionDrawAndSwapIfPossible(); | |
43 return result; | |
44 } | |
45 | |
46 void ProxyImplForTest::ScheduledActionCommit() { | |
47 ProxyImpl::ScheduledActionCommit(); | |
48 test_hooks_->ScheduledActionCommit(); | |
49 } | |
50 | |
51 void ProxyImplForTest::ScheduledActionBeginOutputSurfaceCreation() { | |
52 ProxyImpl::ScheduledActionBeginOutputSurfaceCreation(); | |
53 test_hooks_->ScheduledActionBeginOutputSurfaceCreation(); | |
54 } | |
55 | |
56 void ProxyImplForTest::ScheduledActionPrepareTiles() { | |
57 ProxyImpl::ScheduledActionPrepareTiles(); | |
58 test_hooks_->ScheduledActionPrepareTiles(); | |
59 } | |
60 | |
61 void ProxyImplForTest::ScheduledActionInvalidateOutputSurface() { | |
62 ProxyImpl::ScheduledActionInvalidateOutputSurface(); | |
63 test_hooks_->ScheduledActionInvalidateOutputSurface(); | |
64 } | |
65 | |
66 void ProxyImplForTest::SendBeginMainFrameNotExpectedSoon() { | |
67 ProxyImpl::SendBeginMainFrameNotExpectedSoon(); | |
68 test_hooks_->SendBeginMainFrameNotExpectedSoon(); | |
69 } | |
70 | |
71 void ProxyImplForTest::DidActivateSyncTree() { | |
72 ProxyImpl::DidActivateSyncTree(); | |
73 test_hooks_->DidActivateSyncTree(); | |
74 } | |
75 | |
76 void ProxyImplForTest::InitializeOutputSurfaceOnImpl( | |
77 OutputSurface* output_surface) { | |
78 test_hooks_->InitializeOutputSurfaceOnImpl(output_surface); | |
79 ProxyImpl::InitializeOutputSurfaceOnImpl(output_surface); | |
80 } | |
81 | |
82 void ProxyImplForTest::MainThreadHasStoppedFlingingOnImpl() { | |
83 test_hooks_->MainThreadHasStoppedFlingingOnImpl(); | |
84 ProxyImpl::MainThreadHasStoppedFlingingOnImpl(); | |
85 } | |
86 | |
87 void ProxyImplForTest::SetInputThrottledUntilCommitOnImpl(bool is_throttled) { | |
88 test_hooks_->SetInputThrottledUntilCommitOnImpl(is_throttled); | |
89 ProxyImpl::SetInputThrottledUntilCommitOnImpl(is_throttled); | |
90 } | |
91 | |
92 void ProxyImplForTest::UpdateTopControlsStateOnImpl( | |
93 TopControlsState constraints, | |
94 TopControlsState current, | |
95 bool animate) { | |
96 test_hooks_->UpdateTopControlsStateOnImpl(constraints, current, animate); | |
97 ProxyImpl::UpdateTopControlsStateOnImpl(constraints, current, animate); | |
98 } | |
99 | |
100 void ProxyImplForTest::SetDeferCommitsOnImpl(bool defer_commits) const { | |
101 test_hooks_->SetDeferCommitsOnImpl(defer_commits); | |
102 ProxyImpl::SetDeferCommitsOnImpl(defer_commits); | |
103 } | |
104 | |
105 void ProxyImplForTest::BeginMainFrameAbortedOnImpl( | |
106 CommitEarlyOutReason reason, | |
107 base::TimeTicks main_thread_start_time) { | |
108 test_hooks_->BeginMainFrameAbortedOnImpl(reason); | |
109 ProxyImpl::BeginMainFrameAbortedOnImpl(reason, main_thread_start_time); | |
110 } | |
111 | |
112 void ProxyImplForTest::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) { | |
113 test_hooks_->SetNeedsRedrawOnImpl(damage_rect); | |
114 ProxyImpl::SetNeedsRedrawOnImpl(damage_rect); | |
115 } | |
116 | |
117 void ProxyImplForTest::SetNeedsCommitOnImpl() { | |
118 test_hooks_->SetNeedsCommitOnImpl(); | |
119 ProxyImpl::SetNeedsCommitOnImpl(); | |
120 } | |
121 | |
122 void ProxyImplForTest::FinishAllRenderingOnImpl(CompletionEvent* completion) { | |
123 test_hooks_->FinishAllRenderingOnImpl(); | |
124 ProxyImpl::FinishAllRenderingOnImpl(completion); | |
125 } | |
126 | |
127 void ProxyImplForTest::SetVisibleOnImpl(bool visible) { | |
128 test_hooks_->SetVisibleOnImpl(visible); | |
129 ProxyImpl::SetVisibleOnImpl(visible); | |
130 } | |
131 | |
132 void ProxyImplForTest::ReleaseOutputSurfaceOnImpl(CompletionEvent* completion) { | |
133 test_hooks_->ReleaseOutputSurfaceOnImpl(); | |
134 ProxyImpl::ReleaseOutputSurfaceOnImpl(completion); | |
135 } | |
136 | |
137 void ProxyImplForTest::FinishGLOnImpl(CompletionEvent* completion) { | |
138 test_hooks_->FinishGLOnImpl(); | |
139 ProxyImpl::FinishGLOnImpl(completion); | |
140 } | |
141 | |
142 void ProxyImplForTest::StartCommitOnImpl(CompletionEvent* completion, | |
143 LayerTreeHost* layer_tree_host, | |
144 base::TimeTicks main_thread_start_time, | |
145 bool hold_commit_for_activation) { | |
146 test_hooks_->StartCommitOnImpl(); | |
147 ProxyImpl::StartCommitOnImpl(completion, layer_tree_host, | |
148 main_thread_start_time, | |
149 hold_commit_for_activation); | |
150 } | |
151 | |
152 } // namespace cc | |
OLD | NEW |