Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2528)

Unified Diff: cc/output/overlay_processor.cc

Issue 2508203004: Add hints for potential overlay promotion on android. (Closed)
Patch Set: cleanup Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: cc/output/overlay_processor.cc
diff --git a/cc/output/overlay_processor.cc b/cc/output/overlay_processor.cc
index 7996ce6789f5c0eb20c6acb1641848028a149cfd..a9ecda698f9d9ae9b657a89e6cb7c1b4096d14f8 100644
--- a/cc/output/overlay_processor.cc
+++ b/cc/output/overlay_processor.cc
@@ -8,9 +8,34 @@
#include "cc/output/overlay_strategy_single_on_top.h"
#include "cc/output/overlay_strategy_underlay.h"
#include "cc/quads/draw_quad.h"
+#include "cc/resources/resource_provider.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/transform.h"
+namespace {
+
+// Utility class to make sure that we notify resource that they're promotable
+// before returning from ProcessForOverlays.
+class NotifyPromotionsBeforeReturning {
+ public:
+ NotifyPromotionsBeforeReturning(cc::ResourceProvider* resource_provider,
+ cc::OverlayCandidateList* candidates)
+ : resource_provider_(resource_provider), candidates_(candidates) {}
+ ~NotifyPromotionsBeforeReturning() {
+#if defined(OS_ANDROID)
+ resource_provider_->SendPromotionHints(candidates_->promotable_resources_);
+#endif
+ }
+
+ private:
+ cc::ResourceProvider* resource_provider_;
+ cc::OverlayCandidateList* candidates_;
+
+ DISALLOW_COPY_AND_ASSIGN(NotifyPromotionsBeforeReturning);
+};
+
+} // namespace
+
namespace cc {
OverlayProcessor::OverlayProcessor(OutputSurface* surface) : surface_(surface) {
@@ -62,6 +87,13 @@ void OverlayProcessor::ProcessForOverlays(ResourceProvider* resource_provider,
OverlayCandidateList* candidates,
CALayerOverlayList* ca_layer_overlays,
gfx::Rect* damage_rect) {
+ // Be sure to send out notifications, regardless of whether we get to
+ // processing for overlays or not. If we don't, then we should notify that
+ // they are not promotable.
+ // TODO(liberato): should we only notify 'yes' instances, and make the
+ // glimage infer the 'no' instances? that seems flaky, though.
+ NotifyPromotionsBeforeReturning notify(resource_provider, candidates);
+
// If we have any copy requests, we can't remove any quads for overlays or
// CALayers because the framebuffer would be missing the removed quads'
// contents.

Powered by Google App Engine
This is Rietveld 408576698