OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/fake_output_surface.h" | 5 #include "cc/test/fake_output_surface.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 #include "cc/output/compositor_frame_ack.h" | |
10 #include "cc/output/output_surface_client.h" | 9 #include "cc/output/output_surface_client.h" |
11 #include "cc/resources/returned_resource.h" | 10 #include "cc/resources/returned_resource.h" |
12 #include "cc/test/begin_frame_args_test.h" | 11 #include "cc/test/begin_frame_args_test.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 | 13 |
15 namespace cc { | 14 namespace cc { |
16 | 15 |
17 FakeOutputSurface::FakeOutputSurface( | 16 FakeOutputSurface::FakeOutputSurface( |
18 scoped_refptr<ContextProvider> context_provider, | 17 scoped_refptr<ContextProvider> context_provider, |
19 scoped_refptr<ContextProvider> worker_context_provider, | 18 scoped_refptr<ContextProvider> worker_context_provider, |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 return false; | 94 return false; |
96 } | 95 } |
97 } | 96 } |
98 | 97 |
99 void FakeOutputSurface::SetTreeActivationCallback( | 98 void FakeOutputSurface::SetTreeActivationCallback( |
100 const base::Closure& callback) { | 99 const base::Closure& callback) { |
101 DCHECK(client_); | 100 DCHECK(client_); |
102 client_->SetTreeActivationCallback(callback); | 101 client_->SetTreeActivationCallback(callback); |
103 } | 102 } |
104 | 103 |
105 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { | 104 void FakeOutputSurface::ReturnResource(unsigned id, |
| 105 ReturnedResourceArray* resources) { |
106 TransferableResourceArray::iterator it; | 106 TransferableResourceArray::iterator it; |
107 for (it = resources_held_by_parent_.begin(); | 107 for (it = resources_held_by_parent_.begin(); |
108 it != resources_held_by_parent_.end(); | 108 it != resources_held_by_parent_.end(); |
109 ++it) { | 109 ++it) { |
110 if (it->id == id) | 110 if (it->id == id) |
111 break; | 111 break; |
112 } | 112 } |
113 DCHECK(it != resources_held_by_parent_.end()); | 113 DCHECK(it != resources_held_by_parent_.end()); |
114 ack->resources.push_back(it->ToReturnedResource()); | 114 resources->push_back(it->ToReturnedResource()); |
115 resources_held_by_parent_.erase(it); | 115 resources_held_by_parent_.erase(it); |
116 } | 116 } |
117 | 117 |
118 bool FakeOutputSurface::HasExternalStencilTest() const { | 118 bool FakeOutputSurface::HasExternalStencilTest() const { |
119 return has_external_stencil_test_; | 119 return has_external_stencil_test_; |
120 } | 120 } |
121 | 121 |
122 bool FakeOutputSurface::SurfaceIsSuspendForRecycle() const { | 122 bool FakeOutputSurface::SurfaceIsSuspendForRecycle() const { |
123 return suspended_for_recycle_; | 123 return suspended_for_recycle_; |
124 } | 124 } |
125 | 125 |
126 OverlayCandidateValidator* FakeOutputSurface::GetOverlayCandidateValidator() | 126 OverlayCandidateValidator* FakeOutputSurface::GetOverlayCandidateValidator() |
127 const { | 127 const { |
128 return overlay_candidate_validator_; | 128 return overlay_candidate_validator_; |
129 } | 129 } |
130 | 130 |
131 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 131 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
132 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 132 std::unique_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
133 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | 133 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); |
134 } | 134 } |
135 | 135 |
136 } // namespace cc | 136 } // namespace cc |
OLD | NEW |