| OLD | NEW |
| 1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 920 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 931 ui_resource_client_map_.erase(iter); | 931 ui_resource_client_map_.erase(iter); |
| 932 } | 932 } |
| 933 | 933 |
| 934 void LayerTreeHost::RecreateUIResources() { | 934 void LayerTreeHost::RecreateUIResources() { |
| 935 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); | 935 for (UIResourceClientMap::iterator iter = ui_resource_client_map_.begin(); |
| 936 iter != ui_resource_client_map_.end(); | 936 iter != ui_resource_client_map_.end(); |
| 937 ++iter) { | 937 ++iter) { |
| 938 UIResourceId uid = iter->first; | 938 UIResourceId uid = iter->first; |
| 939 const UIResourceClientData& data = iter->second; | 939 const UIResourceClientData& data = iter->second; |
| 940 bool resource_lost = true; | 940 bool resource_lost = true; |
| 941 UIResourceRequest request(UIResourceRequest::UI_RESOURCE_CREATE, uid, | 941 auto it = std::find_if(ui_resource_request_queue_.begin(), |
| 942 data.client->GetBitmap(uid, resource_lost)); | 942 ui_resource_request_queue_.end(), |
| 943 ui_resource_request_queue_.push_back(request); | 943 [uid](const UIResourceRequest& request) { |
| 944 return request.GetId() == uid; |
| 945 }); |
| 946 if (it == ui_resource_request_queue_.end()) { |
| 947 UIResourceRequest request(UIResourceRequest::UI_RESOURCE_CREATE, uid, |
| 948 data.client->GetBitmap(uid, resource_lost)); |
| 949 ui_resource_request_queue_.push_back(request); |
| 950 } |
| 944 } | 951 } |
| 945 } | 952 } |
| 946 | 953 |
| 947 // Returns the size of a resource given its id. | 954 // Returns the size of a resource given its id. |
| 948 gfx::Size LayerTreeHost::GetUIResourceSize(UIResourceId uid) const { | 955 gfx::Size LayerTreeHost::GetUIResourceSize(UIResourceId uid) const { |
| 949 UIResourceClientMap::const_iterator iter = ui_resource_client_map_.find(uid); | 956 UIResourceClientMap::const_iterator iter = ui_resource_client_map_.find(uid); |
| 950 if (iter == ui_resource_client_map_.end()) | 957 if (iter == ui_resource_client_map_.end()) |
| 951 return gfx::Size(); | 958 return gfx::Size(); |
| 952 | 959 |
| 953 const UIResourceClientData& data = iter->second; | 960 const UIResourceClientData& data = iter->second; |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1127 | 1134 |
| 1128 surface_client_id_ = proto.surface_client_id(); | 1135 surface_client_id_ = proto.surface_client_id(); |
| 1129 next_surface_sequence_ = proto.next_surface_sequence(); | 1136 next_surface_sequence_ = proto.next_surface_sequence(); |
| 1130 } | 1137 } |
| 1131 | 1138 |
| 1132 AnimationHost* LayerTreeHost::animation_host() const { | 1139 AnimationHost* LayerTreeHost::animation_host() const { |
| 1133 return layer_tree_->animation_host(); | 1140 return layer_tree_->animation_host(); |
| 1134 } | 1141 } |
| 1135 | 1142 |
| 1136 } // namespace cc | 1143 } // namespace cc |
| OLD | NEW |