| 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" | 9 #include "cc/output/compositor_frame_ack.h" |
| 10 #include "cc/output/output_surface_client.h" | 10 #include "cc/output/output_surface_client.h" |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 if (memory_policy_to_set_at_bind_) { | 84 if (memory_policy_to_set_at_bind_) { |
| 85 client_->SetMemoryPolicy(*memory_policy_to_set_at_bind_.get()); | 85 client_->SetMemoryPolicy(*memory_policy_to_set_at_bind_.get()); |
| 86 memory_policy_to_set_at_bind_ = nullptr; | 86 memory_policy_to_set_at_bind_ = nullptr; |
| 87 } | 87 } |
| 88 return true; | 88 return true; |
| 89 } else { | 89 } else { |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void FakeOutputSurface::Invalidate() { |
| 95 client_->RequestDraw(); |
| 96 } |
| 97 |
| 94 void FakeOutputSurface::SetTreeActivationCallback( | 98 void FakeOutputSurface::SetTreeActivationCallback( |
| 95 const base::Closure& callback) { | 99 const base::Closure& callback) { |
| 96 DCHECK(client_); | 100 DCHECK(client_); |
| 97 client_->SetTreeActivationCallback(callback); | 101 client_->SetTreeActivationCallback(callback); |
| 98 } | 102 } |
| 99 | 103 |
| 100 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { | 104 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { |
| 101 TransferableResourceArray::iterator it; | 105 TransferableResourceArray::iterator it; |
| 102 for (it = resources_held_by_parent_.begin(); | 106 for (it = resources_held_by_parent_.begin(); |
| 103 it != resources_held_by_parent_.end(); | 107 it != resources_held_by_parent_.end(); |
| 104 ++it) { | 108 ++it) { |
| 105 if (it->id == id) | 109 if (it->id == id) |
| 106 break; | 110 break; |
| 107 } | 111 } |
| 108 DCHECK(it != resources_held_by_parent_.end()); | 112 DCHECK(it != resources_held_by_parent_.end()); |
| 109 ack->resources.push_back(it->ToReturnedResource()); | 113 ack->resources.push_back(it->ToReturnedResource()); |
| 110 resources_held_by_parent_.erase(it); | 114 resources_held_by_parent_.erase(it); |
| 111 } | 115 } |
| 112 | 116 |
| 113 bool FakeOutputSurface::HasExternalStencilTest() const { | 117 bool FakeOutputSurface::HasExternalStencilTest() const { |
| 114 return has_external_stencil_test_; | 118 return has_external_stencil_test_; |
| 115 } | 119 } |
| 116 | 120 |
| 117 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | 121 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( |
| 118 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | 122 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { |
| 119 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | 123 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); |
| 120 } | 124 } |
| 121 | 125 |
| 122 } // namespace cc | 126 } // namespace cc |
| OLD | NEW |