summaryrefslogtreecommitdiffstats
path: root/cc/content_layer.cc
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-29 02:54:06 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-29 02:54:06 +0000
commit744449364c71c480ee5dc3e6192c5b848b1a63b8 (patch)
treeda3ac3055adf478d2b7f685cd19cdc0792988842 /cc/content_layer.cc
parent2a6004f1d0b803bab53daaa6a061112b8ee26b87 (diff)
downloadchromium_src-744449364c71c480ee5dc3e6192c5b848b1a63b8.zip
chromium_src-744449364c71c480ee5dc3e6192c5b848b1a63b8.tar.gz
chromium_src-744449364c71c480ee5dc3e6192c5b848b1a63b8.tar.bz2
Do not invalidate ContentLayer when LCD text settings change.
ContentLayer invalidating itself when a paint-property (LCD text) changes is bad design. It should be the responsibility of ContentLayerClient because it is the one doing the painting. BUG 168590 is happening because Aura is trying to animate layer opacity after the delegate, which is responsible for painting, is destroyed. When the delegate is destroyed and an animation needs to be performed, Aura is careful to prevent invalidations to make sure the content is preserved. If we generate invalidations inside the compositor, the content is destroyed and since the delegate is gone, it cannot also be painted resulting in black flash. Going forward, when a paint property changes, we should just notify the ContentLayerClient of those changes and let it decide if the content layer needs to be invalidated. Since this change needs to be merged with M25 branch, I will keep this patch simple and safe. Improvements can be made in subsequent patches. This patch also does not affect LCD text on composited layers because it depends on two factors - Layer::canUseLCDText and GraphicsLayer::contentsOpaque, which is true only for the root layer. So only root layers get LCD text and it does not change during its lifetime. BUG=168590 Review URL: https://chromiumcodereview.appspot.com/12100002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@179280 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/content_layer.cc')
-rw-r--r--cc/content_layer.cc40
1 files changed, 0 insertions, 40 deletions
diff --git a/cc/content_layer.cc b/cc/content_layer.cc
index 4b051ad..5fa5636 100644
--- a/cc/content_layer.cc
+++ b/cc/content_layer.cc
@@ -5,7 +5,6 @@
#include "cc/content_layer.h"
#include "base/auto_reset.h"
-#include "base/debug/trace_event.h"
#include "base/metrics/histogram.h"
#include "base/time.h"
#include "cc/bitmap_content_layer_updater.h"
@@ -39,8 +38,6 @@ void ContentLayerPainter::paint(SkCanvas* canvas, gfx::Rect contentRect, gfx::Re
pixelsPerSec / 1000000, 10, 210, 30);
}
-const int ContentLayer::kLCDTextMaxChangeCount = 1;
-
scoped_refptr<ContentLayer> ContentLayer::create(ContentLayerClient* client)
{
return make_scoped_refptr(new ContentLayer(client));
@@ -49,8 +46,6 @@ scoped_refptr<ContentLayer> ContentLayer::create(ContentLayerClient* client)
ContentLayer::ContentLayer(ContentLayerClient* client)
: TiledLayer()
, m_client(client)
- , m_useLCDText(false)
- , m_lcdTextChangeCount(0)
{
}
@@ -77,7 +72,6 @@ void ContentLayer::update(ResourceUpdateQueue& queue, const OcclusionTracker* oc
base::AutoReset<bool> ignoreSetNeedsCommit(&m_ignoreSetNeedsCommit, true);
createUpdaterIfNeeded();
- updateUseLCDText();
}
TiledLayer::update(queue, occlusion, stats);
@@ -118,38 +112,4 @@ void ContentLayer::setContentsOpaque(bool opaque)
m_updater->setOpaque(opaque);
}
-void ContentLayer::updateUseLCDText()
-{
- if (m_useLCDText == drawProperties().can_use_lcd_text)
- return;
-
- if (!useLCDTextWillChange())
- return;
-
- m_useLCDText = drawProperties().can_use_lcd_text;
- useLCDTextDidChange();
-}
-
-bool ContentLayer::useLCDTextWillChange() const
-{
- // Always allow disabling LCD text.
- if (m_useLCDText)
- return true;
-
- return m_lcdTextChangeCount < kLCDTextMaxChangeCount;
-}
-
-void ContentLayer::useLCDTextDidChange()
-{
- if (m_lcdTextChangeCount > 0) {
- // Do not record the first time LCD text is enabled because
- // it does not really cause any invalidation.
- TRACE_EVENT_INSTANT0("cc", "ContentLayer::canUseLCDTextDidChange");
- }
- ++m_lcdTextChangeCount;
-
- // Need to repaint the layer with different text AA setting.
- setNeedsDisplay();
-}
-
} // namespace cc