Index: components/display_compositor/compositor_overlay_candidate_validator_android.cc |
diff --git a/components/display_compositor/compositor_overlay_candidate_validator_android.cc b/components/display_compositor/compositor_overlay_candidate_validator_android.cc |
index 805dae3b917d7147b70e749309e068ab3518483e..b4edfd7126e78bfec80a7af0bf882275d2f237f0 100644 |
--- a/components/display_compositor/compositor_overlay_candidate_validator_android.cc |
+++ b/components/display_compositor/compositor_overlay_candidate_validator_android.cc |
@@ -34,6 +34,25 @@ void CompositorOverlayCandidateValidatorAndroid::CheckOverlaySupport( |
if (!candidates->empty()) { |
cc::OverlayCandidate& candidate = candidates->front(); |
+ |
+ if (candidate.is_backed_by_surface_texture) { |
+ // This quad would be promoted if it were backed by a SurfaceView. Since |
+ // it isn't, we can't promote it. We do want to mark it as promotable, |
+ // since the whole point of signalling this is to help whoever creates |
+ // the resource to decide whether a SurfaceTexture or SurfaceView is more |
+ // appropriate to use. |
+ promotable_resources_.insert(candidate.resource_id); |
+ return; |
+ } |
+ |
+ // This quad will be promoted. We clear the promotable set here, since we |
+ // can only promote a single quad. Otherwise, somebody might try to back |
+ // one of the promotable quads with a SurfaceView, and either it or |quad| |
+ // would have to fall back to a texture. |
+ // We could re-insert |candidate.resource_id| back into the set, but the |
+ // quad that refers to it won't be in the list anyway after promotion. |
+ promotable_resources_.clear(); |
+ |
candidate.display_rect = |
gfx::RectF(gfx::ToEnclosingRect(candidate.display_rect)); |
candidate.overlay_handled = true; |
@@ -50,4 +69,13 @@ bool CompositorOverlayCandidateValidatorAndroid::AllowCALayerOverlays() { |
void CompositorOverlayCandidateValidatorAndroid::SetSoftwareMirrorMode( |
bool enabled) {} |
+void CompositorOverlayCandidateValidatorAndroid::ClearPromotableResources() { |
+ promotable_resources_.clear(); |
+} |
+ |
+bool CompositorOverlayCandidateValidatorAndroid::IsResourcePromotable( |
+ cc::ResourceId resource_id) { |
+ return promotable_resources_.count(resource_id) > 0; |
+} |
+ |
} // namespace display_compositor |