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 <queue> | 10 #include <queue> |
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 dependency_tracker_->OnSurfaceDependenciesChanged( | 491 dependency_tracker_->OnSurfaceDependenciesChanged( |
492 surface, added_dependencies, removed_dependencies); | 492 surface, added_dependencies, removed_dependencies); |
493 } | 493 } |
494 } | 494 } |
495 | 495 |
496 void SurfaceManager::SurfaceDiscarded(Surface* surface) { | 496 void SurfaceManager::SurfaceDiscarded(Surface* surface) { |
497 if (dependency_tracker_) | 497 if (dependency_tracker_) |
498 dependency_tracker_->OnSurfaceDiscarded(surface); | 498 dependency_tracker_->OnSurfaceDiscarded(surface); |
499 } | 499 } |
500 | 500 |
| 501 void SurfaceManager::SurfaceProducerStateChanged(Surface* surface, |
| 502 Surface::ProducerState state) { |
| 503 CHECK(thread_checker_.CalledOnValidThread()); |
| 504 for (auto& observer : observer_list_) |
| 505 observer.OnSurfaceProducerStateChanged(surface->surface_id()); |
| 506 } |
| 507 |
501 void SurfaceManager::UnregisterSurface(const SurfaceId& surface_id) { | 508 void SurfaceManager::UnregisterSurface(const SurfaceId& surface_id) { |
502 DCHECK(thread_checker_.CalledOnValidThread()); | 509 DCHECK(thread_checker_.CalledOnValidThread()); |
503 SurfaceMap::iterator it = surface_map_.find(surface_id); | 510 SurfaceMap::iterator it = surface_map_.find(surface_id); |
504 DCHECK(it != surface_map_.end()); | 511 DCHECK(it != surface_map_.end()); |
505 surface_map_.erase(it); | 512 surface_map_.erase(it); |
506 RemoveAllSurfaceReferences(surface_id); | 513 RemoveAllSurfaceReferences(surface_id); |
507 } | 514 } |
508 | 515 |
509 #if DCHECK_IS_ON() | 516 #if DCHECK_IS_ON() |
510 void SurfaceManager::SurfaceReferencesToStringImpl(const SurfaceId& surface_id, | 517 void SurfaceManager::SurfaceReferencesToStringImpl(const SurfaceId& surface_id, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); | 550 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); |
544 std::sort(children.begin(), children.end()); | 551 std::sort(children.begin(), children.end()); |
545 | 552 |
546 for (const SurfaceId& child_id : children) | 553 for (const SurfaceId& child_id : children) |
547 SurfaceReferencesToStringImpl(child_id, indent + " ", str); | 554 SurfaceReferencesToStringImpl(child_id, indent + " ", str); |
548 } | 555 } |
549 } | 556 } |
550 #endif // DCHECK_IS_ON() | 557 #endif // DCHECK_IS_ON() |
551 | 558 |
552 } // namespace cc | 559 } // namespace cc |
OLD | NEW |