| 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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1660 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); | 1659 static_cast<FakeDelegatedRendererLayerImpl*>(root_impl->children()[0]); |
| 1661 | 1660 |
| 1662 const ResourceProvider::ResourceIdMap& map = | 1661 const ResourceProvider::ResourceIdMap& map = |
| 1663 host_impl->resource_provider()->GetChildToParentMap( | 1662 host_impl->resource_provider()->GetChildToParentMap( |
| 1664 delegated_impl->ChildId()); | 1663 delegated_impl->ChildId()); |
| 1665 | 1664 |
| 1666 // Receive 999 back from the grandparent. | 1665 // Receive 999 back from the grandparent. |
| 1667 CompositorFrameAck ack; | 1666 CompositorFrameAck ack; |
| 1668 output_surface()->ReturnResource(map.find(999)->second, &ack); | 1667 output_surface()->ReturnResource(map.find(999)->second, &ack); |
| 1669 host_impl->ReclaimResources(&ack); | 1668 host_impl->ReclaimResources(&ack); |
| 1670 host_impl->OnSwapBuffersComplete(); | |
| 1671 } | 1669 } |
| 1672 | 1670 |
| 1673 virtual void UnusedResourcesAreAvailable() OVERRIDE { | 1671 virtual void UnusedResourcesAreAvailable() OVERRIDE { |
| 1674 EXPECT_EQ(3, layer_tree_host()->source_frame_number()); | 1672 EXPECT_EQ(3, layer_tree_host()->source_frame_number()); |
| 1675 | 1673 |
| 1676 ReturnedResourceArray resources; | 1674 ReturnedResourceArray resources; |
| 1677 | 1675 |
| 1678 // 999 was returned from the grandparent and could be released. | 1676 // 999 was returned from the grandparent and could be released. |
| 1679 resource_collection_->TakeUnusedResourcesForChildCompositor(&resources); | 1677 resource_collection_->TakeUnusedResourcesForChildCompositor(&resources); |
| 1680 { | 1678 { |
| (...skipping 656 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2337 } | 2335 } |
| 2338 | 2336 |
| 2339 scoped_refptr<DelegatedRendererLayer> delegated_thief_; | 2337 scoped_refptr<DelegatedRendererLayer> delegated_thief_; |
| 2340 }; | 2338 }; |
| 2341 | 2339 |
| 2342 SINGLE_AND_MULTI_THREAD_TEST_F( | 2340 SINGLE_AND_MULTI_THREAD_TEST_F( |
| 2343 LayerTreeHostDelegatedTestRemoveAndChangeResources); | 2341 LayerTreeHostDelegatedTestRemoveAndChangeResources); |
| 2344 | 2342 |
| 2345 } // namespace | 2343 } // namespace |
| 2346 } // namespace cc | 2344 } // namespace cc |
| OLD | NEW |