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/base/container_util.h" |
10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, | 44 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, |
45 const DrawCallback& callback) { | 45 const DrawCallback& callback) { |
46 DCHECK(factory_); | 46 DCHECK(factory_); |
47 ClearCopyRequests(); | 47 ClearCopyRequests(); |
48 | 48 |
49 if (frame) { | 49 if (frame) { |
50 TakeLatencyInfo(&frame->metadata.latency_info); | 50 TakeLatencyInfo(&frame->metadata.latency_info); |
51 } | 51 } |
52 | 52 |
53 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); | 53 scoped_ptr<CompositorFrame> previous_frame = std::move(current_frame_); |
54 current_frame_ = frame.Pass(); | 54 current_frame_ = std::move(frame); |
55 | 55 |
56 if (current_frame_) { | 56 if (current_frame_) { |
57 factory_->ReceiveFromChild( | 57 factory_->ReceiveFromChild( |
58 current_frame_->delegated_frame_data->resource_list); | 58 current_frame_->delegated_frame_data->resource_list); |
59 } | 59 } |
60 | 60 |
61 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't | 61 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't |
62 // increment frame index for them. | 62 // increment frame index for them. |
63 if (current_frame_ && | 63 if (current_frame_ && |
64 !current_frame_->delegated_frame_data->render_pass_list.empty()) | 64 !current_frame_->delegated_frame_data->render_pass_list.empty()) |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // to force a GC to happen. | 97 // to force a GC to happen. |
98 factory_->manager()->DidSatisfySequences( | 98 factory_->manager()->DidSatisfySequences( |
99 SurfaceIdAllocator::NamespaceForId(surface_id_), &satisfies_sequences); | 99 SurfaceIdAllocator::NamespaceForId(surface_id_), &satisfies_sequences); |
100 } | 100 } |
101 } | 101 } |
102 | 102 |
103 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { | 103 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { |
104 if (current_frame_ && | 104 if (current_frame_ && |
105 !current_frame_->delegated_frame_data->render_pass_list.empty()) | 105 !current_frame_->delegated_frame_data->render_pass_list.empty()) |
106 current_frame_->delegated_frame_data->render_pass_list.back() | 106 current_frame_->delegated_frame_data->render_pass_list.back() |
107 ->copy_requests.push_back(copy_request.Pass()); | 107 ->copy_requests.push_back(std::move(copy_request)); |
108 else | 108 else |
109 copy_request->SendEmptyResult(); | 109 copy_request->SendEmptyResult(); |
110 } | 110 } |
111 | 111 |
112 void Surface::TakeCopyOutputRequests( | 112 void Surface::TakeCopyOutputRequests( |
113 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) { | 113 std::multimap<RenderPassId, CopyOutputRequest*>* copy_requests) { |
114 DCHECK(copy_requests->empty()); | 114 DCHECK(copy_requests->empty()); |
115 if (current_frame_) { | 115 if (current_frame_) { |
116 for (const auto& render_pass : | 116 for (const auto& render_pass : |
117 current_frame_->delegated_frame_data->render_pass_list) { | 117 current_frame_->delegated_frame_data->render_pass_list) { |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
201 if (current_frame_) { | 201 if (current_frame_) { |
202 for (const auto& render_pass : | 202 for (const auto& render_pass : |
203 current_frame_->delegated_frame_data->render_pass_list) { | 203 current_frame_->delegated_frame_data->render_pass_list) { |
204 for (const auto& copy_request : render_pass->copy_requests) | 204 for (const auto& copy_request : render_pass->copy_requests) |
205 copy_request->SendEmptyResult(); | 205 copy_request->SendEmptyResult(); |
206 } | 206 } |
207 } | 207 } |
208 } | 208 } |
209 | 209 |
210 } // namespace cc | 210 } // namespace cc |
OLD | NEW |