| 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 |
| 68 if (previous_frame) | 71 if (previous_frame) |
| 69 UnrefFrameResources(*previous_frame); | 72 UnrefFrameResources(*previous_frame); |
| 70 | 73 |
| 71 if (!draw_callback_.is_null()) | 74 if (!draw_callback_.is_null()) |
| 72 draw_callback_.Run(); | 75 draw_callback_.Run(); |
| 73 draw_callback_ = callback; | 76 draw_callback_ = callback; |
| 74 | 77 |
| 75 referenced_surfaces_ = current_frame_->metadata.referenced_surfaces; | 78 bool referenced_surfaces_changed = |
| 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 } |
| 76 } | 91 } |
| 77 | 92 |
| 78 void Surface::EvictFrame() { | 93 void Surface::EvictFrame() { |
| 79 QueueFrame(CompositorFrame(), DrawCallback()); | 94 QueueFrame(CompositorFrame(), DrawCallback()); |
| 80 current_frame_.reset(); | 95 current_frame_.reset(); |
| 81 } | 96 } |
| 82 | 97 |
| 83 void Surface::RequestCopyOfOutput( | 98 void Surface::RequestCopyOfOutput( |
| 84 std::unique_ptr<CopyOutputRequest> copy_request) { | 99 std::unique_ptr<CopyOutputRequest> copy_request) { |
| 85 if (current_frame_ && !current_frame_->render_pass_list.empty()) { | 100 if (current_frame_ && !current_frame_->render_pass_list.empty()) { |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 void Surface::ClearCopyRequests() { | 186 void Surface::ClearCopyRequests() { |
| 172 if (current_frame_) { | 187 if (current_frame_) { |
| 173 for (const auto& render_pass : current_frame_->render_pass_list) { | 188 for (const auto& render_pass : current_frame_->render_pass_list) { |
| 174 for (const auto& copy_request : render_pass->copy_requests) | 189 for (const auto& copy_request : render_pass->copy_requests) |
| 175 copy_request->SendEmptyResult(); | 190 copy_request->SendEmptyResult(); |
| 176 } | 191 } |
| 177 } | 192 } |
| 178 } | 193 } |
| 179 | 194 |
| 180 } // namespace cc | 195 } // namespace cc |
| OLD | NEW |