| 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/layers/delegated_frame_resource_collection.h" | 5 #include "cc/layers/delegated_frame_resource_collection.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "cc/trees/blocking_task_runner.h" | 8 #include "cc/trees/blocking_task_runner.h" |
| 9 | 9 |
| 10 namespace cc { | 10 namespace cc { |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 return; | 81 return; |
| 82 | 82 |
| 83 ReturnedResourceArray to_return; | 83 ReturnedResourceArray to_return; |
| 84 | 84 |
| 85 for (size_t i = 0; i < returned.size(); ++i) { | 85 for (size_t i = 0; i < returned.size(); ++i) { |
| 86 ResourceIdRefCountMap::iterator it = | 86 ResourceIdRefCountMap::iterator it = |
| 87 resource_id_ref_count_map_.find(returned[i].id); | 87 resource_id_ref_count_map_.find(returned[i].id); |
| 88 DCHECK(it != resource_id_ref_count_map_.end()); | 88 DCHECK(it != resource_id_ref_count_map_.end()); |
| 89 DCHECK_GE(it->second.refs_to_wait_for, returned[i].count); | 89 DCHECK_GE(it->second.refs_to_wait_for, returned[i].count); |
| 90 it->second.refs_to_wait_for -= returned[i].count; | 90 it->second.refs_to_wait_for -= returned[i].count; |
| 91 it->second.lost |= returned[i].lost; |
| 92 if (returned[i].sync_point) |
| 93 it->second.sync_point = returned[i].sync_point; |
| 91 if (it->second.refs_to_wait_for == 0) { | 94 if (it->second.refs_to_wait_for == 0) { |
| 92 to_return.push_back(returned[i]); | 95 to_return.push_back(returned[i]); |
| 93 to_return.back().count = it->second.refs_to_return; | 96 to_return.back().count = it->second.refs_to_return; |
| 97 to_return.back().sync_point = it->second.sync_point; |
| 98 to_return.back().lost = it->second.lost; |
| 94 resource_id_ref_count_map_.erase(it); | 99 resource_id_ref_count_map_.erase(it); |
| 95 } | 100 } |
| 96 } | 101 } |
| 97 | 102 |
| 98 if (to_return.empty()) | 103 if (to_return.empty()) |
| 99 return; | 104 return; |
| 100 | 105 |
| 101 returned_resources_for_child_compositor_.insert( | 106 returned_resources_for_child_compositor_.insert( |
| 102 returned_resources_for_child_compositor_.end(), | 107 returned_resources_for_child_compositor_.end(), |
| 103 to_return.begin(), | 108 to_return.begin(), |
| (...skipping 20 matching lines...) Expand all Loading... |
| 124 } | 129 } |
| 125 | 130 |
| 126 ReturnCallback | 131 ReturnCallback |
| 127 DelegatedFrameResourceCollection::GetReturnResourcesCallbackForImplThread() { | 132 DelegatedFrameResourceCollection::GetReturnResourcesCallbackForImplThread() { |
| 128 return base::Bind(&UnrefResourcesOnImplThread, | 133 return base::Bind(&UnrefResourcesOnImplThread, |
| 129 weak_ptr_factory_.GetWeakPtr(), | 134 weak_ptr_factory_.GetWeakPtr(), |
| 130 main_thread_runner_); | 135 main_thread_runner_); |
| 131 } | 136 } |
| 132 | 137 |
| 133 } // namespace cc | 138 } // namespace cc |
| OLD | NEW |