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

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

Issue 553213003: Avoid destroying surface before the parent surface stops referencing it. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 "cc/output/compositor_frame.h" 7 #include "cc/output/compositor_frame.h"
8 #include "cc/output/copy_output_request.h" 8 #include "cc/output/copy_output_request.h"
9 #include "cc/surfaces/surface.h" 9 #include "cc/surfaces/surface.h"
10 #include "cc/surfaces/surface_manager.h" 10 #include "cc/surfaces/surface_manager.h"
(...skipping 16 matching lines...) Expand all
27 } 27 }
28 28
29 void SurfaceFactory::Destroy(SurfaceId surface_id) { 29 void SurfaceFactory::Destroy(SurfaceId surface_id) {
30 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); 30 OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
31 DCHECK(it != surface_map_.end()); 31 DCHECK(it != surface_map_.end());
32 DCHECK(it->second->factory() == this); 32 DCHECK(it->second->factory() == this);
33 manager_->DeregisterSurface(surface_id); 33 manager_->DeregisterSurface(surface_id);
34 surface_map_.erase(it); 34 surface_map_.erase(it);
35 } 35 }
36 36
37 void SurfaceFactory::DestroyOnSequence(
38 SurfaceId surface_id,
39 const std::set<SurfaceSequence>& dependency_set) {
40 OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
41 DCHECK(it != surface_map_.end());
42 DCHECK(it->second->factory() == this);
43 manager_->DestroyOnSequence(surface_map_.take_and_erase(it), dependency_set);
44 }
45
37 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, 46 void SurfaceFactory::SubmitFrame(SurfaceId surface_id,
38 scoped_ptr<CompositorFrame> frame, 47 scoped_ptr<CompositorFrame> frame,
39 const base::Closure& callback) { 48 const base::Closure& callback) {
40 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); 49 OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
41 DCHECK(it != surface_map_.end()); 50 DCHECK(it != surface_map_.end());
42 DCHECK(it->second->factory() == this); 51 DCHECK(it->second->factory() == this);
43 it->second->QueueFrame(frame.Pass(), callback); 52 it->second->QueueFrame(frame.Pass(), callback);
44 manager_->SurfaceModified(surface_id); 53 manager_->SurfaceModified(surface_id);
45 } 54 }
46 55
(...skipping 17 matching lines...) Expand all
64 73
65 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { 74 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) {
66 holder_.RefResources(resources); 75 holder_.RefResources(resources);
67 } 76 }
68 77
69 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { 78 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) {
70 holder_.UnrefResources(resources); 79 holder_.UnrefResources(resources);
71 } 80 }
72 81
73 } // namespace cc 82 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698