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 "content/browser/compositor/reflector_impl.h" | 5 #include "content/browser/compositor/reflector_impl.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "content/browser/compositor/browser_compositor_output_surface.h" | 9 #include "content/browser/compositor/browser_compositor_output_surface.h" |
10 #include "content/browser/compositor/owned_mailbox.h" | 10 #include "content/browser/compositor/owned_mailbox.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 gfx::Rect mirroring_rect(rect.x(), y, rect.width(), rect.height()); | 164 gfx::Rect mirroring_rect(rect.x(), y, rect.width(), rect.height()); |
165 | 165 |
166 // Request redraw of the dirty portion in mirroring compositor. | 166 // Request redraw of the dirty portion in mirroring compositor. |
167 for (LayerData* layer_data : mirroring_layers_) | 167 for (LayerData* layer_data : mirroring_layers_) |
168 UpdateTexture(layer_data, size, mirroring_rect); | 168 UpdateTexture(layer_data, size, mirroring_rect); |
169 composition_count_ = mirroring_layers_.size(); | 169 composition_count_ = mirroring_layers_.size(); |
170 } | 170 } |
171 | 171 |
172 static void ReleaseMailbox(scoped_refptr<OwnedMailbox> mailbox, | 172 static void ReleaseMailbox(scoped_refptr<OwnedMailbox> mailbox, |
173 unsigned int sync_point, | 173 unsigned int sync_point, |
| 174 const gpu::SyncToken& sync_token, |
174 bool is_lost) { | 175 bool is_lost) { |
175 mailbox->UpdateSyncPoint(sync_point); | 176 mailbox->UpdateSyncPoint(sync_point, sync_token); |
176 } | 177 } |
177 | 178 |
178 ScopedVector<ReflectorImpl::LayerData>::iterator ReflectorImpl::FindLayerData( | 179 ScopedVector<ReflectorImpl::LayerData>::iterator ReflectorImpl::FindLayerData( |
179 ui::Layer* layer) { | 180 ui::Layer* layer) { |
180 return std::find_if(mirroring_layers_.begin(), mirroring_layers_.end(), | 181 return std::find_if(mirroring_layers_.begin(), mirroring_layers_.end(), |
181 [layer](const LayerData* layer_data) { | 182 [layer](const LayerData* layer_data) { |
182 return layer_data->layer == layer; | 183 return layer_data->layer == layer; |
183 }); | 184 }); |
184 } | 185 } |
185 | 186 |
186 void ReflectorImpl::UpdateTexture(ReflectorImpl::LayerData* layer_data, | 187 void ReflectorImpl::UpdateTexture(ReflectorImpl::LayerData* layer_data, |
187 const gfx::Size& source_size, | 188 const gfx::Size& source_size, |
188 const gfx::Rect& redraw_rect) { | 189 const gfx::Rect& redraw_rect) { |
189 if (layer_data->needs_set_mailbox) { | 190 if (layer_data->needs_set_mailbox) { |
190 layer_data->layer->SetTextureMailbox( | 191 layer_data->layer->SetTextureMailbox( |
191 cc::TextureMailbox(mailbox_->holder()), | 192 cc::TextureMailbox(mailbox_->holder()), |
192 cc::SingleReleaseCallback::Create(base::Bind(ReleaseMailbox, mailbox_)), | 193 cc::SingleReleaseCallback::Create(base::Bind(ReleaseMailbox, mailbox_)), |
193 source_size); | 194 source_size); |
194 layer_data->needs_set_mailbox = false; | 195 layer_data->needs_set_mailbox = false; |
195 } else { | 196 } else { |
196 layer_data->layer->SetTextureSize(source_size); | 197 layer_data->layer->SetTextureSize(source_size); |
197 } | 198 } |
198 layer_data->layer->SetBounds(gfx::Rect(source_size)); | 199 layer_data->layer->SetBounds(gfx::Rect(source_size)); |
199 layer_data->layer->SetTextureFlipped(flip_texture_); | 200 layer_data->layer->SetTextureFlipped(flip_texture_); |
200 layer_data->layer->SchedulePaint(redraw_rect); | 201 layer_data->layer->SchedulePaint(redraw_rect); |
201 } | 202 } |
202 | 203 |
203 } // namespace content | 204 } // namespace content |
OLD | NEW |