| 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 "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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |