| 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> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "cc/surfaces/surface.h" | 13 #include "cc/surfaces/surface.h" |
| 14 #include "cc/surfaces/surface_factory_client.h" | 14 #include "cc/surfaces/surface_factory_client.h" |
| 15 #include "cc/surfaces/surface_id_allocator.h" | 15 #include "cc/surfaces/surface_id_allocator.h" |
| 16 | 16 |
| 17 namespace cc { | 17 namespace cc { |
| 18 | 18 |
| 19 const SurfaceId SurfaceManager::kRootSurfaceId(FrameSinkId(0u, 0u), | |
| 20 LocalFrameId(0u, 0u)); | |
| 21 | |
| 22 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping() | 19 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping() |
| 23 : client(nullptr), source(nullptr) {} | 20 : client(nullptr), source(nullptr) {} |
| 24 | 21 |
| 25 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping( | 22 SurfaceManager::FrameSinkSourceMapping::FrameSinkSourceMapping( |
| 26 const FrameSinkSourceMapping& other) = default; | 23 const FrameSinkSourceMapping& other) = default; |
| 27 | 24 |
| 28 SurfaceManager::FrameSinkSourceMapping::~FrameSinkSourceMapping() { | 25 SurfaceManager::FrameSinkSourceMapping::~FrameSinkSourceMapping() { |
| 29 DCHECK(is_empty()) << "client: " << client | 26 DCHECK(is_empty()) << "client: " << client |
| 30 << ", children: " << children.size(); | 27 << ", children: " << children.size(); |
| 31 } | 28 } |
| 32 | 29 |
| 33 SurfaceManager::SurfaceManager() { | 30 SurfaceManager::SurfaceManager() |
| 31 : kRootSurfaceId(FrameSinkId(0u, 0u), |
| 32 LocalFrameId(0u, base::UnguessableToken::Create())) { |
| 34 thread_checker_.DetachFromThread(); | 33 thread_checker_.DetachFromThread(); |
| 35 } | 34 } |
| 36 | 35 |
| 37 SurfaceManager::~SurfaceManager() { | 36 SurfaceManager::~SurfaceManager() { |
| 38 DCHECK(thread_checker_.CalledOnValidThread()); | 37 DCHECK(thread_checker_.CalledOnValidThread()); |
| 39 for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin(); | 38 for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin(); |
| 40 it != surfaces_to_destroy_.end(); | 39 it != surfaces_to_destroy_.end(); |
| 41 ++it) { | 40 ++it) { |
| 42 DeregisterSurface((*it)->surface_id()); | 41 DeregisterSurface((*it)->surface_id()); |
| 43 } | 42 } |
| (...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 438 |
| 440 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, | 439 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, |
| 441 const gfx::Size& frame_size, | 440 const gfx::Size& frame_size, |
| 442 float device_scale_factor) { | 441 float device_scale_factor) { |
| 443 CHECK(thread_checker_.CalledOnValidThread()); | 442 CHECK(thread_checker_.CalledOnValidThread()); |
| 444 for (auto& observer : observer_list_) | 443 for (auto& observer : observer_list_) |
| 445 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); | 444 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); |
| 446 } | 445 } |
| 447 | 446 |
| 448 } // namespace cc | 447 } // namespace cc |
| OLD | NEW |