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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 std::unique_ptr<CopyOutputRequest> copy_request) { | 87 std::unique_ptr<CopyOutputRequest> copy_request) { |
88 if (!current_surface_) { | 88 if (!current_surface_) { |
89 copy_request->SendEmptyResult(); | 89 copy_request->SendEmptyResult(); |
90 return; | 90 return; |
91 } | 91 } |
92 DCHECK(current_surface_->factory().get() == this); | 92 DCHECK(current_surface_->factory().get() == this); |
93 current_surface_->RequestCopyOfOutput(std::move(copy_request)); | 93 current_surface_->RequestCopyOfOutput(std::move(copy_request)); |
94 manager_->SurfaceModified(current_surface_->surface_id()); | 94 manager_->SurfaceModified(current_surface_->surface_id()); |
95 } | 95 } |
96 | 96 |
| 97 void SurfaceFactory::ClearSurface() { |
| 98 if (!current_surface_) |
| 99 return; |
| 100 current_surface_->EvictFrame(); |
| 101 manager_->SurfaceModified(current_surface_->surface_id()); |
| 102 } |
| 103 |
97 void SurfaceFactory::WillDrawSurface(const LocalFrameId& id, | 104 void SurfaceFactory::WillDrawSurface(const LocalFrameId& id, |
98 const gfx::Rect& damage_rect) { | 105 const gfx::Rect& damage_rect) { |
99 client_->WillDrawSurface(id, damage_rect); | 106 client_->WillDrawSurface(id, damage_rect); |
100 } | 107 } |
101 | 108 |
102 void SurfaceFactory::ReceiveFromChild( | 109 void SurfaceFactory::ReceiveFromChild( |
103 const TransferableResourceArray& resources) { | 110 const TransferableResourceArray& resources) { |
104 holder_.ReceiveFromChild(resources); | 111 holder_.ReceiveFromChild(resources); |
105 } | 112 } |
106 | 113 |
(...skipping 12 matching lines...) Expand all Loading... |
119 manager_->RegisterSurface(surface.get()); | 126 manager_->RegisterSurface(surface.get()); |
120 return surface; | 127 return surface; |
121 } | 128 } |
122 | 129 |
123 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { | 130 void SurfaceFactory::Destroy(std::unique_ptr<Surface> surface) { |
124 if (manager_) | 131 if (manager_) |
125 manager_->Destroy(std::move(surface)); | 132 manager_->Destroy(std::move(surface)); |
126 } | 133 } |
127 | 134 |
128 } // namespace cc | 135 } // namespace cc |
OLD | NEW |