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

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, 3 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 17 matching lines...) Expand all
28 } 28 }
29 29
30 void SurfaceFactory::Destroy(SurfaceId surface_id) { 30 void SurfaceFactory::Destroy(SurfaceId surface_id) {
31 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); 31 OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
32 DCHECK(it != surface_map_.end()); 32 DCHECK(it != surface_map_.end());
33 DCHECK(it->second->factory() == this); 33 DCHECK(it->second->factory() == this);
34 manager_->DeregisterSurface(surface_id); 34 manager_->DeregisterSurface(surface_id);
35 surface_map_.erase(it); 35 surface_map_.erase(it);
36 } 36 }
37 37
38 void SurfaceFactory::DestroyOnSequence(
39 SurfaceId surface_id,
40 const std::set<SurfaceSequence>& dependency_set) {
41 OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
42 DCHECK(it != surface_map_.end());
43 DCHECK(it->second->factory() == this);
44 manager_->DestroyOnSequence(surface_map_.take_and_erase(it), dependency_set);
45 }
46
38 void SurfaceFactory::SubmitFrame(SurfaceId surface_id, 47 void SurfaceFactory::SubmitFrame(SurfaceId surface_id,
39 scoped_ptr<CompositorFrame> frame, 48 scoped_ptr<CompositorFrame> frame,
40 const base::Closure& callback) { 49 const base::Closure& callback) {
41 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); 50 OwningSurfaceMap::iterator it = surface_map_.find(surface_id);
42 DCHECK(it != surface_map_.end()); 51 DCHECK(it != surface_map_.end());
43 DCHECK(it->second->factory() == this); 52 DCHECK(it->second->factory() == this);
44 it->second->QueueFrame(frame.Pass(), callback); 53 it->second->QueueFrame(frame.Pass(), callback);
45 manager_->SurfaceModified(surface_id); 54 manager_->SurfaceModified(surface_id);
46 } 55 }
47 56
(...skipping 16 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