summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-16 00:51:56 +0000
committerpiman@chromium.org <piman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-16 00:51:56 +0000
commit7ab3f2755bd71f7b7a9fbed5fef4c3bec628fda6 (patch)
treea74ca7a09c3923bb20313610cbcdd164f367875b /views
parentbf7cb6827ffe5745e3d72fbe2485f28d76593416 (diff)
downloadchromium_src-7ab3f2755bd71f7b7a9fbed5fef4c3bec628fda6.zip
chromium_src-7ab3f2755bd71f7b7a9fbed5fef4c3bec628fda6.tar.gz
chromium_src-7ab3f2755bd71f7b7a9fbed5fef4c3bec628fda6.tar.bz2
Fix stale compositor references from ui::Layer
This is needed to fix some issues in tests exposed by the WebKit compositor. The problem is that sometimes during the teardown paths, some layers have stale a pointer to the compositor that has already been destroyed. The WebKit layer (rightfully) calls ScheduleDraw when the layer hierarchy is changed, exposing the issue. We now always walk back to the root layer to find the compositor, and reset the pointer when the compositor's root changes (or it gets destroyed). BUG=99524 TEST=views_unittest, aura_unittest, compositor_unittests with (and without) use_webkit_compositor=1 Review URL: http://codereview.chromium.org/8510076 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110223 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/view.cc2
-rw-r--r--views/view_unittest.cc2
-rw-r--r--views/widget/native_widget_aura.cc4
3 files changed, 4 insertions, 4 deletions
diff --git a/views/view.cc b/views/view.cc
index 9d5e303..1240f4a 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -1779,7 +1779,7 @@ void View::CreateLayer() {
for (int i = 0, count = child_count(); i < count; ++i)
child_at(i)->UpdateChildLayerVisibility(true);
- layer_.reset(new ui::Layer(NULL));
+ layer_.reset(new ui::Layer());
layer_->set_delegate(this);
UpdateParentLayers();
diff --git a/views/view_unittest.cc b/views/view_unittest.cc
index c4a5256..f4c8068 100644
--- a/views/view_unittest.cc
+++ b/views/view_unittest.cc
@@ -2565,7 +2565,7 @@ TEST_F(ViewLayerTest, RootState) {
EXPECT_EQ(0u, layer->children().size());
EXPECT_FALSE(layer->transform().HasChange());
EXPECT_EQ(widget()->GetRootView()->bounds(), layer->bounds());
- EXPECT_TRUE(layer->compositor() != NULL);
+ EXPECT_TRUE(layer->GetCompositor() != NULL);
}
// Verifies that the complete bounds of a texture are updated if the texture
diff --git a/views/widget/native_widget_aura.cc b/views/widget/native_widget_aura.cc
index 4ff026e..ee23f42 100644
--- a/views/widget/native_widget_aura.cc
+++ b/views/widget/native_widget_aura.cc
@@ -201,11 +201,11 @@ Widget* NativeWidgetAura::GetTopLevelWidget() {
}
const ui::Compositor* NativeWidgetAura::GetCompositor() const {
- return window_->layer()->compositor();
+ return window_->layer()->GetCompositor();
}
ui::Compositor* NativeWidgetAura::GetCompositor() {
- return window_->layer()->compositor();
+ return window_->layer()->GetCompositor();
}
void NativeWidgetAura::CalculateOffsetToAncestorWithLayer(