| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/trees/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 resources_to_return.push_back(resource_in_parent); | 233 resources_to_return.push_back(resource_in_parent); |
| 234 } | 234 } |
| 235 | 235 |
| 236 if (resources_to_return.empty()) | 236 if (resources_to_return.empty()) |
| 237 return; | 237 return; |
| 238 | 238 |
| 239 CompositorFrameAck ack; | 239 CompositorFrameAck ack; |
| 240 for (size_t i = 0; i < resources_to_return.size(); ++i) | 240 for (size_t i = 0; i < resources_to_return.size(); ++i) |
| 241 output_surface()->ReturnResource(resources_to_return[i], &ack); | 241 output_surface()->ReturnResource(resources_to_return[i], &ack); |
| 242 host_impl->ReclaimResources(&ack); | 242 host_impl->ReclaimResources(&ack); |
| 243 host_impl->OnSwapBuffersComplete(); | |
| 244 } | 243 } |
| 245 }; | 244 }; |
| 246 | 245 |
| 247 class LayerTreeHostDelegatedTestCaseSingleDelegatedLayer | 246 class LayerTreeHostDelegatedTestCaseSingleDelegatedLayer |
| 248 : public LayerTreeHostDelegatedTest, | 247 : public LayerTreeHostDelegatedTest, |
| 249 public DelegatedFrameResourceCollectionClient { | 248 public DelegatedFrameResourceCollectionClient { |
| 250 public: | 249 public: |
| 251 LayerTreeHostDelegatedTestCaseSingleDelegatedLayer() | 250 LayerTreeHostDelegatedTestCaseSingleDelegatedLayer() |
| 252 : resource_collection_(new DelegatedFrameResourceCollection), | 251 : resource_collection_(new DelegatedFrameResourceCollection), |
| 253 available_(false) { | 252 available_(false) { |
| (...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1641 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 1640 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
| 1642 | 1641 |
| 1643 const ResourceProvider::ResourceIdMap& map = | 1642 const ResourceProvider::ResourceIdMap& map = |
| 1644 host_impl->resource_provider()->GetChildToParentMap( | 1643 host_impl->resource_provider()->GetChildToParentMap( |
| 1645 delegated_impl->ChildId()); | 1644 delegated_impl->ChildId()); |
| 1646 | 1645 |
| 1647 // Receive 999 back from the grandparent. | 1646 // Receive 999 back from the grandparent. |
| 1648 CompositorFrameAck ack; | 1647 CompositorFrameAck ack; |
| 1649 output_surface()->ReturnResource(map.find(999)->second, &ack); | 1648 output_surface()->ReturnResource(map.find(999)->second, &ack); |
| 1650 host_impl->ReclaimResources(&ack); | 1649 host_impl->ReclaimResources(&ack); |
| 1651 host_impl->OnSwapBuffersComplete(); | |
| 1652 } | 1650 } |
| 1653 | 1651 |
| 1654 virtual void UnusedResourcesAreAvailable() OVERRIDE { | 1652 virtual void UnusedResourcesAreAvailable() OVERRIDE { |
| 1655 EXPECT_EQ(3, layer_tree_host()->source_frame_number()); | 1653 EXPECT_EQ(3, layer_tree_host()->source_frame_number()); |
| 1656 | 1654 |
| 1657 ReturnedResourceArray resources; | 1655 ReturnedResourceArray resources; |
| 1658 | 1656 |
| 1659 // 999 was returned from the grandparent and could be released. | 1657 // 999 was returned from the grandparent and could be released. |
| 1660 resource_collection_->TakeUnusedResourcesForChildCompositor(&resources); | 1658 resource_collection_->TakeUnusedResourcesForChildCompositor(&resources); |
| 1661 { | 1659 { |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2318 } | 2316 } |
| 2319 | 2317 |
| 2320 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2318 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
| 2321 }; | 2319 }; |
| 2322 | 2320 |
| 2323 SINGLE_AND_MULTI_THREAD_TEST_F( | 2321 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 2324 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2322 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
| 2325 | 2323 |
| 2326 } // namespace | 2324 } // namespace |
| 2327 } // namespace cc | 2325 } // namespace cc |
| OLD | NEW |