| 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 <utility> | 10 #include <utility> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 void SurfaceManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) { | 83 void SurfaceManager::RegisterFrameSinkId(const FrameSinkId& frame_sink_id) { |
| 84 bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second; | 84 bool inserted = valid_frame_sink_ids_.insert(frame_sink_id).second; |
| 85 DCHECK(inserted); | 85 DCHECK(inserted); |
| 86 } | 86 } |
| 87 | 87 |
| 88 void SurfaceManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) { | 88 void SurfaceManager::InvalidateFrameSinkId(const FrameSinkId& frame_sink_id) { |
| 89 valid_frame_sink_ids_.erase(frame_sink_id); | 89 valid_frame_sink_ids_.erase(frame_sink_id); |
| 90 GarbageCollectSurfaces(); | 90 GarbageCollectSurfaces(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 const SurfaceId& SurfaceManager::GetRootSurfaceId() const { |
| 94 return kRootSurfaceId; |
| 95 } |
| 96 |
| 93 void SurfaceManager::AddSurfaceReference(const SurfaceId& parent_id, | 97 void SurfaceManager::AddSurfaceReference(const SurfaceId& parent_id, |
| 94 const SurfaceId& child_id) { | 98 const SurfaceId& child_id) { |
| 95 DCHECK(thread_checker_.CalledOnValidThread()); | 99 DCHECK(thread_checker_.CalledOnValidThread()); |
| 96 | 100 |
| 97 // Check some conditions that should never happen. We don't want to crash on | 101 // Check some conditions that should never happen. We don't want to crash on |
| 98 // bad input from a compromised client so just return early. | 102 // bad input from a compromised client so just return early. |
| 99 if (parent_id == child_id) { | 103 if (parent_id == child_id) { |
| 100 LOG(ERROR) << "Cannot add self reference for " << parent_id.ToString(); | 104 LOG(ERROR) << "Cannot add self reference for " << parent_id.ToString(); |
| 101 return; | 105 return; |
| 102 } | 106 } |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 | 442 |
| 439 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, | 443 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, |
| 440 const gfx::Size& frame_size, | 444 const gfx::Size& frame_size, |
| 441 float device_scale_factor) { | 445 float device_scale_factor) { |
| 442 CHECK(thread_checker_.CalledOnValidThread()); | 446 CHECK(thread_checker_.CalledOnValidThread()); |
| 443 for (auto& observer : observer_list_) | 447 for (auto& observer : observer_list_) |
| 444 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); | 448 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); |
| 445 } | 449 } |
| 446 | 450 |
| 447 } // namespace cc | 451 } // namespace cc |
| OLD | NEW |