| 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" |
| 11 #include "cc/resources/returned_resource.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 13 |
| 13 namespace cc { | 14 namespace cc { |
| 14 | 15 |
| 15 FakeOutputSurface::FakeOutputSurface( | 16 FakeOutputSurface::FakeOutputSurface( |
| 16 scoped_refptr<ContextProvider> context_provider, | 17 scoped_refptr<ContextProvider> context_provider, |
| 17 bool delegated_rendering) | 18 bool delegated_rendering) |
| 18 : OutputSurface(context_provider), | 19 : OutputSurface(context_provider), |
| 19 client_(NULL), | 20 client_(NULL), |
| 20 num_sent_frames_(0), | 21 num_sent_frames_(0), |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 | 120 |
| 120 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { | 121 void FakeOutputSurface::ReturnResource(unsigned id, CompositorFrameAck* ack) { |
| 121 TransferableResourceArray::iterator it; | 122 TransferableResourceArray::iterator it; |
| 122 for (it = resources_held_by_parent_.begin(); | 123 for (it = resources_held_by_parent_.begin(); |
| 123 it != resources_held_by_parent_.end(); | 124 it != resources_held_by_parent_.end(); |
| 124 ++it) { | 125 ++it) { |
| 125 if (it->id == id) | 126 if (it->id == id) |
| 126 break; | 127 break; |
| 127 } | 128 } |
| 128 DCHECK(it != resources_held_by_parent_.end()); | 129 DCHECK(it != resources_held_by_parent_.end()); |
| 129 ack->resources.push_back(*it); | 130 ack->resources.push_back(it->ToReturnedResource()); |
| 130 resources_held_by_parent_.erase(it); | 131 resources_held_by_parent_.erase(it); |
| 131 } | 132 } |
| 132 | 133 |
| 133 } // namespace cc | 134 } // namespace cc |
| OLD | NEW |