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.h" | 5 #include "cc/surfaces/surface.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
| 9 #include "cc/base/container_util.h" |
9 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/copy_output_request.h" | 11 #include "cc/output/copy_output_request.h" |
11 #include "cc/surfaces/surface_factory.h" | 12 #include "cc/surfaces/surface_factory.h" |
12 #include "cc/surfaces/surface_id_allocator.h" | 13 #include "cc/surfaces/surface_id_allocator.h" |
13 #include "cc/surfaces/surface_manager.h" | 14 #include "cc/surfaces/surface_manager.h" |
14 | 15 |
15 namespace cc { | 16 namespace cc { |
16 | 17 |
17 // The frame index starts at 2 so that empty frames will be treated as | 18 // The frame index starts at 2 so that empty frames will be treated as |
18 // completely damaged the first time they're drawn from. | 19 // completely damaged the first time they're drawn from. |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 } | 110 } |
110 | 111 |
111 void Surface::TakeCopyOutputRequests( | 112 void Surface::TakeCopyOutputRequests( |
112 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) { | 113 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) { |
113 DCHECK(copy_requests->empty()); | 114 DCHECK(copy_requests->empty()); |
114 if (current_frame_) { | 115 if (current_frame_) { |
115 for (const auto& render_pass : | 116 for (const auto& render_pass : |
116 current_frame_->delegated_frame_data->render_pass_list) { | 117 current_frame_->delegated_frame_data->render_pass_list) { |
117 while (!render_pass->copy_requests.empty()) { | 118 while (!render_pass->copy_requests.empty()) { |
118 scoped_ptr<CopyOutputRequest> request = | 119 scoped_ptr<CopyOutputRequest> request = |
119 render_pass->copy_requests.take_back(); | 120 PopBack(&render_pass->copy_requests); |
120 render_pass->copy_requests.pop_back(); | 121 // TODO(vmpstr): |copy_requests| should store scoped_ptrs. |
| 122 // crbug.com/557388. |
121 copy_requests->insert( | 123 copy_requests->insert( |
122 std::make_pair(render_pass->id, request.release())); | 124 std::make_pair(render_pass->id, request.release())); |
123 } | 125 } |
124 } | 126 } |
125 } | 127 } |
126 } | 128 } |
127 | 129 |
128 const CompositorFrame* Surface::GetEligibleFrame() { | 130 const CompositorFrame* Surface::GetEligibleFrame() { |
129 return current_frame_.get(); | 131 return current_frame_.get(); |
130 } | 132 } |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 if (current_frame_) { | 201 if (current_frame_) { |
200 for (const auto& render_pass : | 202 for (const auto& render_pass : |
201 current_frame_->delegated_frame_data->render_pass_list) { | 203 current_frame_->delegated_frame_data->render_pass_list) { |
202 for (const auto& copy_request : render_pass->copy_requests) | 204 for (const auto& copy_request : render_pass->copy_requests) |
203 copy_request->SendEmptyResult(); | 205 copy_request->SendEmptyResult(); |
204 } | 206 } |
205 } | 207 } |
206 } | 208 } |
207 | 209 |
208 } // namespace cc | 210 } // namespace cc |
OLD | NEW |