Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(260)

Side by Side Diff: cc/surfaces/surface_factory.cc

Issue 2736053004: SurfaceIds must be reusable as soon as their surfaces are marked destroyed (Closed)
Patch Set: Split tests Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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>( 153 seen_first_frame_activation_ = false;
154 std::unique_ptr<Surface> surface = manager_->CreateSurface(
154 SurfaceId(frame_sink_id_, local_surface_id), weak_factory_.GetWeakPtr()); 155 SurfaceId(frame_sink_id_, local_surface_id), weak_factory_.GetWeakPtr());
155 seen_first_frame_activation_ = false;
156 manager_->RegisterSurface(surface.get());
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698