| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (framebuffer_) | 100 if (framebuffer_) |
| 101 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, | 101 context_provider_->ContextGL()->BindFramebuffer(GL_FRAMEBUFFER, |
| 102 framebuffer_); | 102 framebuffer_); |
| 103 else | 103 else |
| 104 OutputSurface::BindFramebuffer(); | 104 OutputSurface::BindFramebuffer(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { | 107 bool FakeOutputSurface::BindToClient(OutputSurfaceClient* client) { |
| 108 if (OutputSurface::BindToClient(client)) { | 108 if (OutputSurface::BindToClient(client)) { |
| 109 client_ = client; | 109 client_ = client; |
| 110 if (memory_policy_to_set_at_bind_) { | |
| 111 client_->SetMemoryPolicy(*memory_policy_to_set_at_bind_.get()); | |
| 112 memory_policy_to_set_at_bind_ = nullptr; | |
| 113 } | |
| 114 return true; | 110 return true; |
| 115 } else { | 111 } else { |
| 116 return false; | 112 return false; |
| 117 } | 113 } |
| 118 } | 114 } |
| 119 | 115 |
| 120 void FakeOutputSurface::SetTreeActivationCallback( | 116 void FakeOutputSurface::SetTreeActivationCallback( |
| 121 const base::Closure& callback) { | 117 const base::Closure& callback) { |
| 122 DCHECK(client_); | 118 DCHECK(client_); |
| 123 client_->SetTreeActivationCallback(callback); | 119 client_->SetTreeActivationCallback(callback); |
| 124 } | 120 } |
| 125 | 121 |
| 126 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { | 122 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { |
| 127 TransferableResourceArray::iterator it; | 123 TransferableResourceArray::iterator it; |
| 128 for (it = resources_held_by_parent_.begin(); | 124 for (it = resources_held_by_parent_.begin(); |
| 129 it != resources_held_by_parent_.end(); | 125 it != resources_held_by_parent_.end(); |
| 130 ++it) { | 126 ++it) { |
| 131 if (it->id == id) | 127 if (it->id == id) |
| 132 break; | 128 break; |
| 133 } | 129 } |
| 134 DCHECK(it != resources_held_by_parent_.end()); | 130 DCHECK(it != resources_held_by_parent_.end()); |
| 135 ack->resources.push_back(it->ToReturnedResource()); | 131 ack->resources.push_back(it->ToReturnedResource()); |
| 136 resources_held_by_parent_.erase(it); | 132 resources_held_by_parent_.erase(it); |
| 137 } | 133 } |
| 138 | 134 |
| 139 bool FakeOutputSurface::HasExternalStencilTest() const { | 135 bool FakeOutputSurface::HasExternalStencilTest() const { |
| 140 return has_external_stencil_test_; | 136 return has_external_stencil_test_; |
| 141 } | 137 } |
| 142 | 138 |
| 143 void FakeOutputSurface::SetMemoryPolicyToSetAtBind( | |
| 144 scoped_ptr<ManagedMemoryPolicy> memory_policy_to_set_at_bind) { | |
| 145 memory_policy_to_set_at_bind_.swap(memory_policy_to_set_at_bind); | |
| 146 } | |
| 147 | |
| 148 } // namespace cc | 139 } // namespace cc |
| OLD | NEW |