| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't | 60 // Empty frames shouldn't be drawn and shouldn't contribute damage, so don't |
| 61 // increment frame index for them. | 61 // increment frame index for them. |
| 62 if (current_frame_ && !current_frame_->render_pass_list.empty()) { | 62 if (current_frame_ && !current_frame_->render_pass_list.empty()) { |
| 63 ++frame_index_; | 63 ++frame_index_; |
| 64 } | 64 } |
| 65 | 65 |
| 66 previous_frame_surface_id_ = surface_id(); | 66 previous_frame_surface_id_ = surface_id(); |
| 67 | 67 |
| 68 std::vector<SurfaceId> new_referenced_surfaces; | |
| 69 new_referenced_surfaces = current_frame_->metadata.referenced_surfaces; | |
| 70 | |
| 71 if (previous_frame) | 68 if (previous_frame) |
| 72 UnrefFrameResources(*previous_frame); | 69 UnrefFrameResources(*previous_frame); |
| 73 | 70 |
| 74 if (!draw_callback_.is_null()) | 71 if (!draw_callback_.is_null()) |
| 75 draw_callback_.Run(); | 72 draw_callback_.Run(); |
| 76 draw_callback_ = callback; | 73 draw_callback_ = callback; |
| 77 | 74 |
| 78 bool referenced_surfaces_changed = | 75 referenced_surfaces_ = current_frame_->metadata.referenced_surfaces; |
| 79 (referenced_surfaces_ != new_referenced_surfaces); | |
| 80 referenced_surfaces_ = new_referenced_surfaces; | |
| 81 std::vector<uint32_t> satisfies_sequences = | |
| 82 std::move(current_frame_->metadata.satisfies_sequences); | |
| 83 | |
| 84 if (referenced_surfaces_changed || !satisfies_sequences.empty()) { | |
| 85 // Notify the manager that sequences were satisfied either if some new | |
| 86 // sequences were satisfied, or if the set of referenced surfaces changed | |
| 87 // to force a GC to happen. | |
| 88 factory_->manager()->DidSatisfySequences(surface_id_.frame_sink_id(), | |
| 89 &satisfies_sequences); | |
| 90 } | |
| 91 } | 76 } |
| 92 | 77 |
| 93 void Surface::EvictFrame() { | 78 void Surface::EvictFrame() { |
| 94 QueueFrame(CompositorFrame(), DrawCallback()); | 79 QueueFrame(CompositorFrame(), DrawCallback()); |
| 95 current_frame_.reset(); | 80 current_frame_.reset(); |
| 96 } | 81 } |
| 97 | 82 |
| 98 void Surface::RequestCopyOfOutput( | 83 void Surface::RequestCopyOfOutput( |
| 99 std::unique_ptr<CopyOutputRequest> copy_request) { | 84 std::unique_ptr<CopyOutputRequest> copy_request) { |
| 100 if (current_frame_ && !current_frame_->render_pass_list.empty()) { | 85 if (current_frame_ && !current_frame_->render_pass_list.empty()) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 void Surface::ClearCopyRequests() { | 171 void Surface::ClearCopyRequests() { |
| 187 if (current_frame_) { | 172 if (current_frame_) { |
| 188 for (const auto& render_pass : current_frame_->render_pass_list) { | 173 for (const auto& render_pass : current_frame_->render_pass_list) { |
| 189 for (const auto& copy_request : render_pass->copy_requests) | 174 for (const auto& copy_request : render_pass->copy_requests) |
| 190 copy_request->SendEmptyResult(); | 175 copy_request->SendEmptyResult(); |
| 191 } | 176 } |
| 192 } | 177 } |
| 193 } | 178 } |
| 194 | 179 |
| 195 } // namespace cc | 180 } // namespace cc |
| OLD | NEW |