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 <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 | 46 |
47 void SurfaceFactory::Destroy(SurfaceId surface_id) { | 47 void SurfaceFactory::Destroy(SurfaceId surface_id) { |
48 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 48 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
49 DCHECK(it != surface_map_.end()); | 49 DCHECK(it != surface_map_.end()); |
50 DCHECK(it->second->factory().get() == this); | 50 DCHECK(it->second->factory().get() == this); |
51 std::unique_ptr<Surface> surface(std::move(it->second)); | 51 std::unique_ptr<Surface> surface(std::move(it->second)); |
52 surface_map_.erase(it); | 52 surface_map_.erase(it); |
53 manager_->Destroy(std::move(surface)); | 53 manager_->Destroy(std::move(surface)); |
54 } | 54 } |
55 | 55 |
| 56 void SurfaceFactory::SetPreviousFrameSurface(SurfaceId new_id, |
| 57 SurfaceId old_id) { |
| 58 OwningSurfaceMap::iterator it = surface_map_.find(new_id); |
| 59 DCHECK(it != surface_map_.end()); |
| 60 Surface* old_surface = manager_->GetSurfaceForId(old_id); |
| 61 if (old_surface) { |
| 62 it->second->SetPreviousFrameSurface(old_surface); |
| 63 } |
| 64 } |
| 65 |
56 void SurfaceFactory::SubmitCompositorFrame( | 66 void SurfaceFactory::SubmitCompositorFrame( |
57 SurfaceId surface_id, | 67 SurfaceId surface_id, |
58 std::unique_ptr<CompositorFrame> frame, | 68 std::unique_ptr<CompositorFrame> frame, |
59 const DrawCallback& callback) { | 69 const DrawCallback& callback) { |
60 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); | 70 TRACE_EVENT0("cc", "SurfaceFactory::SubmitCompositorFrame"); |
61 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); | 71 OwningSurfaceMap::iterator it = surface_map_.find(surface_id); |
62 DCHECK(it != surface_map_.end()); | 72 DCHECK(it != surface_map_.end()); |
63 DCHECK(it->second->factory().get() == this); | 73 DCHECK(it->second->factory().get() == this); |
64 it->second->QueueFrame(std::move(frame), callback); | 74 it->second->QueueFrame(std::move(frame), callback); |
65 if (!manager_->SurfaceModified(surface_id)) { | 75 if (!manager_->SurfaceModified(surface_id)) { |
(...skipping 27 matching lines...) Expand all Loading... |
93 | 103 |
94 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { | 104 void SurfaceFactory::RefResources(const TransferableResourceArray& resources) { |
95 holder_.RefResources(resources); | 105 holder_.RefResources(resources); |
96 } | 106 } |
97 | 107 |
98 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { | 108 void SurfaceFactory::UnrefResources(const ReturnedResourceArray& resources) { |
99 holder_.UnrefResources(resources); | 109 holder_.UnrefResources(resources); |
100 } | 110 } |
101 | 111 |
102 } // namespace cc | 112 } // namespace cc |
OLD | NEW |