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

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

Issue 2760433002: SurfaceManager::CreateSurface must set the surface's factory (Closed)
Patch Set: nits 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_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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 // the queue and reuse it. 115 // the queue and reuse it.
116 auto it = 116 auto it =
117 std::find_if(surfaces_to_destroy_.begin(), surfaces_to_destroy_.end(), 117 std::find_if(surfaces_to_destroy_.begin(), surfaces_to_destroy_.end(),
118 [&surface_id](const std::unique_ptr<Surface>& surface) { 118 [&surface_id](const std::unique_ptr<Surface>& surface) {
119 return surface->surface_id() == surface_id; 119 return surface->surface_id() == surface_id;
120 }); 120 });
121 DCHECK(it != surfaces_to_destroy_.end()); 121 DCHECK(it != surfaces_to_destroy_.end());
122 std::unique_ptr<Surface> surface = std::move(*it); 122 std::unique_ptr<Surface> surface = std::move(*it);
123 surfaces_to_destroy_.erase(it); 123 surfaces_to_destroy_.erase(it);
124 surface->set_destroyed(false); 124 surface->set_destroyed(false);
125 DCHECK_EQ(surface_factory.get(), surface->factory().get()); 125 surface->set_factory(surface_factory);
126 return surface; 126 return surface;
127 } 127 }
128 128
129 void SurfaceManager::DestroySurface(std::unique_ptr<Surface> surface) { 129 void SurfaceManager::DestroySurface(std::unique_ptr<Surface> surface) {
130 DCHECK(thread_checker_.CalledOnValidThread()); 130 DCHECK(thread_checker_.CalledOnValidThread());
131
131 surface->set_destroyed(true); 132 surface->set_destroyed(true);
132 surfaces_to_destroy_.push_back(std::move(surface)); 133 surfaces_to_destroy_.push_back(std::move(surface));
133 GarbageCollectSurfaces(); 134 GarbageCollectSurfaces();
134 } 135 }
135 136
136 void SurfaceManager::RequireSequence(const SurfaceId& surface_id, 137 void SurfaceManager::RequireSequence(const SurfaceId& surface_id,
137 const SurfaceSequence& sequence) { 138 const SurfaceSequence& sequence) {
138 auto* surface = GetSurfaceForId(surface_id); 139 auto* surface = GetSurfaceForId(surface_id);
139 if (!surface) { 140 if (!surface) {
140 DLOG(ERROR) << "Attempting to require callback on nonexistent surface"; 141 DLOG(ERROR) << "Attempting to require callback on nonexistent surface";
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end()); 689 std::vector<SurfaceId> children(iter->second.begin(), iter->second.end());
689 std::sort(children.begin(), children.end()); 690 std::sort(children.begin(), children.end());
690 691
691 for (const SurfaceId& child_id : children) 692 for (const SurfaceId& child_id : children)
692 SurfaceReferencesToStringImpl(child_id, indent + " ", str); 693 SurfaceReferencesToStringImpl(child_id, indent + " ", str);
693 } 694 }
694 } 695 }
695 #endif // DCHECK_IS_ON() 696 #endif // DCHECK_IS_ON()
696 697
697 } // namespace cc 698 } // namespace cc
OLDNEW
« cc/surfaces/compositor_frame_sink_support_unittest.cc ('K') | « cc/surfaces/surface.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698