| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/compositor_frame_sink_support.h" | 5 #include "cc/surfaces/compositor_frame_sink_support.h" |
| 6 | 6 |
| 7 #include "cc/output/compositor_frame.h" | 7 #include "cc/output/compositor_frame.h" |
| 8 #include "cc/scheduler/begin_frame_source.h" | 8 #include "cc/scheduler/begin_frame_source.h" |
| 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" | 9 #include "cc/surfaces/compositor_frame_sink_support_client.h" |
| 10 #include "cc/surfaces/display.h" | 10 #include "cc/surfaces/display.h" |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 void CompositorFrameSinkSupport::RemoveChildFrameSink( | 119 void CompositorFrameSinkSupport::RemoveChildFrameSink( |
| 120 const FrameSinkId& child_frame_sink_id) { | 120 const FrameSinkId& child_frame_sink_id) { |
| 121 auto it = child_frame_sinks_.find(child_frame_sink_id); | 121 auto it = child_frame_sinks_.find(child_frame_sink_id); |
| 122 DCHECK(it != child_frame_sinks_.end()); | 122 DCHECK(it != child_frame_sinks_.end()); |
| 123 DCHECK(it->is_valid()); | 123 DCHECK(it->is_valid()); |
| 124 surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_, | 124 surface_manager_->UnregisterFrameSinkHierarchy(frame_sink_id_, |
| 125 child_frame_sink_id); | 125 child_frame_sink_id); |
| 126 child_frame_sinks_.erase(it); | 126 child_frame_sinks_.erase(it); |
| 127 } | 127 } |
| 128 | 128 |
| 129 void CompositorFrameSinkSupport::DisplayOutputSurfaceLost() {} | 129 void CompositorFrameSinkSupport::DisplayOutputSurfaceLost() { |
| 130 if (client_) |
| 131 client_->DisplayOutputSurfaceLost(); |
| 132 } |
| 130 | 133 |
| 131 void CompositorFrameSinkSupport::DisplayWillDrawAndSwap( | 134 void CompositorFrameSinkSupport::DisplayWillDrawAndSwap( |
| 132 bool will_draw_and_swap, | 135 bool will_draw_and_swap, |
| 133 const RenderPassList& render_passes) {} | 136 const RenderPassList& render_passes) { |
| 137 if (client_) |
| 138 client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); |
| 139 } |
| 134 | 140 |
| 135 void CompositorFrameSinkSupport::DisplayDidDrawAndSwap() {} | 141 void CompositorFrameSinkSupport::DisplayDidDrawAndSwap() { |
| 142 if (client_) |
| 143 client_->DisplayDidDrawAndSwap(); |
| 144 } |
| 136 | 145 |
| 137 void CompositorFrameSinkSupport::ReturnResources( | 146 void CompositorFrameSinkSupport::ReturnResources( |
| 138 const ReturnedResourceArray& resources) { | 147 const ReturnedResourceArray& resources) { |
| 139 if (resources.empty()) | 148 if (resources.empty()) |
| 140 return; | 149 return; |
| 141 | 150 |
| 142 if (!ack_pending_count_ && client_) { | 151 if (!ack_pending_count_ && client_) { |
| 143 client_->ReclaimResources(resources); | 152 client_->ReclaimResources(resources); |
| 144 return; | 153 return; |
| 145 } | 154 } |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 return; | 196 return; |
| 188 | 197 |
| 189 added_frame_observer_ = needs_begin_frame_; | 198 added_frame_observer_ = needs_begin_frame_; |
| 190 if (needs_begin_frame_) | 199 if (needs_begin_frame_) |
| 191 begin_frame_source_->AddObserver(this); | 200 begin_frame_source_->AddObserver(this); |
| 192 else | 201 else |
| 193 begin_frame_source_->RemoveObserver(this); | 202 begin_frame_source_->RemoveObserver(this); |
| 194 } | 203 } |
| 195 | 204 |
| 196 } // namespace cc | 205 } // namespace cc |
| OLD | NEW |