Commit 1675fd68 authored by vollick@chromium.org's avatar vollick@chromium.org

Shouldn't access LayerTreeTest::layer_tree_host on impl thread

If the main thread is unblocked and we access this function on the impl thread,
we're in a racy situation. This should be an error.

BUG=235188

Review URL: https://chromiumcodereview.appspot.com/14179022

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202942 0039d316-1c4b-4281-b951-d872f2087c98
parent 72d0a284
...@@ -605,4 +605,9 @@ scoped_refptr<cc::ContextProvider> LayerTreeTest:: ...@@ -605,4 +605,9 @@ scoped_refptr<cc::ContextProvider> LayerTreeTest::
return compositor_thread_contexts_; return compositor_thread_contexts_;
} }
LayerTreeHost* LayerTreeTest::layer_tree_host() {
DCHECK(proxy()->IsMainThread() || proxy()->IsMainThreadBlocked());
return layer_tree_host_.get();
}
} // namespace cc } // namespace cc
...@@ -146,7 +146,7 @@ class LayerTreeTest : public testing::Test, public TestHooks { ...@@ -146,7 +146,7 @@ class LayerTreeTest : public testing::Test, public TestHooks {
bool TestEnded() const { return ended_; } bool TestEnded() const { return ended_; }
LayerTreeHost* layer_tree_host() { return layer_tree_host_.get(); } LayerTreeHost* layer_tree_host();
bool delegating_renderer() const { return delegating_renderer_; } bool delegating_renderer() const { return delegating_renderer_; }
virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE; virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE;
......
...@@ -291,7 +291,6 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded ...@@ -291,7 +291,6 @@ class LayerTreeHostAnimationTestTickAnimationWhileBackgrounded
SINGLE_AND_MULTI_THREAD_TEST_F( SINGLE_AND_MULTI_THREAD_TEST_F(
LayerTreeHostAnimationTestTickAnimationWhileBackgrounded); LayerTreeHostAnimationTestTickAnimationWhileBackgrounded);
// Ensures that animations continue to be ticked when we are backgrounded.
class LayerTreeHostAnimationTestAddAnimationWithTimingFunction class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
: public LayerTreeHostAnimationTest { : public LayerTreeHostAnimationTest {
public: public:
...@@ -301,6 +300,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction ...@@ -301,6 +300,7 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
LayerTreeHostAnimationTest::SetupTree(); LayerTreeHostAnimationTest::SetupTree();
content_ = FakeContentLayer::Create(&client_); content_ = FakeContentLayer::Create(&client_);
content_->SetBounds(gfx::Size(4, 4)); content_->SetBounds(gfx::Size(4, 4));
content_->set_layer_animation_delegate(this);
layer_tree_host()->root_layer()->AddChild(content_); layer_tree_host()->root_layer()->AddChild(content_);
} }
...@@ -308,17 +308,12 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction ...@@ -308,17 +308,12 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
PostAddAnimationToMainThread(content_); PostAddAnimationToMainThread(content_);
} }
virtual void AnimateLayers( virtual void notifyAnimationStarted(double wallClockTime) OVERRIDE {
LayerTreeHostImpl* host_impl,
base::TimeTicks monotonic_time) OVERRIDE {
LayerAnimationController* controller = LayerAnimationController* controller =
layer_tree_host()->root_layer()->children()[0]-> layer_tree_host()->root_layer()->children()[0]->
layer_animation_controller(); layer_animation_controller();
Animation* animation = Animation* animation =
controller->GetAnimation(Animation::Opacity); controller->GetAnimation(Animation::Opacity);
if (!animation)
return;
const FloatAnimationCurve* curve = const FloatAnimationCurve* curve =
animation->curve()->ToFloatAnimationCurve(); animation->curve()->ToFloatAnimationCurve();
float start_opacity = curve->GetValue(0.0); float start_opacity = curve->GetValue(0.0);
...@@ -331,14 +326,8 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction ...@@ -331,14 +326,8 @@ class LayerTreeHostAnimationTestAddAnimationWithTimingFunction
// because of the default ease timing function. // because of the default ease timing function.
EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time)); EXPECT_FLOAT_EQ(linearly_interpolated_opacity, curve->GetValue(time));
LayerAnimationController* controller_impl =
host_impl->active_tree()->root_layer()->children()[0]->
layer_animation_controller();
Animation* animation_impl =
controller_impl->GetAnimation(Animation::Opacity);
controller->RemoveAnimation(animation->id()); controller->RemoveAnimation(animation->id());
controller_impl->RemoveAnimation(animation_impl->id());
EndTest(); EndTest();
} }
......
...@@ -97,7 +97,7 @@ void SingleThreadProxy::SetLayerTreeHostClientReady() { ...@@ -97,7 +97,7 @@ void SingleThreadProxy::SetLayerTreeHostClientReady() {
} }
void SingleThreadProxy::SetVisible(bool visible) { void SingleThreadProxy::SetVisible(bool visible) {
DebugScopedSetImplThread impl(this); DebugScopedSetImplThreadAndMainThreadBlocked impl(this);
layer_tree_host_impl_->SetVisible(visible); layer_tree_host_impl_->SetVisible(visible);
} }
...@@ -176,9 +176,7 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) { ...@@ -176,9 +176,7 @@ void SingleThreadProxy::DoCommit(scoped_ptr<ResourceUpdateQueue> queue) {
DCHECK(Proxy::IsMainThread()); DCHECK(Proxy::IsMainThread());
// Commit immediately. // Commit immediately.
{ {
DebugScopedSetMainThreadBlocked mainThreadBlocked(this); DebugScopedSetImplThreadAndMainThreadBlocked impl_with_main_blocked(this);
DebugScopedSetImplThread impl(this);
RenderingStatsInstrumentation* stats_instrumentation = RenderingStatsInstrumentation* stats_instrumentation =
layer_tree_host_->rendering_stats_instrumentation(); layer_tree_host_->rendering_stats_instrumentation();
base::TimeTicks start_time = stats_instrumentation->StartRecording(); base::TimeTicks start_time = stats_instrumentation->StartRecording();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment