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_factory.h" | 5 #include "cc/surfaces/surface_factory.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
143 | 143 |
144 void SurfaceFactory::OnSurfaceDependenciesChanged( | 144 void SurfaceFactory::OnSurfaceDependenciesChanged( |
145 Surface* surface, | 145 Surface* surface, |
146 const SurfaceDependencies& added_dependencies, | 146 const SurfaceDependencies& added_dependencies, |
147 const SurfaceDependencies& removed_dependencies) {} | 147 const SurfaceDependencies& removed_dependencies) {} |
148 | 148 |
149 void SurfaceFactory::OnSurfaceDiscarded(Surface* surface) {} | 149 void SurfaceFactory::OnSurfaceDiscarded(Surface* surface) {} |
150 | 150 |
151 std::unique_ptr<Surface> SurfaceFactory::Create( | 151 std::unique_ptr<Surface> SurfaceFactory::Create( |
152 const LocalSurfaceId& local_surface_id) { | 152 const LocalSurfaceId& local_surface_id) { |
153 auto surface = base::MakeUnique<Surface>( | |
154 SurfaceId(frame_sink_id_, local_surface_id), weak_factory_.GetWeakPtr()); | |
155 seen_first_frame_activation_ = false; | 153 seen_first_frame_activation_ = false; |
156 manager_->RegisterSurface(surface.get()); | 154 std::unique_ptr<Surface> surface = |
| 155 manager_->CreateSurface(weak_factory_.GetWeakPtr(), local_surface_id); |
157 surface->AddObserver(this); | 156 surface->AddObserver(this); |
158 return surface; | 157 return surface; |
159 } | 158 } |
160 | 159 |
161 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { | 160 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { |
162 surface->RemoveObserver(this); | 161 surface->RemoveObserver(this); |
163 manager_->Destroy(std::move(surface)); | 162 manager_->DestroySurface(std::move(surface)); |
164 } | 163 } |
165 | 164 |
166 } // namespace cc | 165 } // namespace cc |
OLD | NEW |