| 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 13 matching lines...) Expand all Loading... |
| 24 const FrameSinkSourceMapping& other) = default; | 24 const FrameSinkSourceMapping& other) = default; |
| 25 | 25 |
| 26 SurfaceManager::FrameSinkSourceMapping::~FrameSinkSourceMapping() { | 26 SurfaceManager::FrameSinkSourceMapping::~FrameSinkSourceMapping() { |
| 27 DCHECK(is_empty()) << "client: " << client | 27 DCHECK(is_empty()) << "client: " << client |
| 28 << ", children: " << children.size(); | 28 << ", children: " << children.size(); |
| 29 } | 29 } |
| 30 | 30 |
| 31 SurfaceManager::SurfaceManager(LifetimeType lifetime_type) | 31 SurfaceManager::SurfaceManager(LifetimeType lifetime_type) |
| 32 : lifetime_type_(lifetime_type), | 32 : lifetime_type_(lifetime_type), |
| 33 root_surface_id_(FrameSinkId(0u, 0u), | 33 root_surface_id_(FrameSinkId(0u, 0u), |
| 34 LocalFrameId(1u, base::UnguessableToken::Create())), | 34 LocalFrameId(1u, base::UnguessableToken::Create())) { |
| 35 weak_factory_(this) { | |
| 36 thread_checker_.DetachFromThread(); | 35 thread_checker_.DetachFromThread(); |
| 37 } | 36 } |
| 38 | 37 |
| 39 SurfaceManager::~SurfaceManager() { | 38 SurfaceManager::~SurfaceManager() { |
| 40 DCHECK(thread_checker_.CalledOnValidThread()); | 39 DCHECK(thread_checker_.CalledOnValidThread()); |
| 41 for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin(); | 40 for (SurfaceDestroyList::iterator it = surfaces_to_destroy_.begin(); |
| 42 it != surfaces_to_destroy_.end(); | 41 it != surfaces_to_destroy_.end(); |
| 43 ++it) { | 42 ++it) { |
| 44 DeregisterSurface((*it)->surface_id()); | 43 DeregisterSurface((*it)->surface_id()); |
| 45 } | 44 } |
| (...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 } | 492 } |
| 494 | 493 |
| 495 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, | 494 void SurfaceManager::SurfaceCreated(const SurfaceId& surface_id, |
| 496 const gfx::Size& frame_size, | 495 const gfx::Size& frame_size, |
| 497 float device_scale_factor) { | 496 float device_scale_factor) { |
| 498 CHECK(thread_checker_.CalledOnValidThread()); | 497 CHECK(thread_checker_.CalledOnValidThread()); |
| 499 for (auto& observer : observer_list_) | 498 for (auto& observer : observer_list_) |
| 500 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); | 499 observer.OnSurfaceCreated(surface_id, frame_size, device_scale_factor); |
| 501 } | 500 } |
| 502 | 501 |
| 503 base::WeakPtr<SurfaceManager> SurfaceManager::GetWeakPtr() { | |
| 504 return weak_factory_.GetWeakPtr(); | |
| 505 } | |
| 506 | |
| 507 } // namespace cc | 502 } // namespace cc |
| OLD | NEW |