| 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_compositor_frame_sink.h" | 5 #include "cc/test/fake_compositor_frame_sink.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/threading/thread_task_runner_handle.h" | 8 #include "base/threading/thread_task_runner_handle.h" |
| 9 #include "cc/output/compositor_frame_sink_client.h" | 9 #include "cc/output/compositor_frame_sink_client.h" |
| 10 #include "cc/resources/returned_resource.h" | 10 #include "cc/resources/returned_resource.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 resources_held_by_parent_.insert(resources_held_by_parent_.end(), | 57 resources_held_by_parent_.insert(resources_held_by_parent_.end(), |
| 58 last_sent_frame_->resource_list.begin(), | 58 last_sent_frame_->resource_list.begin(), |
| 59 last_sent_frame_->resource_list.end()); | 59 last_sent_frame_->resource_list.end()); |
| 60 | 60 |
| 61 base::ThreadTaskRunnerHandle::Get()->PostTask( | 61 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 62 FROM_HERE, | 62 FROM_HERE, |
| 63 base::BindOnce(&FakeCompositorFrameSink::DidReceiveCompositorFrameAck, | 63 base::BindOnce(&FakeCompositorFrameSink::DidReceiveCompositorFrameAck, |
| 64 weak_ptr_factory_.GetWeakPtr())); | 64 weak_ptr_factory_.GetWeakPtr())); |
| 65 } | 65 } |
| 66 | 66 |
| 67 void FakeCompositorFrameSink::BeginFrameDidNotProduceFrame( |
| 68 const BeginFrameAck& ack) {} |
| 69 |
| 67 void FakeCompositorFrameSink::DidReceiveCompositorFrameAck() { | 70 void FakeCompositorFrameSink::DidReceiveCompositorFrameAck() { |
| 68 client_->DidReceiveCompositorFrameAck(); | 71 client_->DidReceiveCompositorFrameAck(); |
| 69 } | 72 } |
| 70 | 73 |
| 71 void FakeCompositorFrameSink::ReturnResourcesHeldByParent() { | 74 void FakeCompositorFrameSink::ReturnResourcesHeldByParent() { |
| 72 if (last_sent_frame_) { | 75 if (last_sent_frame_) { |
| 73 // Return the last frame's resources immediately. | 76 // Return the last frame's resources immediately. |
| 74 ReturnedResourceArray resources; | 77 ReturnedResourceArray resources; |
| 75 for (const auto& resource : resources_held_by_parent_) | 78 for (const auto& resource : resources_held_by_parent_) |
| 76 resources.push_back(resource.ToReturnedResource()); | 79 resources.push_back(resource.ToReturnedResource()); |
| 77 resources_held_by_parent_.clear(); | 80 resources_held_by_parent_.clear(); |
| 78 client_->ReclaimResources(resources); | 81 client_->ReclaimResources(resources); |
| 79 } | 82 } |
| 80 } | 83 } |
| 81 | 84 |
| 82 } // namespace cc | 85 } // namespace cc |
| OLD | NEW |