| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/surfaces/surface_manager.h" | 5 #include "cc/surfaces/surface_manager.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 // of unregistering the hierarchy first before either of them. | 297 // of unregistering the hierarchy first before either of them. |
| 298 DCHECK_EQ(namespace_client_map_.count(parent_namespace), 1u); | 298 DCHECK_EQ(namespace_client_map_.count(parent_namespace), 1u); |
| 299 | 299 |
| 300 auto iter = namespace_client_map_.find(parent_namespace); | 300 auto iter = namespace_client_map_.find(parent_namespace); |
| 301 | 301 |
| 302 std::vector<uint32_t>& children = iter->second.children; | 302 std::vector<uint32_t>& children = iter->second.children; |
| 303 bool found_child = false; | 303 bool found_child = false; |
| 304 for (size_t i = 0; i < children.size(); ++i) { | 304 for (size_t i = 0; i < children.size(); ++i) { |
| 305 if (children[i] == child_namespace) { | 305 if (children[i] == child_namespace) { |
| 306 found_child = true; | 306 found_child = true; |
| 307 children[i] = children[children.size() - 1]; | 307 children[i] = children.back(); |
| 308 children.resize(children.size() - 1); | 308 children.resize(children.size() - 1); |
| 309 break; | 309 break; |
| 310 } | 310 } |
| 311 } | 311 } |
| 312 DCHECK(found_child); | 312 DCHECK(found_child); |
| 313 | 313 |
| 314 // The SurfaceFactoryClient and hierarchy can be registered/unregistered | 314 // The SurfaceFactoryClient and hierarchy can be registered/unregistered |
| 315 // in either order, so empty namespace_client_map entries need to be | 315 // in either order, so empty namespace_client_map entries need to be |
| 316 // checked when removing either clients or relationships. | 316 // checked when removing either clients or relationships. |
| 317 if (iter->second.is_empty()) { | 317 if (iter->second.is_empty()) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 341 | 341 |
| 342 bool SurfaceManager::SurfaceModified(SurfaceId surface_id) { | 342 bool SurfaceManager::SurfaceModified(SurfaceId surface_id) { |
| 343 CHECK(thread_checker_.CalledOnValidThread()); | 343 CHECK(thread_checker_.CalledOnValidThread()); |
| 344 bool changed = false; | 344 bool changed = false; |
| 345 FOR_EACH_OBSERVER(SurfaceDamageObserver, observer_list_, | 345 FOR_EACH_OBSERVER(SurfaceDamageObserver, observer_list_, |
| 346 OnSurfaceDamaged(surface_id, &changed)); | 346 OnSurfaceDamaged(surface_id, &changed)); |
| 347 return changed; | 347 return changed; |
| 348 } | 348 } |
| 349 | 349 |
| 350 } // namespace cc | 350 } // namespace cc |
| OLD | NEW |