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/output/compositor_frame.h" | 9 #include "cc/output/compositor_frame.h" |
10 #include "cc/output/copy_output_request.h" | 10 #include "cc/output/copy_output_request.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 factory_->UnrefResources(current_resources); | 34 factory_->UnrefResources(current_resources); |
35 } | 35 } |
36 if (!draw_callback_.is_null()) | 36 if (!draw_callback_.is_null()) |
37 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); | 37 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); |
38 } | 38 } |
39 | 39 |
40 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, | 40 void Surface::QueueFrame(scoped_ptr<CompositorFrame> frame, |
41 const DrawCallback& callback) { | 41 const DrawCallback& callback) { |
42 DCHECK(factory_); | 42 DCHECK(factory_); |
43 ClearCopyRequests(); | 43 ClearCopyRequests(); |
44 | 44 TakeLatencyInfo(&frame->metadata.latency_info); |
45 if (frame) { | |
46 TakeLatencyInfo(&frame->metadata.latency_info); | |
47 } | |
48 | |
49 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); | 45 scoped_ptr<CompositorFrame> previous_frame = current_frame_.Pass(); |
50 current_frame_ = frame.Pass(); | 46 current_frame_ = frame.Pass(); |
51 | 47 factory_->ReceiveFromChild( |
52 if (current_frame_) { | 48 current_frame_->delegated_frame_data->resource_list); |
53 factory_->ReceiveFromChild( | |
54 current_frame_->delegated_frame_data->resource_list); | |
55 } | |
56 | |
57 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't | 49 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't |
58 // increment frame index for them. | 50 // increment frame index for them. |
59 if (!current_frame_ || | 51 if (!current_frame_ || |
60 !current_frame_->delegated_frame_data->render_pass_list.empty()) | 52 !current_frame_->delegated_frame_data->render_pass_list.empty()) |
61 ++frame_index_; | 53 ++frame_index_; |
62 | 54 |
63 if (previous_frame) { | 55 if (previous_frame) { |
64 ReturnedResourceArray previous_resources; | 56 ReturnedResourceArray previous_resources; |
65 TransferableResource::ReturnResources( | 57 TransferableResource::ReturnResources( |
66 previous_frame->delegated_frame_data->resource_list, | 58 previous_frame->delegated_frame_data->resource_list, |
67 &previous_resources); | 59 &previous_resources); |
68 factory_->UnrefResources(previous_resources); | 60 factory_->UnrefResources(previous_resources); |
69 } | 61 } |
70 if (!draw_callback_.is_null()) | 62 if (!draw_callback_.is_null()) |
71 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); | 63 draw_callback_.Run(SurfaceDrawStatus::DRAW_SKIPPED); |
72 draw_callback_ = callback; | 64 draw_callback_ = callback; |
73 | 65 factory_->manager()->DidSatisfySequences( |
74 if (current_frame_) { | 66 SurfaceIdAllocator::NamespaceForId(surface_id_), |
75 factory_->manager()->DidSatisfySequences( | 67 ¤t_frame_->metadata.satisfies_sequences); |
76 SurfaceIdAllocator::NamespaceForId(surface_id_), | |
77 ¤t_frame_->metadata.satisfies_sequences); | |
78 } | |
79 } | 68 } |
80 | 69 |
81 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { | 70 void Surface::RequestCopyOfOutput(scoped_ptr<CopyOutputRequest> copy_request) { |
82 if (current_frame_ && | 71 if (current_frame_ && |
83 !current_frame_->delegated_frame_data->render_pass_list.empty()) | 72 !current_frame_->delegated_frame_data->render_pass_list.empty()) |
84 current_frame_->delegated_frame_data->render_pass_list.back() | 73 current_frame_->delegated_frame_data->render_pass_list.back() |
85 ->copy_requests.push_back(copy_request.Pass()); | 74 ->copy_requests.push_back(copy_request.Pass()); |
86 else | 75 else |
87 copy_request->SendEmptyResult(); | 76 copy_request->SendEmptyResult(); |
88 } | 77 } |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 if (current_frame_) { | 135 if (current_frame_) { |
147 for (const auto& render_pass : | 136 for (const auto& render_pass : |
148 current_frame_->delegated_frame_data->render_pass_list) { | 137 current_frame_->delegated_frame_data->render_pass_list) { |
149 for (const auto& copy_request : render_pass->copy_requests) | 138 for (const auto& copy_request : render_pass->copy_requests) |
150 copy_request->SendEmptyResult(); | 139 copy_request->SendEmptyResult(); |
151 } | 140 } |
152 } | 141 } |
153 } | 142 } |
154 | 143 |
155 } // namespace cc | 144 } // namespace cc |
OLD | NEW |